Skip to content

fix: bound excerpt recovery on long paragraphs - #422

Merged
StepenkoAnatoli merged 1 commit into
mainfrom
fix/issue-334-bounded-finding-excerpt
Oct 16, 2026
Merged

StepenkoAnatoli merged 1 commit into
mainfrom
fix/issue-334-bounded-finding-excerpt

Conversation

@StepenkoAnatoli

@StepenkoAnatoli StepenkoAnatoli commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Finding extraction now remembers the physical paragraph start and builds the excerpt forward only until the existing cap is exceeded. Long unbroken pages avoid quadratic front insertion while preserving finding selection and excerpt output.

Fixes #334.

what changed: Prose candidates retain their paragraph boundary during the existing scan. Excerpt recovery runs forward and stops once truncation is established; table excerpts and physical blank/heading boundaries retain their behavior.

why: Repeated array unshift made the recovery cost quadratic on accepted captures.

what it touched: finding.mjs, two regressions, its architecture row, changelog and registered offline test count (1847).

what you verified:

  • verified: the unchanged 8 MB regression remained busy until its owned process was stopped at 303.7 seconds; no final suite count was produced for that bounded baseline.
  • verified: all 32 finding tests pass in 2.5 seconds after the fix, including the same 8 MB input and exact excerpt/cap cases.
  • verified: normal pre-commit gate passed its full staged-tree suite; no bypass.
  • verified: root handoff OK; preflight PASS with its existing unstamped-brief warning; shared machine doctor READY, collector, firecrawl-cli.
  • verified: all seven required CI jobs passed on this exact head. Node 24 reports 1847 passed, 0 failed in 224.7s (watchdog 60000ms/test).
  • untested: no live collection or external pages were fetched.

what you got wrong and fixed: nothing to report.

what changed
Prose candidates retain their physical paragraph start during the existing scan. Excerpt recovery runs forward from that start and stops once the existing 420-character cap is exceeded, eliminating repeated unshift calls and whole-block excerpt construction. Finding selection, blank/heading boundaries, Markdown filtering, table excerpts and truncation spelling remain the same.

why
Fixes #334. Repeated front insertion made a vendor-controlled unbroken paragraph quadratic. This is an internal performance defect with one direct remedy that preserves the existing output contract; no new command, flag, format, provider or check is introduced.

what it touched
research-kit/lib/finding.mjs; two finding regressions covering an 8 MB paragraph and exact boundary/cap output; the finding architecture row; CHANGELOG.md; the registered offline test count in research-kit/README.md (1847).

what you verified
verified: the unchanged-code baseline remained inside the 8 MB regression beyond its 8-second performance bound and was terminated after 303.7s. No final suite count was produced for that deliberately bounded baseline run.
verified: node research-kit/bin/selftest.mjs finding passed all 32 tests, 0 failed, in 2.5s after the fix, including the same 8 MB input and pinned finding/excerpt.
verified: root handoff OK (33 ledger entries, 27 evidence rows), preflight PASS (28 passing, 1 existing unstamped-brief warning), and git diff --check. Cwd: C:\Users\PC\Desktop\gittoken\Research-Kit-issue-334.
verified: the shared machine was observed as doctor READY from the issue-326 checkout before implementation, collector role and firecrawl-cli transport on Node 24.20.0.
expected: the normal pre-commit gate will run the full staged-tree offline suite and enforce the architecture map and README count before this commit can be recorded; its exit and CI results will accompany the PR.
untested: no live collection or external pages were fetched; all extractor inputs are synthetic strings.

what you got wrong and fixed
nothing to report
@StepenkoAnatoli
StepenkoAnatoli merged commit a332996 into main Oct 16, 2026
7 checks passed
@StepenkoAnatoli
StepenkoAnatoli deleted the fix/issue-334-bounded-finding-excerpt branch October 17, 2026 06:34
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.

firstFinding rebuilds the winner's paragraph line by line with unshift: a 10 MB unbroken list costs 25 s per page, 1.7 s with blank lines

1 participant