test: expand coverage for build cache, CLI, watch modes, and parity#11
Merged
Conversation
Add matched TypeScript and Go tests for the highest-risk untested mechanisms surfaced by a coverage pass: - Build cache (cacheHit/cacheSig): hit reuses the model, a file change or InvalidateCache forces re-resolution, and the cache never masks a freshly broken model. Previously 0% in Go and untested in TS. - CLI: missing-file, no-args, and bad-model exit non-zero. This revealed the TS CLI exited 0 on a failed build (unlike the Go CLI and the documented behavior); fix bin/voxgig-model to propagate the failure as a non-zero exit code. - Watch: add/remove event-mode registration and descDeps edge cases (TS), new-file detection (Go), and start() with config disabled (both). - Parity: a second shared fixture covering arrays of objects (element order preserved, keys within each object sorted). - Config: action-order fallback to sorted keys when no explicit order.action is declared (Go). Coverage: Go library 91.9%->95.0%; TS lines 94.6%->95.7%, branches 83.2%->86.3%, funcs 92.8%->94.2%. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011H1DVnQ79nh3ksStScy4uP
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Summary
A test-coverage pass surfaced several high-value mechanisms that were effectively untested in both implementations. This PR adds matched TypeScript + Go test pairs for them, plus one small parity bugfix the new tests revealed.
Tests added
cacheHit/cacheSig)cache.test.ts— hit reuses model, change re-resolves, error not masked by cachebuild_test.go—TestCacheHitSkipsResolve,TestInvalidateCacheForcesResolvecli.test.ts— missing-file, no-args, bad-model exit non-zeromain_test.go)watch.test.ts— add/remove mode registration,descDepsedge cases,start()with config disabledmodel_test.go—TestWatchDetectsNewFile,TestStartWithoutConfigparity.test.ts— second shared fixture (arrays of objects)parity_test.go— matching…ArrayOfObjectsconfig_test.go— fallback to sorted keys when no explicitorder.actionThe build cache (the mtime-based incremental-rebuild skip at the heart of watch mode) was 0% covered in Go and untested in TS — the highest-risk gap and a prime parity-drift spot, since each implementation computes the signature independently.
Bug fixed
Writing the CLI exit-code tests revealed that the TS CLI exited
0even on a broken model, while the Go CLI (anddocs/reference.md, which documents exit1"on … a build error") expect non-zero. Fixedts/bin/voxgig-modelto propagate a failed build as a non-zero exit code. This is the only behavior change here; it aligns the implementation with both the docs and the Go CLI, and is locked down by the newbad-model-exits-nonzerotest.Coverage
cacheHit0% → 100%,configOrder53.8% → 92.3%)Verification
make testgreen in both languagesgofmt -l goclean;go vet ./...cleants/dist-test/regenerated and staged; nots/dist/source drift; no_gen/artifacts staged🤖 Generated with Claude Code
Generated by Claude Code