Skip to content

cli: config validate passes rule options no rule can use, and a wrong type fails the whole audit #510

Closed

Description

@nc9

Found while fixing #496.

[rule_options] mistakes are invisible until an audit runs, and then they either do nothing or stop the whole audit:

  • squirrel config validate prints Config valid for an unknown rule id ([rule_options."performance/ttfb"]), an unknown option name, and a value of the wrong type (min_length = "thirty" on core/meta-title). Rule ids are looked up exactly (packages/rules/src/runner.ts, getRuleOptions) and each rule's zod optionsSchema drops keys it does not know, so the first two silently change nothing.
  • The wrong type then fails the entire audit, not the one rule: squirrel audit exits 1 with ✗ Audit failed: and a raw zod issue list ("path": ["min_length"], Invalid input: expected number, received string) that does not name the rule or the config table.

Reproduce from source with a scratch HOME:

[rule_options."core/meta-title"]
min_length = "thirty"

[rule_options."performance/ttfb"]
warn_threshold = 300

squirrel config validate says valid; squirrel audit <url> fails as above.

Acceptance Criteria

  • squirrel config validate reports a [rule_options] table whose rule id matches no loaded rule, naming the table
  • squirrel config validate reports an option key the rule's optionsSchema does not declare, and a value of the wrong type, naming the rule and the key
  • A wrong-typed rule option during squirrel audit names the rule and the key in its error (or skips that rule with a visible check) instead of a bare zod issue list

Activity

  1. added
    bug
    P3
    size: S
    on Oct 6, 2026
  2. nc9 commented on Oct 11, 2026

    @nc9
    ContributorAuthor

    Checked against 0.0.108 and current main (ad95fb2): REPRODUCES.

    With a scratch HOME and this squirrel.toml:

    [rule_options."core/meta-title"]
    min_length = "thirty"
    
    [rule_options."performance/ttfb"]
    warn_threshold = 300
    
    [rule_options."core/meta-description"]
    no_such_option = 5

    squirrel config validate prints Config valid: .../squirrel.toml and exits 0. Then squirrel audit http://127.0.0.1:8901/ --http --refresh -m 2 --offline -f json -o out.json against a two-page local fixture finds both URLs in the sitemap and then exits 1:

    ✗ Audit failed: [
      {
        "expected": "number",
        "code": "invalid_type",
        "path": [
          "min_length"
        ],
        "message": "Invalid input: expected number, received string"
      }
    ]
    

    No report is written, and the message names neither core/meta-title nor [rule_options].

    Main is unchanged here. config validate (apps/cli/src/cli/commands/config.ts:133-149) only loads the file through showConfig. getRuleOptions (packages/rules/src/runner.ts:189-195) still calls rule.meta.optionsSchema.parse(ruleConfig) with nothing catching the error per rule.

  3. nc9 commented on Oct 12, 2026

    @nc9
    ContributorAuthor

    Fixed in # and merged to main. Every acceptance criterion is met per the PR description, with before and after evidence from the CLI on local fixtures, tests that fail on the old code, and review comments triaged. Criteria ticked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3bugsize: S

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions