Skip to content

fix(docs): correct the advertised rule count and gate it - #29

Merged
TheOrcDev merged 1 commit into
mainfrom
fix/stale-rule-count
Aug 4, 2026
Merged

fix(docs): correct the advertised rule count and gate it#29
TheOrcDev merged 1 commit into
mainfrom
fix/stale-rule-count

Conversation

@TheOrcDev

@TheOrcDev TheOrcDev commented Aug 4, 2026

Copy link
Copy Markdown
Owner

0.10.0 added the sixtieth rule, but both READMEs still advertised 59. The count appears twice in each file — the header badge link and the scoring section — and no generator owns that prose, so it went stale silently.

What was actually stale

Surface Was Now
README.md:19 (header link) 59 rules 60 rules
README.md:205 (scoring section) 59 deterministic checks 60
packages/cli/README.md:19 59 rules 60 rules
packages/cli/README.md:180 59 deterministic checks 60

Deliberately not touched: the counts in CHANGELOG.md and changelog/0.1.0.md. Those are historical records — 59 was correct at 0.1.0, and rewriting them would falsify what shipped.

Gated so it cannot recur

pnpm docs:rules --check (already in docs:check) now also compares both READMEs against RULE_CATALOG.length and fails with the expected number. That's the one place that already knows the true count, so the check costs nothing.

Verified it actually fires by reverting a count and re-running:

README.md advertises 59 rules, expected 60
Update the advertised rule counts by hand; no generator owns README prose.

About /stats

Worth stating plainly, because it changes what the release skill should say: there is nothing on /stats to update. Every tile — Latest, Versions, Downloads, Stars — is pulled live from the npm registry and the GitHub API at request time, with export const revalidate = 3600. It still shows 0.9.0 only because 0.10.0 has not been published yet; it will pick the new version up within the hour of publishing, with no code change.

So the skill now frames /stats as a post-publish confirmation rather than an edit: if the Latest tile still shows the previous version after the revalidate window, the publish did not reach the registry, and that is a real signal worth investigating rather than something to paper over by editing the page.

Release skill updates

  • New step 5 in "Prepare the version and changelogs" — sweep the surfaces no generator owns: the four advertised rule counts, BUNDLED_RULESET_VERSION, and the two hardcoded RULE_CATALOG.length assertions in public-api.test.ts and smoke-package.mjs (the latter fails late, after a full build and npm pack, with a message that never mentions rule counts).
  • Expanded step 4 verification — /changelog, /stats (as above), and /rules, with what a wrong number on each actually indicates.
  • Two hard-won rules recorded — the prose-count staleness, and the Git tag that has now been missed three releases running (0.8.0, 0.9.0, 0.10.0), which check-release.mjs gained a gate for in 21deb80.

Verification

6 gates green (check, docs:check, typecheck, cli:test, test:web, build). Self-audit 100/100 A.

Docs and skill only — no rule logic, no ruleset bump, no schema change. Safe to land before or after the 0.10.0 publish.

Summary by CodeRabbit

  • Documentation

    • Updated the documentation to reflect the bundled ruleset increasing from 59 to 60 deterministic checks.
    • Added clearer ruleset navigation and descriptions across the main and CLI documentation.
    • Expanded release guidance to include documentation, ruleset, and published-artifact verification.
  • Quality Improvements

    • Added automated validation to detect outdated README rule counts and generated documentation mismatches.

Both READMEs still advertised 59 rules after 0.10.0 added the sixtieth.
The count appears twice in each file — the header link and the scoring
section — and no generator owns that prose, so it went stale silently.

Gate it where the true count already lives: `docs:rules --check` now
compares both READMEs against RULE_CATALOG.length and fails with the
expected number. Verified by reverting a count and watching it fail.

The counts in CHANGELOG.md and changelog/*.md are left alone. Those are
records of what shipped at the time, and 59 was correct at 0.1.0.

The release skill gains the surface sweep this missed, plus a correction
about /stats: nothing on that page is edited by hand — every tile is
pulled live from npm and GitHub and revalidates hourly — so it is a
post-publish confirmation that the new version appears, not an update
step. Also records the recurring missed Git tag.
@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
shadscan Ready Ready Preview Aug 4, 2026 9:26pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The bundled ruleset count changes from 59 to 60. Catalog checks now detect stale README counts. Release instructions add documentation, version, generated-output, and published-site verification steps.

Changes

Rule Count Release Validation

Layer / File(s) Summary
Catalog count validation
packages/cli/scripts/generate-rule-catalog.ts, README.md, packages/cli/README.md
The catalog check compares README counts with RULE_CATALOG.length and fails on mismatches. Both READMEs now state 60 rules.
Release procedure verification
.claude/skills/shadscan-release/SKILL.md
The release procedure adds documentation, ruleset, generated-output, hardcoded-count, release-tag, and published-site checks.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: correcting the advertised rule count and adding validation to prevent future drift.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/stale-rule-count

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/scripts/generate-rule-catalog.ts`:
- Around line 39-50: Update the README validation loop around
ADVERTISED_COUNT_READMES and ADVERTISED_COUNT_PATTERNS to use async/await with
try/catch, report readFile failures as stale validation findings, and report
each pattern that has no match instead of silently passing. Preserve the
existing advertised-count mismatch message and add tests covering unreadable or
missing READMEs and removed count phrases.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3c685630-37fe-4c49-b4fa-72540bef092b

📥 Commits

Reviewing files that changed from the base of the PR and between 21deb80 and 71c384c.

📒 Files selected for processing (4)
  • .claude/skills/shadscan-release/SKILL.md
  • README.md
  • packages/cli/README.md
  • packages/cli/scripts/generate-rule-catalog.ts

Comment on lines +39 to +50
for (const readme of ADVERTISED_COUNT_READMES) {
const content = await readFile(readme.path, "utf8").catch(() => "");

for (const pattern of ADVERTISED_COUNT_PATTERNS) {
const match = content.match(pattern);

if (match && Number(match[1]) !== RULE_CATALOG.length) {
stale.push(
`${readme.label} advertises ${match[1]} rules, expected ${RULE_CATALOG.length}`
);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Fail closed when README validation cannot complete.

readFile(readme.path, "utf8").catch(() => "") converts a missing or unreadable README into empty content. The loop adds a finding only when content.match(pattern) succeeds. A missing README or a removed count phrase therefore produces no stale-count finding, and --check can return success without checking that README. Report read failures and missing matches as validation failures. Add tests for both cases.

As per coding guidelines: “Await promises in async functions, prefer async/await over promise chains, handle async errors appropriately with try/catch.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/scripts/generate-rule-catalog.ts` around lines 39 - 50, Update
the README validation loop around ADVERTISED_COUNT_READMES and
ADVERTISED_COUNT_PATTERNS to use async/await with try/catch, report readFile
failures as stale validation findings, and report each pattern that has no match
instead of silently passing. Preserve the existing advertised-count mismatch
message and add tests covering unreadable or missing READMEs and removed count
phrases.

Source: Coding guidelines

@TheOrcDev
TheOrcDev merged commit 2348427 into main Aug 4, 2026
8 checks passed
@TheOrcDev
TheOrcDev deleted the fix/stale-rule-count branch August 4, 2026 21:34
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