Repository navigation
fix(tier2): stop catalog queries from matching a skill against its own entry - #296
Conversation
…n entry
similarity-check --catalog and tier2 --catalog compare one skill with
every entry of a saved local catalog. When the skill was already in the
catalog, for example when a team re-screens its own skills in CI, it
matched its own entry with a score of 1.0 and was reported as a CRITICAL
EXACT_DUPLICATE of itself, failing the run.
Catalogs store only paths relative to an unrecorded scan root plus a
content fingerprint, so identify the target's own entry from that data:
the entry with the longest catalog path that ends the target's resolved
directory path, accepted only when its fingerprint matches in the
registry's mode. A root (".") entry carries no path evidence and never
matches. query_entry skips that one entry before thresholds apply, and
the catalog_compared result records self_matches_excluded and
excluded_catalog_paths.
Copies and same-name skills at other paths are still reported. A skill
whose compared content changed is still compared with its old entry;
the docs suggest building the catalog from the tree being screened.
Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The self-entry rule matched the longest catalog path that ends the target's path plus the content fingerprint. Tier 1 requires a skill's directory name to equal its frontmatter name, so a conformant verbatim copy always ends in the same directory name as the original. For a catalog built from a flat skills folder, any same-name, same-description skill anywhere, such as a copy in a staging folder or another repository, was skipped as the catalog entry itself and its EXACT_DUPLICATE was hidden. Require positive evidence that the target sits in the tree the catalog was built from. Strip the matched catalog path from the resolved target to infer the scan root, then read up to eight other catalog skills in path order under that root, through no links. More than half must be present at their recorded paths with matching fingerprints. Skills that contain the target or are nested inside it are not checked, because a copied folder carries them too. A catalog with no other skill entry never skips one. A second checkout of the same tree still counts as the same tree. A target path spelled with a different letter case now also matches its entry when both spellings name the same directory, as on a case-insensitive filesystem. Add regression tests for Tier-1-conformant copies in a staging folder, in another repository and as a new nested same-name skill, in description and full-body modes, plus a second checkout, partial copies, nested skills, linked skills, the sample bound and letter case. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
rng1995
left a comment
There was a problem hiding this comment.
Review summary: no findings.
Checked catalog_self_entry (fingerprint in the registry's mode, longest-suffix scan-root inference, root and single-skill-catalog exclusions, case-only path differences via samestat), _holds_catalog_tree (bounded sample of 8, majority rule, no-link checks, nested and ancestor entries skipped, read errors counted as absent), the exclude_entry_id handling in query_entry (applied before threshold and match limit), catalog path validation (no absolute or .. components, so the sampled reads stay under the inferred root), the SimilarityValidator metadata and message, and the CHANGELOG/docs entries. The fingerprint helper matches how entries are recorded at add time. tests/embedding and tests/validators/test_similarity.py pass locally (301 passed, 1 skipped) and ruff check is clean.
Reviewed with Claude Code.
0980467 to
309ef99
Compare
Conflicts: CHANGELOG.md Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
chrisknvidia
left a comment
There was a problem hiding this comment.
I read the new self-entry matching in the registry and the validator wiring end to end, and ran scratch catalogs through it: nested same-name skills, the longest-suffix case, copies in a staging folder, and linked skills. The matching logic holds up. Two non-blocking notes: the tree check only samples the first eight skills by path, which weakens the 'most of the tree' guarantee on bigger catalogs, and two mocked validator tests quietly take the new branch.
Conflicted files: CHANGELOG.md. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
The catalog-tree check read the first eight other skills in path order, so on a large catalog a staging folder with the target plus a few first-sorted skills counted as the catalog's tree, and a checkout missing some of those first skills did not. Sample up to eight other skills spread evenly across the path-sorted list instead, keeping the read cap. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
test_catalog_extracts_only_the_root_skill and test_catalog_finding_labels_target_and_catalog_roles left catalog_self_entry unset, so the mock returned a MagicMock and the validator queried with exclude_entry_id=<MagicMock>. Return None and assert the plain query_entry call. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
* docs(changelog): move entries released in 0.7.0-0.7.2 out of Unreleased 0.7.0 (#314) and 0.7.1 (#327) never cut their sections on main, and 0.7.2 (#335) added its section below the whole Unreleased block, so Unreleased still listed work that had already shipped. Place each Unreleased entry under the release that shipped the PR that added it: - 0.7.0: the published section from the 0.7.0 tag, verbatim. It already holds the six entries that main had filed under 0.6.0, so 0.6.0 again matches the v0.6.0 tag, including the original run_config.json entry. - 0.7.1: #264 #271 #274 #281 #284 #289 #293 #299 #316 #317 #318 #323 #324 #326 #327, plus the #320 wording of the Windows Git-root entry, since #320 changed that 0.7.0 fix in 0.7.1. - 0.7.2: #263 #265 #269 #270 #276 #279 #287 #290 #296 #309 #328 #330 merged with the existing #335 entries. Only post-v0.7.2 entries stay under Unreleased, with one heading per subsection. Entry text is unchanged, apart from the published tag wording in 0.7.0 and 0.6.0. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(release): prepare v0.8.0 Set the package, fallback, lock, citation and developer-guide versions to 0.8.0 and move every entry merged since v0.7.2 under '## 0.8.0 - 2026-11-05', leaving Unreleased empty. The refusal-fallback documentation test now reads the release section that names CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK, requires it to be 0.8.0, and requires exactly one entry there to name the switch. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(release): pin the verified 0.8.0 Tier 1 image and add its CI bundle Pin onboarding to the Tier 1 image published by the reviewed main revision 55d2d04 in "Build and publish Tier 1 image" run 42158955180: ghcr.io/nvidia/skillevaluator-tier1@sha256:9d5483243918937be4f2178f74cf7c622a531dee41e3176906994d52fa14950a (config sha256:d17d6f5105ec5f1bf0cbe4dff0d693aae4ecf01e9c1c6a6ddb7830518acace33). The workflow and publisher refs both move to 55d2d04. ci/bundles/0.8.0 mirrors the 0.7.2 bundle. The templates, README and release.json are the run's github-actions-onboarding artifact and match ci/render_templates.py output for these pins byte for byte. The scanner inventory and verification receipt come from the build's runtime-stage version step, the five-case smoke receipt, the onboarding job's anonymous pull, and the public manifest, whose config digest equals the smoke-tested image ID. The ZIP uses the 0.7.2 layout (sorted members, inner checksums, 1980 timestamps, 0644, deflate level 9) and rebuilds to identical bytes. Point the current-bundle links at 0.8.0 and list 0.7.2 as historical. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]> --------- Signed-off-by: Narendran Raghavan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
similarity-check --catalogandtier2 --catalogcompare one skill with every entry of a saved local catalog. When that skill is already in the catalog, which is the normal case when a team re-screens its own skills, it matched its own entry with a score of 1.0. The result reported it as anEXACT_DUPLICATEof itself (CRITICAL) and the run failed.This change skips the one catalog entry that records the target itself, and only with positive evidence that the target sits in the tree the catalog was built from:
EmbeddingRegistry.catalog_self_entry(target)finds that entry. Catalogs store paths relative to a scan root they do not record. An entry counts as the target only when all three of these hold:SKILL.mdwith--full-body../skillsfor./skills/alphaand catalog pathalpha..) entry and a catalog with no other skill entry never match. A target path that differs from the catalog only in letter case matches when both spellings name the same directory, as on a case-insensitive filesystem.EmbeddingRegistry.query_entrygains a keyword-onlyexclude_entry_id. It skips that entry before the threshold and the match limit apply.SimilarityValidatoruses both. Itscatalog_comparedsuccess detail recordsself_matches_excludedandexcluded_catalog_paths, so every skip shows up in the JSON report. Its message names the skipped entry.The tree check matters because Tier 1 requires a skill's directory name to equal its frontmatter
name. A conformant verbatim copy therefore always ends in the same directory name as the original. Path suffix plus fingerprint alone would treat any same-name, same-description skill as the catalog's own entry, whether it is a copy in a staging folder, in another repository, or a new nested skill.Why
Re-screening skills that are already in the catalog is a natural CI pattern: build the catalog once, then check each changed skill against it. Every such run failed with a false CRITICAL finding. A catalog entry holds only a relative path and a content fingerprint, so nothing downstream could tell the skill's own row from a real duplicate.
With this fix, an unchanged skill passes, in the tree the catalog was built from or in another checkout of it. So does a skill whose edits leave the compared content unchanged, such as a body-only edit in the default description mode. Real duplicates outside that tree still fail the run.
The table shows public main and this branch, run through the CLI with a deterministic embedding stub. The catalog is built from
repo/skills/{alpha,beta}.candidates/alphais a verbatim copy that passes Tier 1, andsecond-checkoutis a full copy ofrepo.repo/skills/alpha(already in the catalog)EXACT_DUPLICATEagainstalphaexcluded_catalog_paths: ["alpha"]second-checkout/skills/alpha(another checkout)EXACT_DUPLICATEagainstalphaexcluded_catalog_paths: ["alpha"]candidates/alpha(verbatim copy)EXACT_DUPLICATEagainstalphaEXACT_DUPLICATEagainstalphaLimitations
--full-body)SKILL.mdchanged no longer matches its old entry and is compared with it as before.Kept from public
extract_from_skill. Every path component below the inferred root is checked for links first. At most eight manifests are read, each capped at the per-file manifest limit, and any read error counts as absent.Relation to main and open PR #28
deduplication/plugin/catalog_checks.py, from Compose private inventory, audits and catalog checks #257) already skip a bundle's own catalog entries and record them underself_matches_excludedandexcluded_catalog_paths. They do not cover the single-skillsimilarity-check --catalog/tier2 --catalogpath changed here, which uses the same metadata names.self_matches_excludedandexcluded_catalog_paths. The rules are analogous (path plus fingerprint), not identical. feat(plugin): Add Plugin evaluation support across all tiers #28 matches an exact path set relative to a known plugin root. This path has no known root, so it infers one from the target's path and then requires the catalog-tree evidence above. feat(plugin): Add Plugin evaluation support across all tiers #28 does not change the single-skillquery_entrypath covered here.registry.pyimport block. feat(plugin): Add Plugin evaluation support across all tiers #28 addssecure_fsandstructured_dataimports right above thetier2_pathsimport, which both PRs change the same way. Keep both.query_entry. feat(plugin): Add Plugin evaluation support across all tiers #28 replaces_validate_threshold(threshold)withvalidate_similarity_threshold(...)where this PR addscatalog_self_entryand changes the signature and docstring.tests/embedding/test_catalog.py, where both PRs append tests. Keep both._fingerprinthelper tocontent_fingerprint, and this PR calls it once, in_entry_fingerprint.Tests
tests/embedding/test_catalog.py::TestCatalogSelfEntryruns against real saved and reloaded catalogs:EXACT_DUPLICATEin both modes. The cases are a copy atcandidates/alpha, a copy atother-repo/skills/alpha, a renamed copy, and a new nestedskills/team/alphawith the same name and description.skills/alphaandvendor/skills/alpha..) entry never identifies the target.tests/validators/test_similarity.py::TestCatalogSelfEntryis an end-to-endSimilarityValidatorrun (save catalog, then query). The existing skill passes with the exclusion recorded, and conformant copies atcandidates/alphaandother-repo/skills/alphafail. Two mocked catalog tests now assert the newquery_entrycall.pytest tests/validators/test_similarity.py tests/embedding tests/deduplication tests/cli/test_tier_workflows.py tests/test_tier2_command_failures.py tests/test_publication_evidence.py tests/test_commands.py tests/test_cli.py tests/reporting/test_reporters.py tests/test_oss_packaging.py: all pass.ruff checkandruff format --checkpass on the changed Python files, and so doesscripts/check_oss_boundary.py.🤖 Generated with Claude Code