Skip to content

ci: type-check tests/ and send a User-Agent on sim API requests - #57

Open
scott-lowe-vapi wants to merge 1 commit into
mainfrom
ci/test-workflow
Open

scott-lowe-vapi wants to merge 1 commit into
mainfrom
ci/test-workflow

Conversation

@scott-lowe-vapi

Copy link
Copy Markdown
Contributor

Value

V.A.L.U.E. tier: project — PR 1 of 10 for inline simulation PR checks (TEST-141); this PR is a small, behavior-preserving slice.

The CI workflow itself landed in #56, so this PR is smaller than PR 1 in the plan.

Evidence of value

Check main (69c7e83) This branch
tsc --noEmit with tests/ included 37 errors (6 test files) 0 errors
npm test 355 pass 357 pass (2 new, 1 rewritten)
User-Agent on POST /eval/simulation/run none vapi-gitops-sim/1.0.0 (asserted against a local HTTP server)

What the 37 errors were:

  • Fixture drift after the hash-store migration: state entries still carrying lastPulledHash/lastPushedHash, bare-string state values, and an untyped emptyLoaded().
  • One real gap: the reconcile-state-key harness never passed the required formatError, so any test reaching that error path would have thrown a TypeError instead of testing it.

Tests that used the removed hash fields as markers (state-merge, recanonicalize) now mark "which copy won" with distinct UUIDs or object identity, so they still check the same behavior.

Testing plan

  • npm run build (now covers src/ and tests/) and npm test locally on Node 22: green. CI on this PR runs both on Node 20 and 22.
  • New tests/user-agent.test.ts covers the header format against package.json's version, and the header actually sent on run create.
  • sim.test.ts now covers the legacy bare-string state value directly, replacing the old cast-based "forward-compat" test.
  • Not tested: a live run against the API (the header is asserted locally only), and Node 20 locally (left to CI). src/ behavior is unchanged apart from the added header.

Refs TEST-141

🤖 Generated with Claude Code

- tsconfig.json now includes tests/, so `npm run build` (already run by
  CI on every PR) type-checks the tests. tsx runs them without
  type-checking, which is how 37 type errors accumulated unnoticed.
- Fix those 37 errors. All were fixture drift after the hash-store
  migration (state entries carrying lastPulledHash/lastPushedHash or
  bare-string values, an untyped emptyLoaded fixture), plus one real
  gap: the reconcile-state-key harness never passed the required
  formatError, so any test reaching that error path would have thrown.
- New src/user-agent.ts; `npm run sim` sends
  `User-Agent: vapi-gitops-sim/<version>`, so gitops-started simulation
  runs can be counted in the platform's run-started analytics.

Refs TEST-141

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants