tools/context-pack.py: carry cut_spec anchors to the worktree #8

Merged
eureka merged 6 commits from hands/context-pack-tool into main 2026-10-09 12:06:07 +00:00
Owner

Adds tools/context-pack.py: carries a cut_spec's file_changes anchors from the spec's base to the worktree, so Hands reads only the windows a spec names instead of whole files.

  • Literal pathspecs; typed spec-shape refusals (exit 4, field name only); straddling deletions map to the first surviving line.
  • The anchor table prints whole even past --max-lines (ruling eureka-substrate:ruling:context-pack-table-beats-budget).

Mind record: spec eureka-substrate:cut_spec:cut-context-pack-tool.r1, reports h1/h2, Soul verdicts s1 (8 findings) and s2 (all 8 held fixed; two pre-existing Lows deferred to follow-up eureka-substrate:follow_up:context-pack-hostile-spec-hardening). bash tools/test-tools.sh: 305 ok, 0 FAIL at 5bf88b8.

🤖 Generated with Claude Code

Adds `tools/context-pack.py`: carries a cut_spec's `file_changes` anchors from the spec's base to the worktree, so Hands reads only the windows a spec names instead of whole files. - Literal pathspecs; typed spec-shape refusals (exit 4, field name only); straddling deletions map to the first surviving line. - The anchor table prints whole even past `--max-lines` (ruling `eureka-substrate:ruling:context-pack-table-beats-budget`). Mind record: spec `eureka-substrate:cut_spec:cut-context-pack-tool.r1`, reports h1/h2, Soul verdicts s1 (8 findings) and s2 (all 8 held fixed; two pre-existing Lows deferred to follow-up `eureka-substrate:follow_up:context-pack-hostile-spec-hardening`). `bash tools/test-tools.sh`: 305 ok, 0 FAIL at 5bf88b8. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Anchors resolve through git diff hunks from the spec's base (working tree
included) into a status table plus bounded windows; --since re-prints only
edited windows. Spec by id through the eureka-state stdio binding, or a
saved view. Fixture section in test-tools.sh; INDEX row.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Survivors of the first mutmut run (200 of 688) drove these: replaced-block
and pure-deletion hunks, --since boundaries, NEW windows, 70-column change
text, the stdio handshake the fake server now validates, every error code.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- git() is the one git call and passes --literal-pathspecs, so a spec path
  with [ ] * ? names that file and no sibling.
- spec_from_json validates base, file_changes and deletes; a wrong type is
  Fail(4) naming the field and InvalidInput, never a traceback or the value.
- carry(): a deletion straddling an anchor start maps to c+1 and one
  straddling its end to c; the d>0 clamp is no longer special-cased.
- The header prints a non-hex base as "unresolvable"; --max-lines is
  documented as bounding windows, the table always listing every anchor.
- The fake eureka-state gains FAKE_MODE=needenv for the binding env test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Real git repos in scratch: a src/[a] path beside src/a, pure deletions and
one-line replacements straddling either end of an anchor, edits on an
anchor's first and last line under --since, a --since commit with an
unreadable tree, thirteen wrong-typed spec variants with canaries, a
--max-lines below the table, --only truncation at the 7 and 6 line
thresholds and with a reserved not-expanded line, and the binding env block
with the caller's environment overriding it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Targets the mutants that survived the first fix run: need arithmetic of cut
and full windows, the reserve for the not-expanded line at the budget edge,
the left-reserve >= 4 threshold with two windows, the exact more-lines
note, the blank line after the table, a non-sha base never echoed in the
header, and a spec without a base refused rather than crashing.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
eureka merged commit 10d687a80b into main 2026-10-09 12:06:07 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
GameCult/Eureka!8
No description provided.