Skip to content

test(rules): pin how keyword-stuffing treats card-dominated pages, teasers and plain-div menus #1441 - #1486

Merged
nc9 merged 2 commits into
mainfrom
test/keyword-stuffing-pins-1441
Nov 9, 2026
Merged

nc9 merged 2 commits into
mainfrom
test/keyword-stuffing-pins-1441

Conversation

@nc9

@nc9 nc9 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Refs #1441 (tests only; the issue stays open for the product decision it asks about).

The residual of #1315 asks whether content/keyword-stuffing can tell repeated per-card and teaser microcopy apart without giving up its anti-stuffing bounds. This PR pins what the rule does today with synthetic pages shaped like the reported ones, so that any change to a bound is a visible, deliberate edit of these tests. No source change, so no CHANGELOG or docs.

What the fixtures show (German and English, synthetic text and hosts):

  • A product grid beside ordinary copy is clean: 12 German cards or 6 English ones beside 400 words, and even 24 cards in a 700-word page (the cards stay under the 20% cap).
  • A card-dominated category page (24 cards, 60 words of copy) is flagged: in German the rating sentence and the installment note (durchschnittliche, bewertung, sternen, zahlen, raten); in English the shipping note that is identical on every card (shipping, costs, free, returns) while the rating sentence, which varies by number, is deducted. Two documented limits decide it: a text is deducted only when it varies between cards, and the deduction is capped at 20% of the page's words.
  • A newsletter teaser is copy: six uses of one word in a form teaser beside 120 words of copy flag it; on a page with under 100 words in total the rule says "content too short" and flags nothing.
  • A plain-div menu on a contact page: 20 links with varied category words and 90 words of copy raise nothing; 20 links that share one category word are flagged by design (a spammer writes the same links); a role="menubar" leaves varied links out but still counts links that share a word; under 100 words in total nothing is measured.

keyword-stuffing-pins-1441.test.ts: 10 tests; with the existing keyword-stuffing.test.ts 88 pass.

Skill: no change needed.

nik

@claude

claude Bot commented Nov 4, 2026

Copy link
Copy Markdown

Review of keyword-stuffing-pins-1441.test.ts (tests only, no source change).

Findings:

  • (low) I couldn't run the suite here. @squirrelscan/parser/dom doesn't resolve because dependencies aren't installed in this environment. The 10 passing tests and the 88-pass count are taken from the PR description. CI should confirm them.
  • (low) packages/rules/tests/keyword-stuffing-pins-1441.test.ts:109 and nearby: the menu/contact helper wraps the body in <body> inside page(), which already emits <body>. The nesting is harmless in linkedom, but it is a stray fixture shape that is easy to drop.
  • (nit) The 'role=menubar' test repeats the menu markup instead of reusing menu. Parametrising the wrapper attribute would shorten it.
  • (nit) The .toContain("bademode") assertion in the menubar test is looser than the toEqual(["bademode"]) used in the plain-div case. If the intent is to pin exact behaviour, use toEqual there too.
  • (nit) Several lines exceed the formatter width. CI doesn't format-check packages/*, but run oxfmt --check on the file as AGENTS.md describes.

The tests pin what the rule does today, with clear comments saying why. Fixture hosts are example.com, and there are no ReDoS or untrusted-input concerns. The test is a new file in an existing directory, so check scripts/test-suites.ts --check passes in CI.

@nc9
nc9 force-pushed the test/keyword-stuffing-pins-1441 branch from 8386bde to 614dbeb Compare November 4, 2026 10:50
@claude

claude Bot commented Nov 4, 2026

Copy link
Copy Markdown

Review of #1486 (test-only: keyword-stuffing-pins-1441.test.ts).

I could not run the new test. node_modules is missing in my sandbox, so @squirrelscan/parser/dom did not resolve. The pass/fail expectations below are unverified. scripts/test-suites.ts --check passes, so the file is wired into a suite. The import path and ctx helper match the existing keyword-stuffing.test.ts.

  • (low) keyword-stuffing-pins-1441.test.ts: the PR says it pins today's behavior. Please confirm that CI is green and that the tests bite, i.e. that they fail when a bound changes (for example the 20% deduction cap or the varies-between-cards rule). A pin that passes either way is worse than none.
  • (low) Several assertions are tied to exact word lists and thresholds (the 100-word minimum, the 20% cap, the toEqual(["abonnement"]) result). That is intended for a pin test. A one-line pointer to where each bound lives in src/content/keyword-stuffing.ts would make later changes to those bounds easier to follow.
  • (nit) The ctx helper casts through unknown. The existing test file may already export or share an equivalent helper. Sharing it would avoid a second copy.
  • (nit) A few lines are long. oxfmt --check is not run by CI for packages/rules, but running it on this file is cheap.

I found no security or performance concerns. No CHANGELOG entry is needed for a test-only change.

…asers and plain-div menus #1441

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the test/keyword-stuffing-pins-1441 branch from 614dbeb to a860ddb Compare November 8, 2026 23:55
@nc9
nc9 merged commit 8cd9364 into main Nov 9, 2026
16 checks passed
@nc9
nc9 deleted the test/keyword-stuffing-pins-1441 branch November 9, 2026 00: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