Skip to content

fix(rules): declare all-noindex-pages optionsSchema in meta (#511) - #607

Merged
nc9 merged 1 commit into
mainfrom
fix/all-noindex-options-511
Oct 9, 2026
Merged

nc9 merged 1 commit into
mainfrom
fix/all-noindex-options-511

Conversation

@nc9

@nc9 nc9 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Closes #511

crawl/all-noindex-pages declared optionsSchema beside meta, so the runner never parsed it. Moved it into meta so defaults are applied and a wrong type is rejected. The warnOnPatterns / errorOnPatterns behaviour is unchanged.

Tests: packages/rules/tests/all-noindex-pages.test.ts (fails before the fix on defaults and rejection, passes after).

Agent skill change needed: no.

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

claude Bot commented Oct 9, 2026

Copy link
Copy Markdown

Reviewed the diff. No blocking findings. Moving optionsSchema into meta matches types.ts:160 and runner.ts:192, which only read rule.meta.optionsSchema. The new tests cover defaults, rejection of non-array values and both escalation paths.

  • (nit) types.ts:491 still has a top-level optionsSchema?: unknown on Rule, which is what let this misplacement type-check. Consider removing it, or adding a lint or test that fails when any rule sets it outside meta.
  • (nit) The tests call run directly and do not go through the runner. One test that resolves options through runner.ts would pin the real regression, a schema the runner never parsed.

🤖 Generated with Claude Code

@claude

claude Bot commented Oct 9, 2026

Copy link
Copy Markdown

Reviewed the diff. The change is correct and I found no blocking issues.

Moving optionsSchema into meta matches runner.ts:192, which reads rule.meta.optionsSchema. It's also how the other rules declare it. Defaults and type rejection will now apply. The tests cover the schema defaults, rejection of non-array values, and both pattern escalations.

  • (nit) all-noindex-pages.ts: run() still does (options.warnOnPatterns as string[]) || []. The cast and fallback are now redundant because the schema guarantees arrays. This is fine to leave.
  • (nit) The tests call schema.parse directly and don't exercise the runner path. A test through the runner's options resolution would pin the actual regression, though the meta placement check is a reasonable proxy.
  • (low) The CHANGELOG says a non-array value "fails with a config error". Worth confirming the runner surfaces a Zod error as a config error rather than crashing the audit. I didn't trace that path.

I didn't run the tests.

@nc9
nc9 force-pushed the fix/all-noindex-options-511 branch from 68d3223 to 50adc1e Compare October 9, 2026 14:23
@claude

claude Bot commented Oct 9, 2026

Copy link
Copy Markdown

Reviewed the diff. The fix is correct: runner.ts getRuleOptions reads rule.meta.optionsSchema, so moving the schema into meta makes defaults and type validation apply. It matches how redirect-chain and orphan-page declare theirs. I found no blocking problems.

  • (nit) all-noindex-pages.ts:152: the as string[]) || [] fallbacks in run() are now redundant, because the schema supplies the defaults. You could drop them or leave them as defensive code.
  • (nit) CHANGELOG.md: the entry says a non-array value "fails with a config error". The tests only cover schema.parse throwing. Nothing checks that the runner surfaces it as a config error. If one rule-level test went through getRuleOptions or the runner, it would cover that.

The tests cover the defaults, the rejection of non-array values, and the unchanged warn and error escalation.

@nc9
nc9 merged commit ced8653 into main Oct 9, 2026
15 checks passed
@nc9
nc9 deleted the fix/all-noindex-options-511 branch October 9, 2026 14: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.

rules: crawl/all-noindex-pages declares optionsSchema outside meta, so its options are never validated

1 participant