Skip to content

fix(report): a finding with carried pages is never scoped to a page region #860 - #1347

Closed
nc9 wants to merge 2 commits into
mainfrom
fix/carried-counts
Closed

nc9 wants to merge 2 commits into
mainfrom
fix/carried-counts

Conversation

@nc9

@nc9 nc9 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Closes #860

The page-type line (#857) already refuses to scope a finding that carries pages from an earlier audit; the region line (#846) did not. checkRegionScope and itemRegionScope now return nothing when the check has carried pages (shared hasCarriedPages, same test as #857), and the five renderers plus HTML pass the item's check through (itemSourceView(item, structure, check); the LLM format passes whether any check of the rule carries pages, since it lists a rule's items together). The finding keeps its page rows.

Reproduction and tests: packages/report/tests/region-scope-846.test.ts (new describe): the helpers refuse each carried marker (carriedCount, carriedPages, provenance: carried) and accept carriedPages: []; a report whose last 7 pages are carried prints no region share in text, markdown, llm, html, json or xml and lists the pages; the fresh-only control still reads "In the site header, on 49 of 53 pages". No scoring change (report-time only).

Docs: none needed (behaviour matches the existing "carried findings keep their rows" wording); CHANGELOG under Unreleased. Skill: none.

@claude

claude Bot commented Oct 30, 2026

Copy link
Copy Markdown

Review of #1347. The core change is sound: hasCarriedPages is shared with the page-type line, and the five renderers plus HTML pass check through consistently.

  • (medium) apps/cli/src/reports/output/console.ts:397 still calls itemSourceView(item, report.structure) with no check. The console renderer (the default squirrel audit output) will keep showing the region share for carried findings. Pass check there and add a console test; the new tests only cover packages/report renderers.
  • (low) packages/report/src/output/llm.ts:709 builds a synthetic { provenance: "carried" } check. A boolean parameter would be clearer. The rule-wide coarseness (any carried check disables scoping for all items) is fine but deserves a comment on the tradeoff.
  • (nit) Some new lines (the region-scope.ts import, llm.ts:709, the test) exceed the formatter width. Run oxfmt --check on the changed files.

@nc9
nc9 force-pushed the fix/carried-counts branch from 3de0971 to bb663aa Compare October 30, 2026 08:35
@claude

claude Bot commented Oct 30, 2026

Copy link
Copy Markdown

Review of #1347: the fix is correct and complete. I found no blocking issues.

I grepped every non-test caller of itemRegionScope, itemSourceView and checkRegionScope. All of them now pass the check or go through hasCarriedPages. That includes checkPagesScopedAway and the xml/json check-level scope, which reach it through checkRegionScope. I did not run the tests or CI.

  • (low) packages/report/src/output/llm.ts:715: the line is over the formatter width, and { provenance: "carried" } is a synthetic check built just to pass a flag. The behavior is intentional, since the LLM format lists a rule's items together. Passing a boolean, or ruleCarriesPages ? CARRIED : undefined with a named constant, would read more clearly. Please also run oxfmt --check on the changed files; the import line in region-scope.ts and the long carriedReport lines in the test look unformatted.
  • (nit) apps/cli/tests/reports/output/console-item-sources-837.test.ts: the comment says "Three of the pages are carried", but the test sets provenance on the whole check. Reword it to say the check is carried.
  • (nit) The llm.ts import of ../page-type-scope sits after the ../region-scope import. Group or order the imports to match the neighbouring ones.
  • (nit) The tests don't prove that the LLM format's rule-level aggregation bites. The control render only covers the all-fresh case. Adding a rule with one fresh check and one carried check would show that the fresh check's items are also unscoped. That is the behavior the comment describes.

@nc9

nc9 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Landed in v0.0.144 as 976f6f22 89c377c0 via #1356. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.144. Closing this original.

nik

@nc9 nc9 closed this Oct 30, 2026
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.

Region-scoped findings may count pages carried from an earlier audit

1 participant