Skip to content

fix(rules): one message wording per count, no entity name in rating-scope (#231) - #611

Merged
nc9 merged 1 commit into
mainfrom
fix/identity-wording-231
Oct 9, 2026
Merged

nc9 merged 1 commit into
mainfrom
fix/identity-wording-231

Conversation

@nc9

@nc9 nc9 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Closes #231

Item findings are identified by their check message, so a count-dependent message splits one defect. Changes:

  • security/sri: N cross-origin resource(s) without Subresource Integrity for any N.
  • content/meta-in-body: Found N meta tag(s) in <body> for any N.
  • schema/rating-scope: both check messages name the entity type only (LocalBusiness), not its name. The name stays in the item labels.

Tests: count-independence cases in sri.test.ts and meta-in-body.test.ts, and a same-message-for-two-names case in schema-rating-scope.test.ts; existing name assertions are switched to type-only. Docs for the three rules quote the new templates. make validate passes.

Not done here: the AC re-run of the identity projection over production page_findings needs prod DB access, which this lane does not have. Needs a maintainer check after merge.

Agent skill change needed: no.

@nc9
nc9 marked this pull request as ready for review October 9, 2026 12:17
@claude

claude Bot commented Oct 9, 2026

Copy link
Copy Markdown

Review of #611: the change is correct and matches the acceptance criteria in #231. I found no blocking issues.

I checked itemFindingMessage / pageInvariantCheckText in packages/audit-engine/src/merge-core.ts. It strips a leading count and replaces the remaining digit runs with N. So 1 cross-origin resource(s) ... and 2 cross-origin resource(s) ... already map to the same identity, and the same holds for Found N meta tag(s) in <body>. That means the tests asserting 1 vs 2 in the message are fine. The rating-scope message still carries the rating value and count, and those are also digit-normalised.

  • (low) packages/rules/tests/schema-rating-scope.test.ts: the new identity test only covers rating-visible and compares raw messages. It doesn't cover rating-subject, and it doesn't check that two names give the same itemFindingMessage. A test through itemFindingMessage, in the style of item-finding-identity.test.ts, would pin the real goal rather than just message equality.
  • (low) The last AC item (re-running the identity projection over production page_findings) is still open, as the PR says. A maintainer needs to run it after merge.
  • (nit) packages/rules/src/schema/rating-scope.ts: besides the type-only change, the rating-subject message now uses . Sitewide in place of the em-dash. That is a harmless wording change, but the PR description doesn't mention it. The docs and the changelog are consistent with it.
  • (nit) Several lines in the new tests are over-long and probably need a formatter pass. The PR says make validate passes, so this may already be fine.

@nc9
nc9 force-pushed the fix/identity-wording-231 branch from 33b2407 to 3194c20 Compare October 9, 2026 14:24
@claude

claude Bot commented Oct 9, 2026

Copy link
Copy Markdown

Review of #611. The wording changes are correct and the tests cover them, but the PR claims more than it delivers on finding identity.

  • (medium) packages/rules/src/security/sri.ts:130, packages/rules/src/content/meta-in-body.ts:68: the message still interpolates the count (1 cross-origin resource(s)… vs 2 cross-origin resource(s)…). If identity is the check message, as the PR description says, pages with different counts still get different identities. This only removes the singular/plural split, so the CHANGELOG line "one defect keeps one finding identity across pages" overstates it. Either keep the count out of the identity key, or reword the changelog and PR to say it only unifies the plural form. The tests assert exactly 1 … and 2 …, so they lock in that two identities exist.
  • (medium) packages/rules/src/schema/rating-scope.ts:331: the rating-visible message still contains describeRating(primary), which is the rating value and review count (AggregateRating 4.7 from 218 reviews). It also contains the page label. Those are per-page values, so the identity can still split across pages even after removing the entity name. The new test only checks that two names give the same message, and both fixtures share the same rating. A case with different rating values would show whether this is a problem.
  • (low) The AC re-run of the identity projection over production page_findings is not done. This PR changes finding identities, which may orphan or re-key existing stored findings or suppressions. The maintainer check after merge is needed, so do not treat make validate passing as covering it.
  • (nit) CHANGELOG.md: ### Changed starts directly after the last ### Fixed bullet, with no blank line. Add one so the markdown renders as a heading.
  • (nit) rating-scope.ts: the describeEntityType fallback an untyped entity duplicates the string in describeEntity. Consider a shared constant.

@nc9
nc9 force-pushed the fix/identity-wording-231 branch from 3194c20 to d25e388 Compare October 9, 2026 16:16
@claude

claude Bot commented Oct 9, 2026

Copy link
Copy Markdown

Review of #611 (message wording made count/name independent for security/sri, content/meta-in-body, schema/rating-scope). The code change is small and the tests cover it. I couldn't run the test suite here.

  • (medium) packages/rules/src/security/sri.ts:130, packages/rules/src/content/meta-in-body.ts:68 — the messages still interpolate the count (Found N meta tag(s), N cross-origin resource(s)). If finding identity is derived from the message, as the CHANGELOG says, pages with 1, 2 or 3 flagged items still get different identities. This only removes the singular/plural split. If the goal is one identity per defect across pages, drop the count from the message (it's already available via items.length). If the count is meant to stay, say so in the CHANGELOG. I didn't trace where identity is computed.
  • (medium) packages/rules/src/schema/rating-scope.ts:333,421 — the rated entity's type is still in the message, so a site where different pages rate different types (e.g. LocalBusiness on one page, Organization on another) can still split. That's likely acceptable, but the CHANGELOG's "one defect keeps one finding identity" is slightly overstated.
  • (low) CHANGELOG.md — this adds a second ### Changed heading directly under the existing one, with no blank line before it. Merge the new bullet into the existing section.
  • (low) Message text changed beyond the stated scope: rating-subject now uses . Sitewide instead of — sitewide. The CHANGELOG doesn't mention it, and rating-visible keeps the em dash, so the two are now inconsistent.
  • (nit) meta tag(s) / resource(s) reads awkwardly in user-facing output. Something count-neutral like Meta tags in <body>: 3 avoids it.
  • (nit) describeEntityType duplicates the fallback string from describeEntity. Consider sharing a constant.

Tests: coverage for each wording change is good. The rating-scope identity test checks the two messages are equal, and it would be stronger if the second entity also had a different count.

No critical or high issues.

@nc9
nc9 merged commit 22e5c7f into main Oct 9, 2026
15 checks passed
@nc9
nc9 deleted the fix/identity-wording-231 branch October 9, 2026 16:28
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.

security/sri and content/meta-in-body switch between singular and plural wording, splitting one defect's identity

1 participant