Skip to content

test(breakout): negative-input tests for the check-spec trust boundary#104

Open
dsmcewan wants to merge 1 commit into
mainfrom
worktree-spec-boundary-tests
Open

test(breakout): negative-input tests for the check-spec trust boundary#104
dsmcewan wants to merge 1 commit into
mainfrom
worktree-spec-boundary-tests

Conversation

@dsmcewan

Copy link
Copy Markdown
Owner

What

Adds breakout/scripts/test-spec-boundary.mjs — a negative-input suite for the gate's declarative check-spec parser (safeCheckFromSpec / reverifyRecord in breakout/verifier.mjs), plus the two-line manifest wiring in breakout/package.json.

Why

The gate re-verifies a breakout record by rebuilding read-only checks from JSON specs instead of trusting the record's self-reported converged. That parser is a trust boundary, but its rejection behavior was only thinly covered. This suite feeds it malformed and hostile specs and asserts the boundary holds.

Coverage

  • Non-object / typeless / array specs → skipped (nothing built)
  • Unknown/hostile type values (incl. command, eval, http_get) → skipped, so the gate path never builds an executable check from a packet-declared command
  • Non-string paths, ../ traversal, and absolute paths outside base → rejected before any filesystem I/O (confinement)
  • Null / malformed records → no crash, nothing reverifiable
  • Mixed batch → locks the three distinct fates (fail / skip / pass) and that one bad check sinks the record

Verification

  • New test passes standalone.
  • Full breakout suite green; build-gate suite (which also runs breakout's) green — no regressions.
  • Mutation-tested: disabling the confinement guard in resolveUnder fails the suite (test Test: verify branch protection required checks (do not merge) #6); reverting restores green. The tests bite.

Keyless and deterministic — no LLM, no network. Zero runtime dependencies. No changes to gate/signing/provenance logic.

🤖 Generated with Claude Code

The gate re-verifies breakout records by rebuilding checks from declarative
JSON specs (safeCheckFromSpec / reverifyRecord). That parser is a trust
boundary but its rejection behavior was only thinly covered. Add a suite that
feeds it malformed and hostile specs and asserts it holds:

- non-object / typeless / array specs are skipped (nothing built)
- unknown/hostile types (incl. command, eval, http_get) are skipped, so the
  gate path never builds an executable check from a packet-declared command
- non-string paths, ../ traversal, and absolute paths outside base are
  rejected before any filesystem I/O (confinement)
- null/malformed records don't crash and expose nothing reverifiable
- a mixed batch locks the three fates (fail / skip / pass) and that one bad
  check sinks the record

Keyless and deterministic. Wired into the package check + test scripts.
Verified by mutation: disabling the confinement guard fails the suite.

Co-Authored-By: Claude <noreply@anthropic.com>
@dsmcewan
dsmcewan force-pushed the worktree-spec-boundary-tests branch from 94fecf0 to eaf9a6d Compare July 16, 2026 11:51
@claude

claude Bot commented Jul 16, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

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.

1 participant