Repository navigation
feat: heading-anchored snippet extraction in resolve_concern - #2
Merged
Merged
Conversation
…acts DIVERGE round identified heading-anchored snippet extraction as the highest-impact next improvement to resolve_concern, fixing whole-file snippet dumps on multi-section nWave files. DISCUSS, DESIGN (ADR-006), and DISTILL waves completed and peer-reviewed (approved). Acceptance tests confirmed RED (not BROKEN) against current production code.
vitest's esbuild transpile doesn't type-check, so tsc errors in the new heading-extraction code were caught only at build time, not by the TDD cycle's test runs. Step-ID: 01-01
…-section bug Live dogfood check during the post-merge integration gate found that a section's ancestor (e.g. a document's top-level H1 title heading) always wins the multi-section density comparison over its own descendants, because its occurrence count is the sum of all nested subsections' occurrences. This defeats the feature's purpose for the most common nWave file shape (# Title + multiple ## D-xxx: subsections), including this repo's own wave-decisions.md files. See docs/feature/heading-anchored-snippets/distill/upstream-issues.md Issue 1 for full analysis.
…rison Step-ID: 01-02
…on code Step-ID: refactor
Adversarial review found the escape hatch (an ancestor section retains candidacy when its own text genuinely matches the concern) had no test proving it works, only tests proving the inverse case (pure ancestor with zero own-text matches gets excluded). Confirmed with user: density comparison among a genuinely-matching ancestor and its descendant is correct by design (validated by ADR-005's own live dogfood behavior).
concern-matcher.ts was missing from stryker.config.mjs's mutate scope since it was first created -- this backfills coverage for both the pre-existing concern-based-querying logic and the newer heading-anchored-snippets logic now that the config gap is fixed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file was missing from stryker.config.mjs's mutate list since it was first created in the concern-based-querying feature -- it had zero mutation coverage despite the project's per-feature mutation testing strategy requiring >=80%. Discovered during this feature's DELIVER mutation-testing phase; closed alongside test coverage additions in a separate commit.
…e + roadmap + execution log
Koed00
force-pushed
the
feature/heading-anchored-snippets
branch
from
June 19, 2026 11:06
8c948c7 to
83c1bf3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends
resolve_concern(shipped in #1) to narrow returned snippets to the heading-anchored section containing the match, instead of returning whole-file content up to the 8000-char cap.extractHeadingAnchoredSnippet(content, concern): string | nullinsrc/core/concern-matcher.ts— regex-based heading detection + line-array slicing (ADR-006), no new dependency.matchConcernInSnapshot. Falls back to the existing whole-file behavior unchanged when a file has no markdown headings (zero regression).Why
Originated from a DIVERGE round prompted by live dogfooding
resolve_concern: a query for "concern matching" against this repo's ownwave-decisions.mdreturned the entire file (truncated at 8000 chars) instead of the specific section discussing the topic. Scored highest (4.35/5) of 5 candidate improvements on Job Fit + Architecture Fit.What a reviewer should know
excludeStructuralAncestors; full root-cause writeup indocs/feature/heading-anchored-snippets/distill/upstream-issues.md.stryker.config.mjsnever includedconcern-matcher.tsin its mutation-testing scope since that file was created in the priorconcern-based-queryingfeature — meaning ~all ofresolve_concern's core logic had zero mutation coverage until now. Fixed the config and backfilled tests to restore the project's ≥80% gate (final: 80.08% on the file, 85.75% project-wide).docs/feature/heading-anchored-snippets/. Evolution summary:docs/evolution/heading-anchored-snippets-evolution.md.Test plan
npm test)npm run build(tsc strict,noUncheckedIndexedAccess) cleannpm run check:arch(dependency-cruiser core/shell boundary) cleanconcern-matcher.ts, 85.75% project-wide (threshold 80%)wave-decisions.md