Skip to content

test: expand coverage for build cache, CLI, watch modes, and parity#11

Merged
rjrodger merged 1 commit into
mainfrom
claude/test-coverage-analysis-bzl23d
Jun 23, 2026
Merged

test: expand coverage for build cache, CLI, watch modes, and parity#11
rjrodger merged 1 commit into
mainfrom
claude/test-coverage-analysis-bzl23d

Conversation

@rjrodger

Copy link
Copy Markdown
Contributor

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

Area TypeScript Go
Build cache (cacheHit/cacheSig) cache.test.ts — hit reuses model, change re-resolves, error not masked by cache build_test.goTestCacheHitSkipsResolve, TestInvalidateCacheForcesResolve
CLI cli.test.ts — missing-file, no-args, bad-model exit non-zero (already covered in main_test.go)
Watch watch.test.ts — add/remove mode registration, descDeps edge cases, start() with config disabled model_test.goTestWatchDetectsNewFile, TestStartWithoutConfig
Parity parity.test.ts — second shared fixture (arrays of objects) parity_test.go — matching …ArrayOfObjects
Config order config_test.go — fallback to sorted keys when no explicit order.action

The 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 0 even on a broken model, while the Go CLI (and docs/reference.md, which documents exit 1 "on … a build error") expect non-zero. Fixed ts/bin/voxgig-model to 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 new bad-model-exits-nonzero test.

Coverage

  • Go library: 91.9% → 95.0% (cacheHit 0% → 100%, configOrder 53.8% → 92.3%)
  • TS: lines 94.6% → 95.7%, branches 83.2% → 86.3%, funcs 92.8% → 94.2%
  • TS suite 26 → 36 tests

Verification

  • make test green in both languages
  • gofmt -l go clean; go vet ./... clean
  • ts/dist-test/ regenerated and staged; no ts/dist/ source drift; no _gen/ artifacts staged

🤖 Generated with Claude Code


Generated by Claude Code

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
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@rjrodger rjrodger merged commit 322b1d0 into main Jun 23, 2026
6 checks passed
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.

2 participants