Skip to content

feat(#271): statement anchors + restart re-resolution (phase 2) - #279

Merged
debugmcpdev merged 1 commit into
mainfrom
feat/271-bp-addressing-phase2
Aug 8, 2026
Merged

feat(#271): statement anchors + restart re-resolution (phase 2)#279
debugmcpdev merged 1 commit into
mainfrom
feat/271-bp-addressing-phase2

Conversation

@debugmcpdev

Copy link
Copy Markdown
Collaborator

Summary

Phase 2 of #271: statement anchors — content-addressed breakpoints that recruit the Edit-tool old_string skill agents already practice, instead of the line arithmetic they're demonstrably bad at.

  • set_breakpoint {statement: "<exact line text>", nearLine?} — whole-line trimmed-equality match. Ambiguity is an error whose message lists every line: content pair (capped at 20) — the error is the disambiguation UI; nearLine binds to the closest match (ties toward the lower line). Blank/comment-only anchors (#, //, /* — deliberately not bare *, so Rust derefs stay anchorable) and multi-line input are rejected with clear guidance.
  • Anchors survive the edit that was the point of the session: the anchor is stored on the breakpoint record (never enters the DAP payload — guard-tested) and restart_debugging re-resolves every anchor against a fresh read of the current file before relaunch, using each breakpoint's previous line to break ties between duplicate statements. Moves are reported in data.anchorResolution.moved; anchors that no longer match keep their previous line and warn (data.anchorResolution.stale + bp.message) rather than failing the restart or silently dropping state.
  • Gating: statement/nearLine exist only in content mode (the default) — schema, call handler, server instructions, and workflow prompt all gate together; required drops line there (line addressing remains available). line/assert modes hard-error the params, naming the env value.
  • Same readable-file constraint as expectedContent (rejected for Java FQCNs and attach sessions); composes with condition/logMessage/suspendPolicy unchanged.

Builds on #278 (phase 1). Phase 3 (function breakpoints) remains as a capability-gated follow-up.

Testing

  • Resolver unit tests: trim/CRLF semantics, multi-match listing + cap, nearLine closest + tie-break, comment heuristic (Rust *deref accepted, #[derive] rejected), multi-line rejection
  • Server tests: resolution + anchor storage, ambiguity/no-match/comment errors, param-combination validation (statement×line, statement×expectedContent, bare nearLine), attach/FQCN rejection, assert-mode gating, schema shape per mode
  • Session tests: anchor stored; DAP-payload purity guard; restart re-resolution (moved / stale-with-warning / previous-line tie-break / no-anchor purity); breakpoint events preserve requestedLine
  • E2E (mock adapter): statement anchor end-to-end; restart re-resolution after a real mid-session file edit (from: 3, to: 5)
  • Full suites green: 2901 unit / 6 e2e bp-addressing; lint clean; tsc --noEmit clean

🤖 Generated with Claude Code

Content-addressed breakpoints:
- set_breakpoint {statement, nearLine?}: whole-line trimmed-equality match;
  ambiguity errors list every line:content pair (capped at 20) with nearLine
  as the disambiguator; blank/comment/multi-line anchors rejected
- Anchor stored on the breakpoint record (never enters the DAP payload) and
  echoed in responses + list_breakpoints
- restart_debugging re-resolves anchors against a fresh read of the current
  file before relaunch, using each breakpoint's previous line to break ties
  between duplicate statements; moves land in data.anchorResolution.moved,
  no-longer-matching anchors keep their line with a warning (stale)
- Schema/instructions/prompt gating: statement/nearLine only in content
  mode; required drops line there (line remains as an alternative)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.91339% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/session/session-manager-operations.ts 89.58% 5 Missing ⚠️
src/skill-content.ts 62.50% 3 Missing ⚠️
src/server.ts 97.14% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@debugmcpdev
debugmcpdev merged commit f341e9a into main Aug 8, 2026
10 checks passed
@debugmcpdev
debugmcpdev deleted the feat/271-bp-addressing-phase2 branch August 8, 2026 03:36
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.

2 participants