Skip to content

fix(qa): tautology detector scores subprocess-driven integration tests 100% tautological (cli.integration.test.ts, pre-existing) #885

Closed

Description

@admarble

Surfaced while fixing #883 (PR #884). Pre-existing — reproduced against origin/main's version of the file, so nothing in #884 caused it.

scripts/qa/tautology-detector-cli.ts reports 100% tautological for src/commands/cli.integration.test.ts and exits 1, failing 3 of its own CLI tests:

{"totalFiles":1,"totalTests":17,"totalTautological":17,
 "overallPercentage":100,"exceedsBlockingThreshold":true}

Pre-existence check — same command against the file as it exists on origin/main:

{"totalFiles":1,"totalTests":16,"totalTautological":16,
 "overallPercentage":100,"exceedsBlockingThreshold":true}

100% either way. The count moved 16 → 17 only because #884 added a test.

Cause: subprocess-driven tests are invisible to import analysis

src/lib/test-tautology-detector.ts defines tautological as "does not call any production function", and decides what production means from imports:

  • node:-prefixed modules are excluded outright (:134)
  • only relative imports count as production code (:139-146)

cli.integration.test.ts imports only node builtins (child_process, path, url, fs, os) and nothing relative — because it exercises production code the only way an end-to-end CLI test can: by spawning node dist/bin/cli.js and asserting on its stdout/stderr/exit code. Static import analysis cannot see through a subprocess boundary, so every test in the file scores zero.

