Skip to content

docs: note why the two body-strip helpers must not be unified - #770

Merged
admarble merged 1 commit into
mainfrom
docs/strip-helper-divergence-note
Jul 16, 2026
Merged

admarble merged 1 commit into
mainfrom
docs/strip-helper-divergence-note

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Comments only — no behavior change.

chain-preflight.ts:stripCodeAndComments and assess-collision-detect.ts:stripCodeBlocksAndComments are near-identical in name and body, differing only by an inline-code-span strip. They read as obvious DRY bait. The divergence is required: the two modules have opposite requirements for the same syntax.

  • In the pre-flight, a backticked marker is a documentation example → strip it.
  • In the collision detector, a backticked path is the entire signal — PATH_REGEX only matches backtick-wrapped paths → keep it.

Unifying them on the pre-flight's version silently kills path extraction:

current:                [ 'src/lib/foo.ts', 'bin/cli.ts' ]
with inline-span strip: []

The detector's 15 tests would fail on that change, so this is a signpost rather than a missing guard — it saves the next reader the round trip. Each function now cross-references the other with the reason.

Came out of asking whether anything from #762 needed consolidating; this was the one candidate that looked consolidatable and specifically must not be.

Heads-up: the unmerged local branch chore/chain-suggestion-annotation also touches assess-collision-detect.ts (formatCollisionAnnotations). Different function, so no conflict expected, but worth knowing if both land.

chain-preflight.ts:stripCodeAndComments and
assess-collision-detect.ts:stripCodeBlocksAndComments are near-identical in
name and body, differing only by an inline-code-span strip. They read as
obvious DRY bait, but the divergence is required: the two modules have
opposite requirements for the same syntax. A backticked marker in the
pre-flight is a documentation example to discard; a backticked path in the
collision detector is the entire signal, because PATH_REGEX only matches
backtick-wrapped paths.

Unifying them on the pre-flight's version silently kills path extraction:

  current:                  [ 'src/lib/foo.ts', 'bin/cli.ts' ]
  with inline-span strip:   []

The detector's 15 tests would fail on that change, so this is a signpost, not
a missing guard — it saves the next reader the round trip.

Cross-references each function from the other. Comments only; no behavior
change.

Entire-Checkpoint: 1bebdf23da8b
@admarble
admarble merged commit 753fe4a into main Jul 16, 2026
5 checks passed
@admarble
admarble deleted the docs/strip-helper-divergence-note branch July 16, 2026 03:12
admarble added a commit that referenced this pull request Jul 16, 2026
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.
admarble added a commit that referenced this pull request Jul 16, 2026
* fix(#767): harden parseDependencies; share body-marker parser

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

* fix(#767): repoint #770's divergence note; unexport the strip helper

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.
admarble added a commit that referenced this pull request Sep 9, 2026
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.

1 participant