test(cli): cover PlatformBinaryResolution.source and asMatchMode's refusal - #304
Conversation
|
@claude /review |
|
Claude finished @thecodedrift's task in 4m 25s —— View job Review completeReview mode: incremental — read 0 prior review thread(s) before reviewing.
Assessment: sound, no defects found. This is a test-only PR (no production code touched), and it does what it claims. Verified against source:
Two minor, non-blocking nits posted as inline comments (both
No correctness, security, or test-adequacy issues found. Nothing here needs to change before merge as far as this review is concerned. |
… the missing match-mode refusal platform-binary.test.ts's candidate-order suite already pins PATH's tie-break ordering but never read .source, so a resolver that always reported "platform-package" (the pinned-binary claim callers gate on) would have passed. Add source assertions to the two PATH-tier tests and a new case for the node_modules/.bin tier; platform-package and undefined are already covered in engine-version-consistency.test.ts. engine-dispatch.test.ts's REFUSALS table covers every other reason a runtime capture is refused but had no case for an unimplemented match: value, even though "must not be coerced to anchor" is asMatchMode's central claim. Add that case. Coverage only, no production changes.
a4f4c70 to
0f5e5c5
Compare
|
All four checks pass and the two inline notes are answered. The REFUSALS overlap is deliberate and the thread explains why; the Thanks specifically for tracing the — AI Coding Agent |
Stack (root → tip):
What
Two coverage gaps from #284:
PlatformBinaryResolution.source(packages/cli/src/rules/platform-binary.ts) was documented as load-bearing — only"platform-package"entitles a caller to treat the binary as pinned — but no test inplatform-binary.test.tsever read.source. Added.sourceassertions to the two existing PATH-tier tests, plus a new test for thenode_modules/.bintier. (platform-packageandundefinedwere already covered separately inengine-version-consistency.test.ts, confirmed by grep before adding anything.)asMatchMode(packages/cli/src/rules/runtime/discover.ts) refuses an unimplementedmatch:value rather than coercing it toanchor— its central claim, per its own doc comment.engine-dispatch.test.ts'sREFUSALStable exercised every other refusal reason but had no case for this one. Added it.No production code changed.
Mutation-check table
platform-binary.test.ts— "tries the alternative name before the canonical one on PATH" (source assertion)resolvePlatformBinaryalways returnssource: "platform-package"expected 'platform-package' to be 'PATH'); PASSED after revertplatform-binary.test.ts— "still resolves the canonical name when it is the only one" (source assertion)platform-binary.test.ts— "reports node_modules/.bin as the source when that tier answers" (new test)engine-dispatch.test.ts— new REFUSALS case "unimplemented match mode"asMatchModecoerces an unrecognized string to"anchor"instead of returningundefinedverifyreportedok: true); PASSED after revertEach mutation was applied to source, confirmed the corresponding test (and, in the
asMatchModecase, several pre-existing tests) failed, then reverted and confirmed green.Verification
NODE_OPTIONS= pnpm test— 82 files / 1327 tests passing (baseline for these two files was 54 tests; now 56)NODE_OPTIONS= pnpm typecheck— cleanNODE_OPTIONS= pnpm lint— clean (eslint + built-CLI house-style check)Notes on the issue text
The issue said "no assertions" read
.sourceinplatform-binary.test.ts, which is true, butengine-version-consistency.test.tsalready covers the"platform-package"andundefinedcases directly againstresolvePlatformBinary. The genuinely uncovered values were"node_modules/.bin"and"PATH", both closed in this PR.No defects found in production code; nothing here changes behavior.
Refs #284