Skip to content

fix(#767): harden parseDependencies; share body-marker parser - #774

Merged
admarble merged 2 commits into
mainfrom
feature/767-fix-parsedependencies-matches-prose-mentions-and-s
Jul 16, 2026
Merged

admarble merged 2 commits into
mainfrom
feature/767-fix-parsedependencies-matches-prose-mentions-and-s

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

  • parseDependencies (batch-executor.ts) matched its depends on marker anywhere in an issue body with an optional # and no code/comment stripping, so prose (Issue 14 depends on 12+13), in-fence examples, quoted tool output, and lines describing other issues all parsed as real declarations — and sortByDependencies silently reordered the run on them (5/7 false positives against a real 36-issue corpus).
  • Extracted the hardened pre-flight mechanics (line-start anchoring, required #, fence/inline-code/HTML-comment stripping) from chain-preflight.ts into one shared dependency-markers.ts parser, so the two regexes cannot drift.
  • Kept the marker set per-caller: the pre-flight honors depends on + blocked by; the sorter honors only depends on — sharing the parser does not make the sorter start reordering on blocked by (a new silent-reorder class; feat: lightweight content pre-flight for --chain (AC presence, dependency-order sanity) #762 Open Q Doctor: Add Claude Code CLI check #3). Label parsing (depends-on/123) is untouched.

Pre-PR AC Verification

AC Description Status Evidence
AC-1 Prose / in-fence / inline-code mentions ignored; line-leading Depends on: #N still parses ✅ dependency-markers.test.ts — verbatim #19/#31/#111/#325 negatives → [], #188/#223 positives → [187]/[219]
AC-2 depends on 12+13 no longer parses as #12 (the # is required) ✅ buildMarkerRegex uses mandatory #(\d+); explicit test + #19 fixture
AC-3 Label-based depends-on/123 parsing unchanged ✅ Label branch in batch-executor.ts untouched; parseDependencies label tests (mocked gh)
AC-4 Marker parser exists in exactly ONE place, shared by both callers ✅ dependency-markers.ts:parseBodyDependencyMarkers, imported by batch-executor.ts + chain-preflight.ts
AC-5 Unit tests use verbatim issue bodies, not synthetic fixtures ✅ Real bodies saved under __fixtures__/dependency-markers/, loaded in tests
AC-6 Verified against real corpus — no genuine declaration stops parsing ✅ One-shot run over live open issues: 0 false hits; #188→[187], #223→[219] still resolve

Design decision (Open Q #1)

Shared the hardened mechanics but kept the marker set per-caller (parseBodyDependencyMarkers(body, markers)). Making the sorter honor blocked by would be a real, unrequested behavior change (new silent reorders) — deferred as out of scope, consistent with #762 Open Q #3. Open Q #2 (announce reorders) is a separate UX follow-up, not bundled here.

Test plan

Closes #767

🤖 Generated with Claude Code

parseDependencies matched its 'depends on' marker anywhere in an issue
body with an optional #, so prose mentions, in-fence examples, and lines
describing other issues parsed as real declarations — and
sortByDependencies silently reordered the run on them.

Extract the hardened pre-flight mechanics (line anchoring, required #,
code/comment stripping) from chain-preflight.ts into a shared
dependency-markers.ts parser, keeping the marker set per-caller: the
pre-flight honors 'depends on' and 'blocked by'; the sorter honors only
'depends on' so it does not start reordering on 'blocked by'. Label
parsing is untouched.

Tests use the verbatim issue bodies from #767's evidence table.

Closes #767

Entire-Checkpoint: 2255710168b5
QA follow-ups on the shared-parser extraction.

1. Moving `stripCodeAndComments` out of `chain-preflight.ts` stranded the
   cross-reference PR #770 added an hour earlier: `assess-collision-detect.ts`
   still warned "Do NOT unify this with `chain-preflight.ts:stripCodeAndComments`"
   — a function that no longer exists there.

   That note is the only guard against a silent-empty-set bug: unifying the two
   strip helpers deletes every path PATH_REGEX matches. A dev who follows the
   pointer, finds nothing, and concludes the note is stale is the exact failure
   #770 exists to prevent. Repointed to `dependency-markers.ts`.

   Moving a function has to carry its prose references, not just its call sites.

2. `stripCodeAndComments` was exported but has no consumer outside its module —
   it was private in `chain-preflight.ts`. An exported symbol implies a public
   API that #770's note is warning people away from. Restored to private.

Swept for other stale references to the moved symbols: `BLOCKER_MARKER_REGEX`
is gone everywhere, and the surviving `chain-preflight.ts:parseDeclaredBlockers`
pointer is still accurate.

Comment/visibility only — no behavior change. Build, lint clean; 48 files /
1092 tests pass.
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.

fix: parseDependencies matches prose mentions and silently reorders runs

1 participant