Skip to content

fix: preserve novel source ranges in conceptual context - #480

Merged
Helweg merged 3 commits into
mainfrom
fix/context-novel-source-ranges
Nov 1, 2026
Merged

Helweg merged 3 commits into
mainfrom
fix/context-novel-source-ranges

Conversation

@Helweg

@Helweg Helweg commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Problem

Conceptual context packing rejected an entire retrieved hit on any same-file overlap, discarding source lines that were not present in higher-ranked evidence.

Change

  • Keep one longest contiguous uncovered source interval per conceptual candidate, earliest source interval on a tie.
  • Preserve ranking, scope, token/result budgets, and input ordering contracts.
  • Slice aligned bodies (including CRLF/Unicode) and withhold unmappable bodies rather than misattribute source text.
  • Exclude terminal LF delimiters from expanded Indexer.search source coordinates while preserving raw content bytes, so citations cannot claim a phantom trailing source line.
  • Clear canonical declaration columns on clipped evidence; preserve definition/test-discovery input order and PDF page evidence behavior.
  • Add behavioral regressions plus real native Indexer.search coverage with expanded source coordinates; update changelog.

Verification

  • Bug reproduced failing-before for both defects (whole-range overlap rejection; endLine counting a terminal-LF delimiter as line 13 in a 12-line file), then fixed and re-run passing.
  • tests/context-evidence-acceptance.test.ts (17 tests) and the updated tests/tools-utils.test.ts context-pack contract tests pass locally against a clean native build.
  • Exact-head CI on 8a95a159dd98e623f60f8c370a3852ffb2da1e26: test (22), test (24), path-semantics (all 6 matrix jobs), CodeQL, and all Analyze jobs pass; mergeStateStatus: CLEAN.
  • No held-out experiment tasks, decision-model download, installed-extension change, or user-index mutation.

Delivery

This is the isolated source fix. Release preparation remains separate and must reconcile the full merged delta since v0.38.2 rather than presenting the next release as only this patch. The separate development-only range evidence package is additive and is not a release gate.

@Helweg Helweg added bug Bug fix semver:patch Bug fix or patch labels Oct 31, 2026
@Helweg
Helweg marked this pull request as ready for review November 1, 2026 16:03
@Helweg
Helweg merged commit 653e6f2 into main Nov 1, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bug fix semver:patch Bug fix or patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant