Skip to content

feat(quality): configure Reliability error handling in the quality config - #336

Merged
rng1995 merged 22 commits into
NVIDIA:mainfrom
westonplatter:feat/reliability-error-handling-config
Nov 13, 2026
Merged

rng1995 merged 22 commits into
NVIDIA:mainfrom
westonplatter:feat/reliability-error-handling-config

Conversation

@westonplatter

@westonplatter westonplatter commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR follows #169. Tier 1 Reliability has three error-handling rules that were hard-coded, and this change moves them into a new optional error_handling section of the quality config, quality-default.yaml / --quality-config. Teams can now tune or turn off these rules without changing code.

The three rules:

Rule Checks Default deduction
mentioned SKILL.md contains none of the terms (whole word, any case) −10
scripts A *.py script has neither a try:/except pair nor any of the markers (case-sensitive substring) −5
lib A lib module has neither a try:/except pair nor any of the markers −5

Each rule sets its points, message, and suggestion, plus its terms or markers. Severity and the matching logic stay in code, as does the try:/except check.

# custom quality config: only the keys you set change
error_handling:
  scripts:
    points: 0          # turn off the script check
  mentioned:
    terms: [error, exception, retry]   # replaces the packaged list

Behavior:

  • Scores are unchanged by default. The packaged values match the old code exactly. Tests pin the new matcher to the old \b regex, and a fuzz comparison found no differences.
  • Sparse overlay. A custom file can set any subset of blocks and keys. Anything left out keeps its packaged value, and lists replace rather than merge. A file with only expected_headers gets the packaged rules.
  • points: 0 turns a rule off and emits no finding.
  • Strict validation. These all exit with code 2 and a message naming the bad field:
    • unknown keys or duplicate keys
    • a block that is not a mapping
    • negative or non-numeric points
    • blank text
    • empty lists, blank entries, or duplicate entries (duplicate terms are compared without case)
  • Custom terms can start or end with punctuation. Matching uses (?<!\w)…(?!\w) lookarounds, so terms such as error: and C++ match.
  • Digest. The quality_config digest still hashes the parsed rules, not the file's bytes, so comments and formatting don't change it. The packaged digest covers the whole packaged config. A custom file's digest covers only the rules that file sets, not the packaged values filled in around it, so it changes only when that file's rules change.

Changes in behavior compared to main

Area main This PR
Scores and findings, no custom file — Unchanged. Same points, messages, suggestions, files checked and order.
Scores and findings, existing custom file (expected_headers only) — Unchanged. The error-handling rules use the packaged values, which match the old hard-coded ones.
Packaged quality_config digest sha256:b70a47b9… Changes once to sha256:298ff2bf…, because quality-default.yaml gained the error_handling section. Reports from earlier versions that ran without a custom file won't match it.
Digest of an existing custom file Hash of the file's rules Unchanged. The same file gives the same digest as on main.
A custom file with an error_handling key Rejected as an unknown key (exit 2) Accepted, and validated strictly (exit 2 on bad content).
Tuning the three error-handling rules Hard-coded: −10 / −5 / −5, fixed terms and markers Configurable points, message, suggestion, terms / markers. points: 0 turns a rule off.
Python API (undocumented, shipped in 0.7.0) quality_config_provenance(path, config) Removed. It can't compute a custom file's digest from the merged config alone. It's replaced by load_quality_config_with_provenance(path), which returns the config and its provenance together. load_quality_config and quality_config_digest are unchanged.

One new property follows from the custom digest: if a later release changes a packaged error-handling default, a custom file that doesn't set that value keeps its digest even though its score changes. The SkillEvaluator version recorded in the report tells those runs apart.

Docs: docs/tier1-validation.mdx has a new "Error-handling checks" subsection with an example and a rule table, plus additions to the list of invalid-file conditions.

Verification

  • I am familiar with the Contributing Guidelines
  • Added or updated focused tests: tests/test_quality_config.py covers loading, the overlay, 16 invalid cases, and the digest, including that a headings-only custom file keeps its main digest and that a custom digest ignores changes to packaged defaults it doesn't set. tests/validators/test_quality_score.py adds TestReliabilityErrorHandlingConfig, covering every packaged term, the Unicode non-match cases, custom terms and markers, points: 0, and punctuation-edged terms.
  • Updated documentation for user-visible changes
  • Ran make lint (with PYTHON="uv run python"): all checks passed
  • Ran make test: 19,500 passed, 35 skipped, 2 failed. Both failures are in tests/test_harbor_secure_docker_environment.py (test_sidecar_retains_only_structurally_required_nonsecret_compose_task_value and test_sidecar_retains_structurally_required_nonsecret_host_compose_value). They fail the same way on main, so this change didn't cause them.
  • Ran make build: built the sdist and wheel
  • Did not add credentials, private datasets, or proprietary benchmark content

Release Impact

  • No user-visible release note needed
  • Updated CHANGELOG.md

🤖 Generated with Claude Code

westonplatter and others added 6 commits November 4, 2026 09:30
Add an error_handling section to quality-default.yaml for the three Reliability error-handling rules: the SKILL.md mention check, the scripts check, and the lib check. Each rule carries points, message, suggestion, and its terms or markers.

A custom --quality-config file may set any subset of the section. Omitted blocks and keys keep the packaged values, and a list replaces the packaged list. The packaged section is validated with every key required. Invalid content exits with the file and field named.

The config digest now covers error_handling, so every quality_config digest changes, packaged and custom. The custom-file provenance test now derives its expected digest from the loaded config.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
The Reliability mention, scripts, and lib checks now read their points, message, suggestion, terms, and markers from the quality config instead of inline literals. The packaged values reproduce today's scores and findings.

Terms match as whole words in any case. Any Unicode letter or digit counts as part of a word, as the old regex did. A try/except pair always counts as handling errors. A rule with points 0 adds no finding, and has_error_handling is still recorded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
Describe the error_handling section, how it merges with packaged values, and how terms differ from markers. Note in the CHANGELOG that every quality_config digest changes after upgrade while scores stay the same.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
Use one explicit check for whether a packaged base is present, and drop comments that restate the code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
A custom term such as "error:" or "C++" never matched, because a word boundary needs a letter or digit on the inside edge. Match the term when no letter or digit sits directly before or after it instead. Packaged terms match exactly as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
…ed changes

A custom file's digest now covers only the rules the file sets, not the
packaged error_handling values merged into it. Existing custom files keep
the digest they had before error_handling existed, and a custom digest
changes only when that file's rules change. The packaged digest still
covers the whole packaged config.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
@westonplatter
westonplatter force-pushed the feat/reliability-error-handling-config branch from 04b7868 to 8f590f9 Compare November 4, 2026 16:53

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Automated review: 5 findings (0 P1, 0 P2, 5 P3); 5 posted inline.

Nothing blocking. Without a custom file the scores and findings stay the same, and the \b to lookaround change gives the same matches for the packaged terms. The comments are about the docs, the changelog, and one matching gap for custom multi-word terms.

Checked: the PR merges cleanly with current main (8a851c6). On that merge, tests/test_quality_config.py and tests/validators/test_quality_score.py pass (401 tests), as do the quality-config reporting, retained/redesign report, publication-evidence, commands, policy-gate and CLI tests (405). I ran the edge cases in the comments against the PR head.

Comment thread docs/tier1-validation.mdx Resolved
Comment thread docs/tier1-validation.mdx Resolved
Comment thread docs/tier1-validation.mdx Resolved
Comment thread CHANGELOG.md Resolved

@chrisknvidia chrisknvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@westonplatter reviewed the current head. The five open threads still apply; I left an inline note on each, with a reproduction for the wrapped custom term. CI has not run on this fork PR yet, and the branch conflicts with main, so it needs main merged in and a maintainer to approve the workflow run.

Resolve the CHANGELOG.md conflict by keeping main's entries and this PR's entry.

Signed-off-by: Christopher Kevin <[email protected]>
westonplatter and others added 5 commits November 11, 2026 06:09
…ror-handling-config

Signed-off-by: Weston Platter <[email protected]>

# Conflicts:
#	CHANGELOG.md
#	tests/validators/test_quality_score.py
A custom --quality-config file that leaves out expected_headers now keeps the
packaged heading list, the same way error_handling overlays packaged values.
A list that is present still replaces the packaged one, and [] still turns
heading checks off. The packaged file still requires the key. The digest
covers expected_headers only when the file sets it, so an omitted key is not
hashed as the file's own rules and existing custom files keep their digests.

The docs example no longer needs `expected_headers: []`.

Addresses review feedback on NVIDIA#336: NVIDIA#336 (comment)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
An error_handling rule with points: 0 is turned off and reports nothing. An
expected_headers entry with points: 0 still reports a zero-point advisory
finding. Say so in both places so readers don't expect the same behavior.

Addresses review feedback on NVIDIA#336: NVIDIA#336 (comment)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
The scripts rule checks only .py files directly in scripts/ or tools/, and
the lib rule runs only for lib-based skills, which have no .py or .sh files
in scripts/ or tools/.

Addresses review feedback on NVIDIA#336: NVIDIA#336 (comment)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
A custom term such as `exit code` now matches when its words are split by a
line break or several spaces. Packaged terms are single words, so default
scores are unchanged.

Addresses review feedback on NVIDIA#336: NVIDIA#336 (comment)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
westonplatter and others added 6 commits November 11, 2026 06:32
Add a short overview of the --quality-config file before the per-section
details, and update the --quality-config flag rows in the CLI reference,
which still said the file replaces the expected-heading rules.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
Rename it to load_quality_config_and_overlay_defaults.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
Rename load_quality_config_and_overlay_defaults back to the released name,
quality_config_provenance, to match the QualityConfigProvenance record it
returns.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
The function now takes only path and returns (config, provenance), so calls
written as quality_config_provenance(path, config) need updating.

Addresses review feedback on NVIDIA#336: NVIDIA#336 (comment)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
…ovenance

Rename the loader back to load_quality_config_with_provenance and replace the
CHANGELOG entry: quality_config_provenance(path, config) is removed, and the
### Changed entry names load_quality_config_with_provenance(path) as its
replacement.

Addresses review feedback on NVIDIA#336: NVIDIA#336 (comment)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
…ripts/ or tools/

A script in a subfolder of scripts/ or tools/ does not make a skill
script-based or hybrid, so the lib check still runs.

Addresses review feedback on NVIDIA#336: NVIDIA#336 (comment)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
@westonplatter

Copy link
Copy Markdown
Contributor Author

@chrisknvidia Thanks for the detailed feedback. I revised the code, docs, and CHANGELOG.md. Tests are passing locally

@chrisknvidia chrisknvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-reviewed at 461b560. All five open points are fixed:

  • A custom file can omit expected_headers and keep the packaged list, so a file with only error_handling loads. [] still turns heading checks off, and the digest only covers keys the file sets.
  • The docs now spell out the two meanings of points: 0: an error_handling rule with 0 points is off, while an expected_headers entry with 0 points still reports a zero-point finding.
  • The scripts/lib rows match the code. detect_skill_type uses _executable_files (.py/.sh directly in scripts/ or tools/), so the narrower lib wording is accurate.
  • Multi-word terms match across any whitespace run, including line breaks and \r\n with indentation, and exit code still doesn't match exit codes.
  • The CHANGELOG lists the quality_config_provenance removal and names load_quality_config_with_provenance(path) as its replacement.

Checked locally: tests/test_quality_config.py and tests/validators/test_quality_score.py pass (424), and ruff check is clean.

The only thing left is the merge conflict. main has moved since your Nov 11 merge, and CHANGELOG.md conflicts again (it's the only file). Once you merge main and keep both sides, the code looks good to me.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
@westonplatter

Copy link
Copy Markdown
Contributor Author

Thanks for the re-review @chrisknvidia. Resolved the merge conflicts.

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-checked all five earlier comments at 1242bc3 and each one is addressed: expected_headers is optional in a custom file and falls back to the packaged list with unchanged digests, the docs explain points: 0 for both sections, the scripts/lib rows match detect_skill_type, multi-word terms now match across line breaks and repeated whitespace, and the CHANGELOG entry covers the removed quality_config_provenance helper. The latest commit only merges main with a keep-both CHANGELOG resolution. Approving.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
@westonplatter

Copy link
Copy Markdown
Contributor Author

@rng1995 thanks! Fixed the latest merge conflicts and resolved the comments. Can I get approve for a CI run?

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
@rng1995
rng1995 enabled auto-merge (squash) November 13, 2026 07:08
@rng1995

rng1995 commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Thanks @westonplatter for your contributions to SkillEvaluator! I have approved the CI workflows and enabled auto-merge. The PR will merge automatically once the CI workflows complete successfully.

@rng1995
rng1995 merged commit b64e351 into NVIDIA:main Nov 13, 2026
26 checks passed
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.

3 participants