Skip to content

feat(bench): DRA replay — attribute edit units as needed/unneeded - #347

Merged
dahai80 merged 2 commits into
mainfrom
bench-dra-replay
Nov 26, 2026
Merged

dahai80 merged 2 commits into
mainfrom
bench-dra-replay

Conversation

@dahai80

@dahai80 dahai80 commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Phase B of the DRA-lite over-edit experiment (method: Delta Residue Attribution, arXiv 2611.34875; Phase A was #345; design: code-research/docs/dra-lite-experiment-design.md).

  • verify.ts: verify extracted from run.ts (shared by scoring and replay; run.ts re-exports).
  • dra.ts <resultsDir>: per T*.final.tar snapshot, extract ordered Edit/Write units from the transcript, restore the snapshot, revert units cumulatively newest-first, rerun the task verify per prefix. Verify-still-green prefixes are jointly unneeded units; first failure marks the boundary unit needed. Ambiguous inverses stop and get reported; Bash-redirect writes counted as bashWrites coverage (v1 blind spot).
  • Output: per-task rows + dra.json with unneededRate.

Verified with a synthetic fixture (needed=1, unneeded=1 as constructed). tsc clean, full suite 1846 pass / 0 fail. Next regression with BENCH_DRA=1 (already running) will produce the first real attribution dataset.

🤖 Generated with Claude Code

dahai80 and others added 2 commits November 26, 2026 16:50
Phase B of the DRA-lite over-edit experiment (arXiv 2611.34875).

- Extract verify into verify.ts so dra.ts reuses the exact predicates
  without triggering run.ts main(); run.ts re-exports for compatibility.
- dra.ts <resultsDir> [--tasks overrides tasks.json]: for each
  T*.final.tar snapshot (BENCH_DRA=1), extract ordered Edit/Write units
  from the transcript, restore the snapshot, then revert units
  cumulatively newest-first, rerunning the task verify at each prefix.
  While verify keeps passing, the reverted units are jointly unneeded;
  the first failure marks the boundary unit as needed. Ambiguous
  inverses (old_string no longer present, Write on a pre-existing file)
  stop the replay and are reported. Bash-redirect writes are out of
  scope in v1 and counted as bashWrites coverage.

Verified: synthetic fixture with one needed edit (revert breaks
file-contains) and one unneeded edit (revert keeps verify green) →
needed=1 unneeded=1 ambiguous=0. Full suite 1846 pass / 0 fail.

Co-Authored-By: Claude Code <[email protected]>
The #345 snapshot block referenced configDir/outDir/taskId from the
main-loop finally, but those live inside runHarness — the first
BENCH_DRA=1 run crashed with ReferenceError after T01 (configDir is not
defined). Snapshot now runs at the end of runHarness, deriving the task
id from logPath and using cwd (the task workdir) directly; it captures
every task, and the replay filters by resolved status.

Found by the 2026-11-26T08-42-00Z run: T01 completed (525.7s,
silentRetry=0) and the run died in the finally block.

Co-Authored-By: Claude Code <[email protected]>
@dahai80

dahai80 commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

Fix pushed: the #345 snapshot block crashed on first live use (configDir/taskId out of scope in the main-loop finally — run T01 completed, then the run died with ReferenceError: configDir is not defined). Snapshot now runs inside runHarness (task id derived from logPath, cwd is the workdir), capturing every task; replay filters by resolved. tsc clean.

@dahai80
dahai80 merged commit 2e00569 into main Nov 26, 2026
1 check passed
@dahai80
dahai80 deleted the bench-dra-replay branch November 26, 2026 08:55
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