ci: type-check tests/ and send a User-Agent on sim API requests - #57
Open
scott-lowe-vapi wants to merge 1 commit into
Open
scott-lowe-vapi wants to merge 1 commit into
scott-lowe-vapi wants to merge 1 commit into
Conversation
- 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>
Contributor
Author
This was referenced Oct 1, 2026
scott-lowe-vapi
marked this pull request as ready for review
October 1, 2026 23:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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.
tests/was never type-checked (tsconfig.jsonincluded onlysrc/), so 37 type errors piled up silently. That's the gap test: restore the suite after the hash-store migration and run it in CI #56 named as follow-up inimprovements.mdfix(push,pull): recanonicalize stale UUID-suffixed state keys — root-cause duplicate generation #32. Separately, simulation runs started from gitops can't be told apart in the platform's analytics.npm run build, which CI already runs on every PR, now type-checkstests/.npm run simsendsUser-Agent: vapi-gitops-sim/<version>. The API records this asuser_agenton the[simulation] run startedevent.The CI workflow itself landed in #56, so this PR is smaller than PR 1 in the plan.
Evidence of value
main(69c7e83)tsc --noEmitwithtests/includednpm testUser-AgentonPOST /eval/simulation/runvapi-gitops-sim/1.0.0(asserted against a local HTTP server)What the 37 errors were:
lastPulledHash/lastPushedHash, bare-string state values, and an untypedemptyLoaded().reconcile-state-keyharness never passed the requiredformatError, so any test reaching that error path would have thrown aTypeErrorinstead 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 coverssrc/andtests/) andnpm testlocally on Node 22: green. CI on this PR runs both on Node 20 and 22.tests/user-agent.test.tscovers the header format againstpackage.json's version, and the header actually sent on run create.sim.test.tsnow covers the legacy bare-string state value directly, replacing the old cast-based "forward-compat" test.src/behavior is unchanged apart from the added header.Refs TEST-141
🤖 Generated with Claude Code