Skip to content

feat(tier1): score tier 1 quality checks via a configurable YAML file - #213

Merged
rng1995 merged 32 commits into
NVIDIA:mainfrom
westonplatter:feat/configurable-quality-checks
Oct 22, 2026
Merged

rng1995 merged 32 commits into
NVIDIA:mainfrom
westonplatter:feat/configurable-quality-checks

Conversation

@westonplatter

@westonplatter westonplatter commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #169

The Tier 1 quality check's expected-heading rules (Prerequisites, Limitations, Troubleshooting) move out of hard-coded Python and into YAML. The current rules ship with the package as quality-default.yaml and stay the default. To use your own heading rules instead, pass --quality-config PATH to quality-check, tier1 quality-check, tier1 PATH / tier1 validate, or validate.

Only the expected-heading rules are configurable. The other quality checks (error handling, script and library reliability, and so on) are unchanged and remain in code.

expected_headers:
  - heading: "## Prerequisites"
    alternatives: ["## Requirements"]
    points: 5
    message: No prerequisites/requirements documented
    suggestion: Document dependencies, API keys, or setup needed
  - heading: "## Security"   # message and suggestion are optional

Docs: the "Expected headings" section in docs/tier1-validation.mdx (example, field table, error behavior) and the flag rows in docs/cli-reference.mdx.

Before: heading rules in code

image

After: heading rules in YAML

CleanShot 2026-10-19 at 9 54 55 AM@2x CleanShot 2026-10-19 at 9 51 06 AM@2x

load_quality_config() fills in defaults (alternatives: [], points: 5, and generated message/suggestion), so the loop above can index every key directly.

Changes to existing behavior

  • Default scoring is unchanged. The packaged config lists the same three headings, alternatives, points and finding text as the old code. Matching is the same case-sensitive "heading text appears anywhere in SKILL.md" check as before. New tests in tests/validators/test_quality_score.py pin this behavior, so a change to stricter Markdown heading parsing can be its own PR.

    • Matches: exact, ### X (contains ## X), ## X and more, inside a code block, inside prose
    • No match: # X, different case, ##X, setext headings
  • --quality-config is validated before any checks run. The file is checked while arguments are parsed. A missing, unreadable, non-UTF-8, invalid-YAML, unknown-key or duplicate-heading file is a usage error (exit 2), even when --checks leaves out quality or the target isn't a skill. Each error names the file and the field. This is deliberate:

    • If the file were checked only when the quality step runs, a broken config could sit unnoticed in CI while quality is off.
    • When quality is on, the error would come late: after Tier 3 autopilot dataset generation (which may call an LLM), and once per skill in catalog runs.

    It matches how --env-mode and the Tier 2 --threshold reject bad values at parse time. Most other check-specific flags (--previous-version, --min-score, the Tier 3 options) are still silently ignored when their check is off; this PR leaves them alone.

  • message and suggestion are optional per entry. When omitted, they're generated from the headings, for example Missing expected heading: '## Security' and Add a '## Security' section, or Add one of these sections: ... when there are alternatives. The packaged defaults set both, so default findings keep their current wording.

  • Catalog validate now forwards --quality-config to each per-skill run. Before this, the flag was dropped.

Verification

  • I am familiar with the Contributing Guidelines
  • Added or updated focused tests
    • Default and custom rules through quality-check and tier1 quality-check (unmocked), through validate (real --tier1-checks schema,quality run, asserting on the JSON report) and through tier1 PATH
    • Invalid configs: loader unit tests, plus a CLI test that quality-check, tier1 quality-check, tier1 PATH, tier1 validate and validate (including --checks schema) exit 2 with a usage error and no traceback
    • Markdown heading matching: the parametrized match/no-match cases above
    • Installed wheel: a CI smoke step in .github/workflows/ci.yml asserts quality-default.yaml ships in the wheel and loads the three default headings
  • Updated documentation for user-visible changes (fern check: 0 errors)
  • Ran make lint
  • Ran make test
  • Ran make build
  • Did not add credentials, private datasets, or proprietary benchmark content

Release Impact

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

westonplatter and others added 16 commits October 19, 2026 09:41
Signed-off-by: Weston Platter <[email protected]>
Load validated heading rules with optional alternatives and point deductions
from the quality configuration. Match document-level Markdown headings so
examples, nested content, and incorrect heading levels do not satisfy rules.

Signed-off-by: Weston Platter <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
Configurable expected headings changed how the default config scored
skills. Restore upstream behavior:

- Match a heading by substring in the content, as before, instead of
  exact parsed headings. Drop the now-unused markdown_headings helper.
- Require message and suggestion on each expected_headers entry, and
  set the packaged defaults to the original finding text.
- Use float points in the packaged config to match deduct().

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
Assert the installed wheel ships quality-default.yaml and that
load_quality_config() returns the default expected headings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
Add an expected-headings section to the Tier 1 quality docs with a YAML
example and field table, and add --quality-config flag rows for
`validate` and `quality-check` in the CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
Run quality-check and tier1 quality-check unmocked against the simple
fixture: the packaged default reports the upstream heading findings, a
custom config replaces them, and a missing config path is a usage error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
QualityConfigError escaped as a traceback. --quality-config now uses a
validating click.Path type, so quality-check, tier1 quality-check, and
validate exit 2 with the file and problem named before any work runs.
validate checks the file even when the quality check is not selected.

The loader also rejects unknown keys and duplicate headings, prefixes
every message with the file path, shortens YAML errors to
"line N, column M: <problem>", and wraps read and UTF-8 errors.

Catalog validate now forwards --quality-config to per-skill children,
which previously fell back to the default rubric.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
Run validate's real Tier 1 pipeline with the packaged default and a
custom config, asserting on the JSON report. The custom case fails if
validate stops passing quality_config to run_validation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
Expected headings match as a case-sensitive substring of SKILL.md, not
as parsed headings. Cover both directions: deeper levels, longer text,
code blocks, and prose match; shallower levels, other case, missing
space, and setext headings do not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
tier1 PATH and tier1 validate now take --quality-config, defaulting to
the packaged quality-default.yaml like quality-check and validate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
An expected_headers entry may omit message or suggestion. Omitted ones
get generic text naming the heading and its alternatives, so the YAML
example in NVIDIA#169 works as written. A message or suggestion that is set
must still be a non-empty string.

The packaged quality-default.yaml still sets both for every entry, so
default findings keep the upstream wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
Comment thread .github/workflows/ci.yml Resolved
@westonplatter
westonplatter marked this pull request as draft October 19, 2026 16:00
Drop the float() conversion so integer points stay integers. Reports
again show "deduction": 5 for the default heading findings, matching
upstream and every other deduction in the validator.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
@westonplatter
westonplatter marked this pull request as ready for review October 19, 2026 16:57

@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: 2 findings (0 P1, 0 P2, 2 P3); 2 posted inline.

Comment thread src/skillevaluator/quality_config.py Resolved
westonplatter and others added 3 commits October 20, 2026 08:48
Load quality configs with a SafeLoader subclass that rejects repeated
mapping keys, so a second expected_headers block no longer silently
replaces the first. Deeply nested YAML and integer points too large for
a float now raise QualityConfigError instead of a traceback.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
The QUALITY result now carries quality_config: whether the rules came from
the packaged default or a custom file, the custom file's name (never its
directory), a sha256 digest of the normalized rules, and the --min-score
pass threshold. The JSON report, Markdown report and BENCHMARK.md surface
it, so a reader can tell which rules and threshold produced a score.

The digest covers the rules only, so formatting edits do not change it
and runs with different thresholds still compare as the same rules.

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

Copy link
Copy Markdown
Contributor Author

@rng1995 thanks for running the automated review. Updated the PR based on the feedback.

Merging main brought in the v0.6.0 release, which renamed the old
Unreleased heading to 0.6.0 and left this entry under a released version.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Weston Platter <[email protected]>
@westonplatter
westonplatter requested a review from rng1995 October 20, 2026 17:42

@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.

Approving at 40614da.

  • Reports: they now record which quality config produced the score. JSON, Markdown and BENCHMARK.md show the source, the file name, a rules digest and the min score, and no local path leaks into BENCHMARK.md.
  • Duplicate keys and bad YAML: duplicate keys and most malformed files now give a clean usage error. The few YAML scalars that still raise a traceback are noted in the open thread. They are non-blocking and can be a small follow-up.
  • Merge check: a trial merge with current main is clean, and the related tests pass on it.
  • Overlap with #211: that PR edits some of the same files. The two only conflict in CHANGELOG.md, so whichever lands second needs a CHANGELOG fix-up.

westonplatter and others added 5 commits October 21, 2026 09:22
PyYAML raises plain ValueError/TypeError/KeyError/AttributeError for some
scalars (integers over the 4300-digit limit, impossible dates, bad explicit
tags), which previously surfaced as a traceback with exit code 1. Wrap them
in QualityConfigError so they become the same usage error as other invalid
configs.

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

Copy link
Copy Markdown
Contributor Author

@rng1995 fixed the the post #211 merge conflict and addressed the additional PyYAML error handling feedback.

@rng1995
rng1995 enabled auto-merge October 22, 2026 13:34
@rng1995

rng1995 commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

@westonplatter thanks. I verified the YAML error handling at 9f5db94, and the merge with #211 keeps both CHANGELOG entries under ## Unreleased. The PR still merges cleanly with main, and the quality-config and quality-gate tests pass (221).

The DCO check is failing because the three new commits have no Signed-off-by line: 0c2f577, 887515a and 9f5db94. Could you add the sign-off to those commits and force-push the branch? My approval stands once DCO is green.

@rng1995
rng1995 disabled auto-merge October 22, 2026 13:50
@rng1995
rng1995 force-pushed the feat/configurable-quality-checks branch from 9f5db94 to 8ce5c1c Compare October 22, 2026 13:59
@rng1995

rng1995 commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

@westonplatter commits 0c2f577, 887515a and 9f5db94 had no Signed-off-by line, so I added a maintainer sign-off to them. This replaces my earlier request, so you do not need to sign them off yourself.

Only the commit messages changed. The file contents are identical, the earlier commits keep their SHAs, and DCO now passes locally. The head moved from 9f5db94 to 8ce5c1c.

Before you push to this branch again, please fetch it and reset your local branch to the new head.

@rng1995
rng1995 enabled auto-merge October 22, 2026 14:19
Brings in NVIDIA#218 (two-path quickstart docs).

Conflicts:
- CHANGELOG.md: kept the --quality-config entry under Unreleased / Added and
  main's Unreleased Changed and Fixed entries, in Added, Changed, Fixed order.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
@rng1995
rng1995 merged commit 6489106 into NVIDIA:main Oct 22, 2026
27 of 28 checks passed
@westonplatter

Copy link
Copy Markdown
Contributor Author

@rng1995 thanks for handing the Signed-off-by issue on the handful of commits and merging the PR.

@westonplatter
westonplatter deleted the feat/configurable-quality-checks branch October 22, 2026 15:43
rng1995 added a commit that referenced this pull request Oct 22, 2026
Brings in main up to 87f49e2: #213 --quality-config, #210 nested catalog
discovery with linked-directory handling, #224 docs refresh.

Conflicts:
- src/skillevaluator/utils/helpers.py: find_skills_in_directory follows
  #210 (recursive walk that stops at skill boundaries, prunes scan
  exclusions, skips in-catalog aliases, reports external linked or
  unreadable directories through the problems dict, else raises). It
  keeps the branch's lstat-first root handling: an unreadable root is a
  problem rather than an empty catalog, and a linked root directory is
  refused without querying its target, while a selected manifest file,
  linked or not, still names its skill as on main. The branch's secure
  plugin discovery (find_bundled_plugin_skill_manifests and
  find_bundled_plugin_skills) is unchanged and does not use this function.
- src/skillevaluator/cli.py: _resolve_validate_target now returns every
  catalog skill, nested ones included, plus the discovery problems, and
  validate passes the resolved root and those problems to main's catalog
  runners. The branch's PREVIOUS_VERSION_ENV guard is kept.
- src/skillevaluator/tier1/commands.py: --quality-config reaches the
  branch's _run_validation, so plugin bundled skills (QualityScoreValidator
  and _ListedSkillsQuality) use it too.
- src/skillevaluator/validators/plugin_schema.py: kept the branch's
  validator, which already turns a bundled-skill discovery failure into a
  HIGH finding (bundled_skill_path_unsafe) and refuses a linked skills
  folder in its tree check (unsafe_plugin_filesystem).
- tests/validators/test_plugin_schema.py: kept the branch's tests. Main's
  two #210 tests now check the branch's findings: a linked skills folder
  is an unsafe_plugin_filesystem finding, and a failing
  find_bundled_plugin_skill_manifests is a bundled_skill_path_unsafe
  finding at skills/.
- CHANGELOG.md: #213's Added entry, #224's Documentation section (between
  Changed and Fixed, as on main) and #210's Fixed entry go into the
  branch's Unreleased sections in main's order. Released sections are
  identical to main.
- docs/reports.mdx, docs/tier3-live-evaluation.mdx: kept the branch's
  shared-dimension Skill Lift text and added main's judge-model exclusion
  note. docs/tier1-validation.mdx: kept the branch's plugin policy note
  and main's note that severity overrides do not waive --min-score.
- docs/plugin-evaluation.mdx: --min-score and --quality-config apply to
  bundled skills.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
@rng1995 rng1995 mentioned this pull request Oct 30, 2026
15 of 20 tasks
chrisknvidia pushed a commit that referenced this pull request Oct 30, 2026
…#213)

* feat(quality): support packaged and custom quality configs

Signed-off-by: Weston Platter <[email protected]>
chrisknvidia pushed a commit that referenced this pull request Oct 30, 2026
…#213)

* fix(lint): fix a lint issue
* feat(quality): make expected Markdown headings configurable
* fix(lint): run Ruff through uv
* fix(quality): preserve the upstream default rubric
* ci(package): smoke-test packaged quality config in the wheel
* docs(quality): document --quality-config
* test(quality): cover --quality-config through quality-check
* fix(quality): reject invalid --quality-config files as usage errors
* test(quality): cover --quality-config through validate
* test(quality): pin text-anywhere expected-heading matching
* feat(cli): accept --quality-config on direct tier1
* chore: add SPDX headers to quality config files
* revert(lint): restore upstream Makefile lint target
* feat(quality): make expected-heading message and suggestion optional
* docs(changelog): add --quality-config entry
* fix(quality): keep expected-heading points as written
* fix(quality): reject duplicate keys and pathological config values
* feat(quality): record the quality config and min score in reports
* docs(changelog): move --quality-config entry under Unreleased
* fix(quality): reject unparseable YAML scalars with exit code 2
* docs(changelog): rewrap --quality-config entry
* refactor(quality): drop redundant comment on YAML value error handler

Signed-off-by: Weston Platter <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
chrisknvidia pushed a commit that referenced this pull request Oct 30, 2026
Brings in main up to 87f49e2: #213 --quality-config, #210 nested catalog
discovery with linked-directory handling, #224 docs refresh.

Conflicts:
- src/skillevaluator/utils/helpers.py: find_skills_in_directory follows
  #210 (recursive walk that stops at skill boundaries, prunes scan
  exclusions, skips in-catalog aliases, reports external linked or
  unreadable directories through the problems dict, else raises). It
  keeps the branch's lstat-first root handling: an unreadable root is a
  problem rather than an empty catalog, and a linked root directory is
  refused without querying its target, while a selected manifest file,
  linked or not, still names its skill as on main. The branch's secure
  plugin discovery (find_bundled_plugin_skill_manifests and
  find_bundled_plugin_skills) is unchanged and does not use this function.
- src/skillevaluator/cli.py: _resolve_validate_target now returns every
  catalog skill, nested ones included, plus the discovery problems, and
  validate passes the resolved root and those problems to main's catalog
  runners. The branch's PREVIOUS_VERSION_ENV guard is kept.
- src/skillevaluator/tier1/commands.py: --quality-config reaches the
  branch's _run_validation, so plugin bundled skills (QualityScoreValidator
  and _ListedSkillsQuality) use it too.
- src/skillevaluator/validators/plugin_schema.py: kept the branch's
  validator, which already turns a bundled-skill discovery failure into a
  HIGH finding (bundled_skill_path_unsafe) and refuses a linked skills
  folder in its tree check (unsafe_plugin_filesystem).
- tests/validators/test_plugin_schema.py: kept the branch's tests. Main's
  two #210 tests now check the branch's findings: a linked skills folder
  is an unsafe_plugin_filesystem finding, and a failing
  find_bundled_plugin_skill_manifests is a bundled_skill_path_unsafe
  finding at skills/.
- CHANGELOG.md: #213's Added entry, #224's Documentation section (between
  Changed and Fixed, as on main) and #210's Fixed entry go into the
  branch's Unreleased sections in main's order. Released sections are
  identical to main.
- docs/reports.mdx, docs/tier3-live-evaluation.mdx: kept the branch's
  shared-dimension Skill Lift text and added main's judge-model exclusion
  note. docs/tier1-validation.mdx: kept the branch's plugin policy note
  and main's note that severity overrides do not waive --min-score.
- docs/plugin-evaluation.mdx: --min-score and --quality-config apply to
  bundled skills.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
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.

[FEA]: make quality checks configurable

2 participants