Known-error/fix config errors are silently dropped at load time instead of failing loudly

Open
#344 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust
Domain
cli, tooling

Research direction

Start at Config::new in src/shared/config_load.rs:167-171 and trace how conversion errors from src/shared/models/internal/known_error.rs and fix.rs are handled. Reproduce the reserved capture-name or broken-template examples, then make the chosen warning or hard-failure behavior identify the source file and validation error; done means invalid entries are no longer silently dropped.

Written by the indexing model from the issue text.

Description

Summary

Config::new swallows errors when converting a raw config entry into its typed model — a ScopeKnownError (or any other model) that fails validation just silently disappears from the loaded config instead of surfacing an error to the user.

// src/shared/config_load.rs:167-171
for raw_config in raw_config {
    if let Ok(value) = raw_config.try_into() {
        this.add_model(value);
    }
}

The Err case is discarded with no logging, no warning, nothing. Found while manually validating #343 (regex captures in known errors), which added a reserved-capture-name validation (src/shared/models/internal/known_error.rs:90, RESERVED_CAPTURE_NAMES = ["working_dir", "captures"]) and eager fix-template validation — both of which return an Err on invalid config, but that Err never reaches the user.

Reproduction (MVCE)

mkdir -p /tmp/scope-silent-drop/.scope
cat > /tmp/scope-silent-drop/.scope/known-error.yaml <<'YAML'
apiVersion: scope.github.com/v1alpha
kind: ScopeKnownError
metadata:
  name: bad-reserved
  description: uses a reserved capture group name
spec:
  pattern: "boom: (?<captures>.*)"
  help: "should never load"
YAML

cd /tmp/scope-silent-drop
scope-intercept -- bash -c 'echo "boom: xyz"; exit 1'

Expected: the tool refuses to start, or at minimum logs an ERROR/WARN naming the bad file and the reserved-name violation.

Actual: the command runs clean and prints No known errors found — as if the ScopeKnownError file didn't exist at all. There is no indication anywhere that a config file was rejected, why, or which file it was. A user who typos a capture group name (or ships a fix with a broken minijinja template) gets no signal that their known-error config isn't doing anything.

Same silent-drop happens for a broken fix template, e.g.:

spec:
  pattern: "boom: (.*)"
  fix:
    commands:
      - "echo {{ unclosed"

Suggested fix

At minimum, log the conversion error (with the source file path) at WARN or ERROR in the if let Ok(...) / else branch in Config::new. Arguably this should be a hard failure (non-zero exit) since a silently-ignored known error or fix is a correctness footgun, not a degraded-but-working state.

Where this lives

  • src/shared/config_load.rs:167-171 — the swallow site
  • src/shared/models/internal/known_error.rs:90 — reserved capture name rejection (one of the Err cases being swallowed)
  • src/shared/models/internal/fix.rs — eager fix-template validation (another Err case being swallowed)

🤖 Generated with Claude Code

Dominant language
Rust
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Gusto/scope

All issues in Gusto/scope

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.