Repository navigation
fix(report): keep HTTP statuses and #-numbers out of count ranges - #520
Merged
Merged
Conversation
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
marked this pull request as ready for review
October 7, 2026 08:26
nc9
marked this pull request as draft
October 7, 2026 08:27
nc9
marked this pull request as ready for review
October 7, 2026 08:27
|
Reviewed the diff. I found no blocking issues.
I did not run the tests myself. |
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.
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/redirectswrote 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, soElement #1andElement #2would merge intoElement #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:#joinsGLUED_RE; theisCountTokendoc says a non-count must never sit alone in parentheses.message:template with a status or code alone in parentheses.Acceptance criteria
rate-limited-links.test.ts"the status is written so a report merge never widens it", plusmerged-message-numbers-2231.test.ts"redirect chains ending in different statuses stay separate groups".#is in the glue set so#1is never count-shaped:message-merge.ts:39, test "a number after # is an identifier, not a count".#2231 guardblock.The three new tests fail on
mainand 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 failcd packages/rules && bun test tests/rate-limited-links.test.ts: 15 pass, 0 failbun run typecheckinpackages/reportandpackages/rules: cleanbun run lintandbun run format:checkat the root: cleanbunx oxlinton the touched files: clean.packages/*have no format config and these files already differ from oxfmt defaults onmain, 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.