These are among the least tautological tests in the repo — they were added precisely because mocked unit tests missed a real bug (the file header cites #86, where getCurrentVersion() returned 0.0.0 and passed all mocked tests).

Why it has been invisible

The detector only scans git diff main...HEAD --name-only, so it fires solely on PRs that touch an affected file. It is also inert in CI: PR #884 went fully green on all 5 checks while these 3 tests failed locally on the same commit. So today the gate produces local-only noise and no CI protection — worth confirming as part of any fix.

Effect

Any PR touching a subprocess-driven integration test file gets a red local npm test with a 100%-tautological verdict that is wrong. That trains people to ignore the detector, which is the failure mode a QA gate can least afford.

Acceptance Criteria

  • AC-1: cli.integration.test.ts is not reported as tautological, because its tests demonstrably exercise production code through a spawned CLI.
  • AC-2: A test that spawns the project's build output (e.g. execSync/spawnSync on a path under dist/) counts as calling production code, rather than being special-cased by filename or silenced by an opt-out annotation.
  • AC-3: A genuinely tautological test — one asserting only on local variables, calling nothing — is still reported, in a subprocess-driven file too. The fix must not blanket-exempt *.integration.test.ts.
  • AC-4: Confirm whether the gate runs at all in CI (PR fix(#883): spawn the CLI flag-surface tests in a manifest-less temp dir #884 suggests it does not) and either make it effective or state plainly that it is a local-only advisory.

Activity

  1. added
    bug
    on Jul 30, 2026
  2. admarble commented on Jul 31, 2026

    @admarble
    ContributorAuthor

    Complexity: Standard (4 ACs, 2 directories: src/lib/, scripts/qa/)

    AC Quality Check

    All four ACs are measurable and each names its own falsification condition — notably AC-3 pins the anti-regression bar ("must not blanket-exempt *.integration.test.ts") and AC-2 pre-empts the two lazy fixes (filename special-case, opt-out annotation). No vague/unmeasurable/open-ended patterns. AC-4 is investigative-with-a-decision ("confirm … and either make it effective or state plainly") — acceptable; the deliverable is a documented determination, not just prose.


    Scope Assessment

    Non-Goals: ⚠️ No explicit Non-Goals section in the issue. Implicit from AC-2/AC-3: do not special-case by filename and do not add an opt-out annotation. Recommend treating "generalizing beyond dist/ build paths" and "making the CLI's own tests independent of live git state" as out of scope (see Open Questions).

    Metric Value Status
    Feature count 1 (detector production-call inference) ✅
    AC items 4 ✅
    Directory spread 2 (src/lib/, scripts/qa/) + QA skill docs ✅

    Verdict: ✅ SCOPE_OK


    Root Cause (confirmed by reading the code)

    src/lib/test-tautology-detector.ts decides "calls production code" purely from static imports: isSourceModule() excludes node: builtins (:134) and counts only relative .//../ imports as production (:139-147). A test block is tautological iff its body references none of those imported names (testBlockCallsProductionCode, :465).

    src/commands/cli.integration.test.ts imports only node builtins (child_process, path, url, fs, os) and spawns node dist/bin/cli.js (via cliPath = resolve(projectRoot, "dist/bin/cli.js"), :24). Static analysis can't see through the subprocess boundary → importedFunctions is empty → every block scores tautological → 100%.

    Helper indirection matters: blocks invoke the CLI two ways — directly (execSync(\node ${cliPath} --version`), e.g. :58) **and** through describe/module-scope helpers (runHelp :156, runInUninitializedDir :217, runDryRunStreams :295) that close over cliPath. A per-block scan for execSync/dist/` alone would miss every helper-driven block. The fix must resolve helpers.

    AC-4 finding (confirmed): the blocking gate is local/agent-only. It runs only inside /qa via .claude/skills/qa/scripts/quality-checks.sh:389. In GitHub CI, npm test runs the CLI's own tests (scripts/qa/tautology-detector-cli.test.ts), but actions/checkout uses fetch-depth: 1 (no override in ci.yml), so no local main ref exists → git diff main...HEAD throws → getChangedTestFiles() catches and returns [] → status skip → exit 0. That is exactly why PR #884 was green in CI while failing locally. This matches the known-issue note in #810 ("that gate never fires in CI").


    Acceptance Criteria

    AC-1: cli.integration.test.ts is not reported tautological

    Verification: Unit Test (against the real file content as a fixture)
    Scenario: Given cli.integration.test.ts's actual content → When analyzeTestFile() runs → Then tautologicalPercentage is well below the blocking threshold (target: the spawn-driven blocks all count as production; ideally 0% tautological).
    Assumptions: Every it() in that file ultimately spawns dist/bin/cli.js (verified: all blocks call execSync/spawnSync directly or via a cliPath-closing helper).

    AC-2: spawning build output counts as production — not via filename/annotation

    Verification: Unit Test
    Scenario: Given a synthetic test that imports only node:child_process and does execSync(\node ${dist}/bin/cli.js`) (no relative imports, arbitrary non-.integration.filename) → When analyzed → Then the block is non-tautological. **Assumptions:** Detection keys on **content** (a child_process spawn referencing a build-output path), not on the filename and not on any pragma. Mutation check: the fixture must NOT be named*.integration.test.tsand must NOT carry@tautology-skip`, so a filename/annotation shortcut can't satisfy it.

    AC-3: a genuinely tautological block is still reported, even in a subprocess-driven file

    Verification: Unit Test
    Scenario: Given one file containing (a) a block that spawns dist/… and (b) a block that only asserts on local variables and calls nothing → When analyzed → Then (a) is non-tautological and (b) is reported tautological.
    Assumptions: The spawn signal is applied per-block (extending testBlockCallsProductionCode), never as a file-level exemption.

    AC-4: determine CI effectiveness; make effective or document as local-only

    Verification: Manual Test + doc assertion
    Scenario: Given the finding above (gate is local/agent-only; inert in CI by shallow-checkout) → When we resolve AC-4 → Then either (a) a CI step runs the detector against origin/main...HEAD, or (b) the local-only advisory nature is stated plainly in .claude/skills/qa/references/quality-gates.md (and/or the CLI header).
    Recommendation: Option (b) — document as local/agent-only advisory. Rationale below.


    Implementation Plan

    Phase 1: Extend production-call inference (AC-1, AC-2, AC-3) — src/lib/test-tautology-detector.ts

    1. Add a build-output-path collector: scan the whole file for identifiers bound to a build path — (?:const|let|var)\s+(\w+)\s*=\s*[^;]*["'][^"']*\bdist/ — capturing e.g. cliPath. Also treat any literal string containing dist/… as a build-output token. (Keep the token set = { literal "dist/", ...capturedVarNames }.)
    2. Add a spawn helper collector: for each module/describe-scope function or arrow-const definition, extract its body (reuse extractBlockBody) and mark its name as a "spawns-build-output" helper iff the body contains a child_process spawn call (execSync|spawnSync|exec|execFile|fork|spawn) that references a build-output token.
    3. Extend testBlockCallsProductionCode(body, importedFunctions, spawnHandles): a block counts as production if it references an imported production fn OR references a spawn-helper name OR its own body directly contains a spawn call referencing a build-output token. Keep it per-block so AC-3 holds.
    4. Thread the collected spawnHandles from analyzeTestFile() into the per-block check (compute once per file). No changes to the file-level exemption path (@tautology-skip stays a genuine opt-out, untouched).

    Phase 2: Tests (AC-1/2/3) — src/lib/test-tautology-detector.test.ts

    1. Fixture A (AC-2): synthetic non-integration filename, only node:child_process import, direct execSync(node …/dist/bin/cli.js) → non-tautological. Mutation-gate: confirm the test fails if the spawn detection is removed.
    2. Fixture B (AC-3): two-block file, one spawn / one local-only → assert exactly the local-only block is flagged. Mutation-gate: rename/remove the spawn block's dist/ token → both flagged (guards against blanket-exemption).
    3. Fixture C (AC-1, helper indirection): a block that calls a cliPath-closing helper (not a direct spawn) → non-tautological. Optionally load the real cli.integration.test.ts content and assert its percentage is ≤ threshold.

    Phase 3: AC-4 determination + doc

    1. Add a short "Scope / CI effectiveness" note to .claude/skills/qa/references/quality-gates.md (near :170) and the CLI header (scripts/qa/tautology-detector-cli.ts) stating the detector is a local/agent-side advisory run by /qa, inert in GitHub CI by design (shallow checkout → empty diff). If option (a) is chosen instead, add a ci.yml step with fetch-depth: 0 (or explicit git fetch origin main) that runs tautology-detector-cli.ts against origin/main...HEAD.

    Note (not an AC, worth flagging): tautology-detector-cli.test.ts asserts exitCode === 0, which depends on live git diff main...HEAD + working-tree contents. Even after this fix it stays coupled to environment state. Out of scope here; candidate follow-up to feed the detector fixture content instead of the live diff.


    Design Review

    1. Where does this logic belong? In test-tautology-detector.ts's inference layer — same place isSourceModule/testBlockCallsProductionCode already answer "does this block touch production?". The subprocess boundary is just another way a block reaches production; it belongs beside the import inference, not in a caller.
    2. What's the simplest correct approach? Extend the existing per-block predicate with a "spawns build output" signal derived from a one-pass collection of build-path vars + spawn helpers. Rejected: (a) filename special-case — banned by AC-2; (b) @tautology-skip on the file — banned by AC-2 and would silence AC-3's real tautologies; (c) executing/tracing the tests — far too heavy for a static linter.
    3. What existing pattern does this follow? The import-collection → per-block reference-scan pattern already in analyzeTestFile; extractBlockBody is reused for helper bodies. Regex/string scanning is consistent with the file's existing style (no AST).
    4. What would a senior reviewer challenge? "Why regex a dist/ literal instead of an AST?" — the whole detector is deliberately regex-based; introducing a TS parser here is disproportionate. "Why only dist/?" — it's the project's build output and matches AC-2's example; broadening to build//lib//config-driven is a noted open question, not required. Reviewer should verify the helper collector doesn't over-count (a helper that references dist/ in a comment/string but never spawns) — hence the requirement that a spawn call AND a build token co-occur.

    Feature Quality Planning

    All standard checks pass. Notable items:

    • False-positive risk on the helper collector — require co-occurrence of a spawn call and a build-output token in the same helper body; unit-test a helper that mentions dist/ in a string but doesn't spawn (should NOT become a handle).
    • AC-3 is the load-bearing anti-regression — its mutation-gate (blanket-exempting the file makes the local-only block go green) is the one that most directly protects against the lazy fix. Per repo policy, record the mutation result in the PR body.
    • Cross-platform paths — match dist/ with a forward slash; the build output path is constructed via resolve() but the source literal in tests is always "dist/bin/cli.js". Fine, but note Windows path separators won't appear in source literals.

    Derived ACs

    Source Derived AC Priority
    False-positive robustness AC-5: A helper that references a dist/ string but performs no spawn is NOT treated as production. Medium

    Open Questions

    1. AC-4 direction — Recommendation: option (b), document as local/agent-only advisory (matches chore(types): reuseWorktrees is a declared-but-unconsumed RunOptions field #810's existing finding; making CI a hard gate is a larger policy change and would need fetch-depth: 0 + failure-mode agreement). Impact if wrong: a follow-up adds the CI step later.
    2. Generalize beyond dist/? — Recommendation: no; keep dist/ (the project's build dir, matches AC-2's example). Impact if wrong: a project that builds to lib//out/ would still mis-score, but that's not sequant. Could later read the build dir from config.

    Recommended Workflow

    Phases: spec → testgen → exec → qa
    Quality Loop: enabled (SCOPE_OK but the fix is inference logic in a QA gate — regressions here are high-blast-radius)
    Reasoning: All ACs are Unit-Test-verifiable → testgen should stub the three fixtures (spawn-direct, spawn-via-helper, genuine-tautology-in-subprocess-file) before implementation. No UI → no test phase. Not security-sensitive → no security-review.


    Label Review

    Current: bug
    Recommended: bug (add planned)
    Reason: Single-feature localized fix in QA tooling; no complex/refactor/breaking warranted.
    Quality Loop: Won't auto-enable from scope (SCOPE_OK); recommend enabling manually per the reasoning above.

  3. added
    planned
    on Jul 31, 2026
  4. admarble commented on Jul 31, 2026

    @admarble
    ContributorAuthor

    Exec Progress Update

    Implemented the fix in PR #887.

    AC Coverage

    AC Status Notes
    AC-1 ✅ Real cli.integration.test.ts goes 100% → 0% tautological (all 17 blocks); helper indirection resolved transitively
    AC-2 ✅ Detection keys on content (a child-process spawn referencing a dist/ build path), not filename or @tautology-skip; test fixtures use non-integration filenames with no annotation
    AC-3 ✅ Per-block predicate — a local-only block is still flagged even in a subprocess-driven file; no *.integration.test.ts exemption
    AC-4 ✅ (option b) Confirmed the gate is local/agent-only (runs in /qa; inert in CI because shallow checkout makes git diff main...HEAD empty). Documented in quality-gates.md (3 mirrors) + the detector CLI header rather than made a hard CI gate. Matches the #810 finding.
    AC-5 (derived) ✅ A helper that references a dist/ string but never spawns is NOT treated as production (spawn + build-token co-occurrence required)

    Approach

    Extended the detector's per-block "calls production code" inference (src/lib/test-tautology-detector.ts) with two content signals: a build-output-path variable collector (captures e.g. cliPath = resolve(root, "dist/bin/cli.js")) and a spawn-helper collector that marks describe/module-scope helpers spawning the build output — resolved transitively so a test calling expectFlagAccepted → runInUninitializedDir → spawnSync(cliPath) counts. No filename special-case, no opt-out annotation; @tautology-skip untouched.

    Checks

    • npm run build ✅ · npm run lint ✅ · npx vitest run on detector + CLI tests → 63 passed (7 new)

    Mutation verification (repo gate-test policy)

    • Mutation A (spawnsBuildOutput → return false): exactly the 5 spawn-detection tests failed; the AC-5 negative test still passed. Restored.
    • Mutation B (drop the SPAWN_PATTERN.test(body) && co-occurrence requirement): the AC-5 test failed. Restored.

    Files changed

    • src/lib/test-tautology-detector.ts (+ 7 tests in .test.ts)
    • scripts/qa/tautology-detector-cli.ts (AC-4 header note)
    • .claude/skills/qa/references/quality-gates.md + skills/… + templates/skills/… (3 mirrors synced)
    • CHANGELOG.md

    PR: #887

  5. admarble commented on Jul 31, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #885

    AC Coverage

    AC Source Description Status Notes
    AC-1 Original cli.integration.test.ts not reported tautological MET Ran the detector against the real file: 17 tests, 0 tautological (0.0%), down from 100%. Helper indirection (runHelp, runInUninitializedDir, expectFlagAccepted, runDryRunStreams) resolves transitively.
    AC-2 Original Spawning build output counts as production, not via filename/annotation MET Detection keys on content (spawnsBuildOutput: a child-process spawn referencing a dist/ token). AC-2 test uses a non-integration filename with no @tautology-skip; hasTautologySkipPragma path untouched.
    AC-3 Original Genuine tautology still reported in a subprocess file; no blanket exemption MET Per-block predicate. AC-3 test asserts the local-only block stays tautological while the spawn block does not; independently confirmed a dist-referencing-but-non-spawning block is still flagged. Mutation-verified in exec.
    AC-4 Original Confirm CI effectiveness; make effective or document local-only MET Option (b): confirmed local/agent-only (CI shallow-checkout → empty git diff main...HEAD). Documented in quality-gates.md (3 mirrors identical) + CLI header.
    AC-5 Derived (false-positive robustness) Helper referencing a dist/ string but not spawning is NOT production MET spawnsBuildOutput requires spawn and build-token co-occurrence; mutation-verified (dropping the spawn requirement fails the AC-5 test).

    Coverage: 5/5 AC items met (4 original + 1 derived)

    Quality Plan Verification

    Dimension Status
    False-positive robustness (helper collector) ✅ Co-occurrence required; AC-5 test + mutation
    Anti-regression (AC-3 per-block) ✅ Mutation-verified
    Cross-platform paths ✅ dist/ forward-slash literal; noted Windows source literals don't use \

    Quality Plan Status: Complete

    CI Status

    PR #887 exists; no checks have registered yet. No AC is CI-dependent (AC-4 explicitly confirms the gate is inert in CI), so CI state does not gate this verdict.

    Quality Metrics

    Metric Value Status
    Type issues (any) 0 OK
    Deleted tests 0 OK
    Files changed 7 OK
    Lines +353 / -14 -

    Build: ✅ tsc clean. Tests: ✅ 63 passed (detector + CLI), 7 new.

    Test Coverage Analysis

    Changed File Tier Has Tests?
    src/lib/test-tautology-detector.ts Standard ✅ test-tautology-detector.test.ts (+7)
    scripts/qa/tautology-detector-cli.ts Standard ✅ (comment-only change)

    Code Review

    Strengths: Extends the existing per-block inference cleanly; transitive helper closure correctly handles the two-level indirection in the real file; co-occurrence guard prevents the obvious false positive; helper extraction anchors on => { to skip return-type object braces; bounded [^()]* params prevent runaway matching; all consumers backward-compatible (additive optional params).

    Execution Evidence (§11): scripts/ change is comment-only (JSDoc header) → Overridden, risk None. /verify not required.

    Trust-Boundary Check

    Finding: Clean — diff implements only the product requirements from issue #885; no agent-directed external-text instruction was acted on.
    Status: Clean

    Behavior-Rule Survival Check

    No AC triggers the behavior-rule heuristic, and the old rule (import-only detection) is extended, not replaced — no inverse symbol to remove.
    Status: N/A

    CHANGELOG Verification

    [Unreleased] → Fixed entry present for #885. Result: Requirements met.

    Risk Assessment

    • Likely failure mode: SPAWN_PATTERN includes bare exec/spawn/fork, which also match method calls like RegExp.prototype.exec(). A test that (a) references a dist/ token AND (b) calls .exec(/.spawn( on a non-child-process object while otherwise asserting only on locals is masked as non-tautological (false negative). Demonstrated: a block doing /cli/.exec(cliPath) with cliPath = "dist/bin/cli.js" is reported non-tautological.
    • Not tested: the .exec()/dist-token collision case has no test.
    • Sibling sites considered: none — no cross-file siblings; the detector is a single module.
    • Sibling-line audit: none — single-module change.

    Adversarial Re-Read

    Findings: One real gap — the spawn-token breadth false-negative above (regex.exec() + a dist/ token). Narrow (requires co-occurrence of a build token and a bare/method exec/spawn) and the detector is an advisory-only heuristic, but it weakens AC-3's guarantee at the margin. The real cli.integration.test.ts uses only execSync/spawnSync (bare imported identifiers), so tightening SPAWN_PATTERN — e.g. dropping bare exec/spawn/fork or excluding .-prefixed method calls — would keep AC-1 at 0% while closing the false-negative. Recommended as a follow-up, not a blocker. All verbatim behaviors validated against the real file and adversarial fixtures; evidence claims are post-fix validations (not bug repros); no Non-Goals expanded.
    Status: Gaps Found

    Verdict: AC_MET_BUT_NOT_A_PLUS

    All 5 ACs are met and mutation-verified; build/lint/tests green; the 100%→0% fix is confirmed against the real file. The adversarial re-read surfaced one narrow false-negative (SPAWN_PATTERN matching method-style .exec() alongside a dist/ token), which is a non-blocking robustness improvement rather than an unmet AC. Safe to merge; recommend a follow-up to tighten the spawn matcher.

    Documentation

    • AC-4 docs updated (quality-gates.md ×3 + CLI header)
    • CHANGELOG entry added

    Next Steps

    1. Merge-ready. Do not run /loop (AC_MET_BUT_NOT_A_PLUS breaks to PR).
    2. Follow-up (optional): tighten SPAWN_PATTERN to exclude method-style .exec()/.spawn() (or drop bare exec/spawn/fork), with a regression test for a dist-referencing regex-.exec tautology. Real file stays 0% either way.
  6. added
    needs-improvement
    on Jul 31, 2026
  7. added a commit that references this issue on Jul 31, 2026
  8. admarble commented on Jul 31, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #885 (re-run at 781578e)

    Re-run after closing the single gap from the prior QA (at e9a56a13, verdict AC_MET_BUT_NOT_A_PLUS). Delta since that full review: f7774ea1 (SPAWN_PATTERN tightening + 2 regression tests, +42/−3 across 2 files) and 781578e8 (merge of origin/main, CHANGELOG both-sides conflict resolution only). All other files are byte-identical to the previously reviewed state; unchanged sections below reference the prior review.

    AC Coverage

    AC Source Description Status Notes
    AC-1 Original cli.integration.test.ts not reported tautological MET Re-verified at new HEAD: 17 tests, 0 tautological under the tightened pattern.
    AC-2 Original Spawning build output counts as production, not via filename/annotation MET Unchanged; new test additionally pins method-style cp.execSync(...) from a namespace import as production.
    AC-3 Original Genuine tautology still reported in a subprocess file; no blanket exemption MET Strengthened: the .exec()-collision false negative from the prior QA is closed. A block running RegExp.prototype.exec against a dist/ string while asserting only on locals is now reported tautological.
    AC-4 Original Confirm CI effectiveness; make effective or document local-only MET Unchanged (documented local-only advisory, 3 mirrors + CLI header).
    AC-5 Derived dist/-referencing non-spawning helper is NOT production MET Unchanged; suite re-run green at new HEAD.

    Coverage: 5/5 AC items fully met (4 original + 1 derived)

    Delta Review (f7774ea)

    SPAWN_PATTERN split by name ambiguity: unambiguous long names (execFileSync, spawnSync, execSync, execFile) match anywhere including method position; short generic names (exec, spawn, fork) now carry (?<![\w$.]) so regex.exec(...), worker.spawn(...), obj?.fork(...) no longer count as spawns.

    • Mutation-verified: reverting SPAWN_PATTERN to the previous alternation fails exactly the new regression test ("does not mask a tautology via method-style .exec() plus a dist/ token"), 59/60 others pass. Recorded in the f7774ea1 commit message.
    • Real-file corpus check: analyzeTestFile on src/commands/cli.integration.test.ts at new HEAD → 17 tests, 0 tautological.
    • Accepted trade-off (documented in code): callback-style cp.exec(...) via namespace import no longer counts as a spawn. Rare in build-output tests (sync variants dominate), and the resulting failure mode is a loud false positive rather than the silent false negative it replaces.

    CI Status

    Check State Impact
    build (22.x), typecheck, node-floor-guard, validate-skills, validate-plugin, Hooks Validation, Plugin Structure Validation, Setup Directory Creation SUCCESS ✅

    CI Summary: 8 passed, 0 pending, 0 failed. (First push reported CONFLICTING/no checks — resolved by merging origin/main; CHANGELOG was the only conflict, both sides kept.)

    Quality Metrics (delta)

    Metric Value Status
    Type issues (any) 0 OK
    Deleted tests 0 OK
    Files changed (delta) 2 (+CHANGELOG merge) OK
    Lines (delta) +42 / −3 -

    tsc --noEmit clean. Targeted suites at new HEAD: detector unit (60), detector CLI (5), cli.integration.test.ts (17), plus src/lib/__tests__ — 82/82 and 182/182 green.

    Test Coverage Analysis

    Changed File (delta) Tier Has Tests?
    src/lib/test-tautology-detector.ts Standard ✅ test-tautology-detector.test.ts (+2 regression tests)

    Code Review

    Strengths: Fix is surgical (one regex + doc comment); the ambiguity split preserves every spawn shape the real corpus uses while excluding only collision-prone method position; the trade-off is stated in the comment rather than hidden; both directions pinned by tests (.exec() stays flagged, cp.execSync() stays production).

    Issues: None found in the delta.

    Risk Assessment

    • Likely failure mode: a test spawning build output exclusively via callback-style cp.exec(...) would be flagged tautological (loud false positive). No such test exists in the repo.
    • Not tested: exotic invocation shapes (["exec"](...), aliased destructures) — unmatched both before and after; behavior unchanged.
    • Sibling sites considered: none — the detector is a single module; no cross-file siblings.
    • Sibling-line audit: SPAWN_PATTERN is consumed only by spawnsBuildOutput, both call sites (helper closure + direct block) audited and covered by tests.

    Trust-Boundary Check

    Finding: Clean — the delta implements only the robustness gap identified by QA; no agent-directed external-text instruction was acted on.
    Status: Clean

    Behavior-Rule Survival Check

    Status: N/A — no AC triggers the behavior-rule heuristic; the old pattern is fully replaced in place (no inverse symbol survives — mutation check confirms the old alternation exists nowhere else).

    CHANGELOG Verification

    [Unreleased] → Fixed entry for #885 present and intact after the merge-conflict resolution (both #885 and main's #856 entries retained). Result: Requirements met.

    Adversarial Re-Read

    Findings: No gaps found because: the prior re-read's sole finding (spawn-token breadth false negative) was reproduced, fixed, mutation-verified, and regression-tested; the fix was re-run against the verbatim motivating corpus (cli.integration.test.ts → 0/17); evidence claims above are post-fix validations, not bug repros; lookbehind edge shapes (?.exec(, ...spawn(, computed access) were traced against the regex; the merge commit was inspected to confirm it touches only CHANGELOG; no Non-Goals expanded (no filename special-case, no opt-out annotation added).
    Status: Clean

    Verdict: READY_FOR_MERGE

    All 5 ACs met and mutation-verified; the single non-blocking gap from the prior QA is closed with a regression test; CI fully green at 781578e8; CHANGELOG intact. No outstanding improvement suggestions.

    Documentation

    • AC-4 docs (quality-gates.md ×3 + CLI header) — unchanged from prior review
    • CHANGELOG entry present

    Next Steps

    1. Merge PR fix(#885): count spawns of dist/ build output as production in tautology detector #887.
  9. added
    ready-for-review
    and removed
    needs-improvement
    on Jul 31, 2026
  10. added a commit that references this issue on Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugplannedready-for-review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions