Skip to content

test(runtime): close the invariant-suite handoff coverage gaps - #341

Merged
aviggiano merged 1 commit into
mainfrom
test/invariant-handoff-coverage
Aug 7, 2026
Merged

aviggiano merged 1 commit into
mainfrom
test/invariant-handoff-coverage

Conversation

@aviggiano

@aviggiano aviggiano commented Aug 7, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #213. Closes #215. Closes #212. Closes #211. Closes #214.

Five test gaps from the review of PR #209, which shipped no behavioral test of its own. Production code was found correct for #212/#213/#215; #211 and #214 had real harness stubs that are now un-stubbed.

Verification ran 16 mutations of workflow.tsx; all five tests are load-bearing. Three mutations survive the suite — recorded as coverage gaps, not defects; production is untouched.

⚠️ Conflicts with #342 (fix/invariant-source-budgets) in this same test file. The conflict is textual — both sides add distinct test() blocks and git mis-merges on shared trailing boilerplate. A union resolution is correct; one duplicated readdirSync bag key needs dropping.

Greptile Summary

Adds load-bearing invariant-suite handoff regression coverage without modifying production behavior.

  • Verifies protected baselines survive agent-side sidecar forgery and process restart.
  • Covers propagation of changed source helpers, plural test-root retry cleanup, and inherited suite files.
  • Exercises provenance root and budget validation plus fail-closed rejection of unreferenced suite artifacts.

Confidence Score: 5/5

The PR appears safe to merge; the added tests faithfully exercise the intended generated-workflow handoff paths.

The change is test-only, and the new helper extraction, fixtures, constants, state bindings, and asserted failure paths align with the generated workflow behavior they cover.

Important Files Changed

Filename Overview
packages/runtime/test/invariant-suite-handoff-durability.test.ts Expands the workflow-helper harness and adds five focused handoff durability and provenance regression tests; no actionable defect was identified.

Reviews (1): Last reviewed commit: "test(runtime): close the invariant-suite..." | Re-trigger Greptile

Context used:

Five helpers the invariant-suite handoff depends on were either named in no
helper list -- so the template's real code never ran -- or shadowed by a harness
stub that answered the very question under test.

- #213 `captureInvariantSuiteBaseline` was in no list. It now runs, and a test
  tampers with the agent-writable sidecar after clearing the in-memory digests
  the way a durable resume does; the protected copy under run state wins.
- #215 `state.changedInvariantSourcePaths` was initialized `[]` and never set,
  so the `src/`/`contracts/` capture at the companions call site was dead. A
  changed `src/` helper now has to reach the manifest and the next worktree.
- #212 `invariantTestRoots` was stubbed `() => []`, which made the retry
  cleanup loop unreachable. It is un-stubbed against an Aave-like `tests/`
  fixture with no `test/` root at all.
- #211 `assertSafeInvariantSuitePath` was stubbed down to an absolute/traversal
  check and `assertInvariantSuiteSourceBudget` to a no-op; both are un-stubbed
  through a new PROVENANCE_HELPERS list. A second test covers the retention
  path -- every existing companions fixture tombstones the ancestor file, so
  none of them showed an inherited-only source surviving.
- #214 PUBLICATION_HELPERS did not name `listInvariantSuiteSources`, so the
  enumeration under test was the harness's own. With the real one loaded, an
  extra file dropped under `invariant-suite/` fails the publication closed.

No production change: every new assertion passes against the template as it
stands, and each one was confirmed to fail against a mutation of the specific
line it covers.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@aviggiano
aviggiano merged commit 38a13dc into main Aug 7, 2026
8 checks passed
@aviggiano
aviggiano deleted the test/invariant-handoff-coverage branch August 7, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant