Skip to content

fix(report): keep HTTP statuses and #-numbers out of count ranges - #520

Merged
nc9 merged 1 commit into
mainfrom
claude/busy-hawking-1hujsl
Oct 7, 2026
Merged

nc9 merged 1 commit into
mainfrom
claude/busy-hawking-1hujsl

Conversation

@nc9

@nc9 nc9 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

What and why

The report merges a check's per-page messages into one row, and only a count may widen into a range. A count is a standalone integer in front of a noun, or one alone in parentheses. Two shapes slipped through that rule:

  • links/redirects wrote HTTP statuses alone in parentheses (Redirect chain ends in error (404)), which is count-shaped. Pages ending in 404 and 500 would merge into (404 to 500), a status that does not exist. The same shape was in the rate-limited and temporary-redirect messages.
  • # was not in the glue set, so Element #1 and Element #2 would merge into Element #1 to 2. No message writes a literal # today.

Changes:

  • packages/rules/src/links/redirects.ts: statuses are written as (HTTP 404), which the merger never widens.
  • packages/report/src/message-merge.ts: # joins GLUED_RE; the isCountToken doc says a non-count must never sit alone in parentheses.
  • The rules-package template guard gains a check that rejects any message: template with a status or code alone in parentheses.

Acceptance criteria

  • Status codes render in a shape the merger never widens, and a test pins 404 vs 500 pages as separate groups: rate-limited-links.test.ts "the status is written so a report merge never widens it", plus merged-message-numbers-2231.test.ts "redirect chains ending in different statuses stay separate groups".
  • # is in the glue set so #1 is never count-shaped: message-merge.ts:39, test "a number after # is an identifier, not a count".
  • The template guard rejects a parens-alone status code: "no template writes a status code alone in parentheses" in the #2231 guard block.

The three new tests fail on main and pass here.

Verify

  • cd packages/report && bun test tests/merged-message-numbers-2231.test.ts tests/merge-check-messages.test.ts tests/seed-redirect.test.ts: 88 pass, 0 fail
  • cd packages/rules && bun test tests/rate-limited-links.test.ts: 15 pass, 0 fail
  • bun run typecheck in packages/report and packages/rules: clean
  • bun run lint and bun run format:check at the root: clean
  • bunx oxlint on the touched files: clean. packages/* have no format config and these files already differ from oxfmt defaults on main, so they keep their existing style.

Risk

Message text change only: the three redirect messages gain HTTP . No score, schema or config change. Existing reports that stored the old text will show the new wording on the next audit.

The message merger treats a standalone integer in parentheses as a count,
so redirect messages like "Redirect chain ends in error (404)" from two
pages would merge into "(404 to 500)". The redirect rule now writes
statuses as (HTTP 404), '#' joins the glue set so '#1' is never a count,
and the template guard rejects a status code alone in parentheses.

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 marked this pull request as ready for review October 7, 2026 08:26
@nc9
nc9 marked this pull request as draft October 7, 2026 08:27
@nc9
nc9 marked this pull request as ready for review October 7, 2026 08:27
@claude

claude Bot commented Oct 7, 2026

Copy link
Copy Markdown

Reviewed the diff. I found no blocking issues.

I did not run the tests myself.

@nc9
nc9 merged commit c14f907 into main Oct 7, 2026
15 checks passed
@nc9
nc9 deleted the claude/busy-hawking-1hujsl branch October 7, 2026 08:35
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