Repository navigation
fix(skills): discover_skills skips vendored and VCS directories - #215
Conversation
A SKILL.md under .git, node_modules, site-packages, a virtualenv or __pycache__ below the catalog root is a dependency's copy, not a skill of the catalog; a differing version escaped the mirror rule and loaded as a rival skill. Those directories are no longer walked. Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #215 +/- ##
==========================================
- Coverage 92.76% 92.75% -0.01%
==========================================
Files 256 256
Lines 32414 32423 +9
Branches 5421 5423 +2
==========================================
+ Hits 30068 30075 +7
- Misses 1561 1562 +1
- Partials 785 786 +1
🚀 New features to boost your workflow:
|
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com> # Conflicts: # dokimi/dokimi/skills/loader.py
read_skill_manifest without a skills.yaml walked every SKILL.md under the root, so a dependency's copy under node_modules or a virtualenv was listed as a catalog skill. The changelog of this PR says catalog commands no longer offer those copies; the bare scan now uses the loader's vendored-aware walk (walk_skill_files, made public from _skill_files). Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
antonwolfy
left a comment
There was a problem hiding this comment.
The fix is right: os.walk with in-place pruning matches the old rglob for everything except the pruned names, and both the skill-catalog: arm and the bare catalog scan go through it. One thing to fix before merge, the tests do not pin most of the names; three nits.
What I ran, on a Linux review host at 3f67aea:
make ci-local: 29 passed, 0 failed, 7 skipped; changed-line coverage passes.- Old
rglobagainst newwalk_skill_fileson a tree with symlinked directories, a symlink loop, a symlinkedSKILL.md, hidden directories and relative roots: same results and same order, except that a directory namedSKILL.mdis no longer returned. - Mutation run on
VENDORED_DIR_NAMESagainsttest_skill_loader.pyandtest_external_catalog.py: see the inline comment.
Nit: the docs that describe discovery do not mention the new skip. dokimi/docs/README.md:40, dokimi/docs/evaluating-treatments.md:33 and :290-295, dokimi/docs/external-content.md:52-54 and the --catalog help in dokimi/dokimi/commands/novelty.py:639-643 list the template and mirror exclusions only. Because the skip leaves no note, a user cannot find out from the output either. Suggestion: add "vendored and VCS directories (.git, node_modules, site-packages, virtualenvs) are not walked" next to the template rule in those places.
Checked, no issues
- Ordering and symlinks: sorted
Pathorder is kept; symlinked directories are not followed, as before. - Callers:
walk_skill_filesis the only recursiveSKILL.mdlookup; the otherglobcalls are non-recursive. - Root inside a vendored directory: still walked, and tested.
- Changelog format: one
### Fixedentry with a bold lead-in, aschangelog.d/README.mdasks.
Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
antonwolfy
left a comment
There was a problem hiding this comment.
I pushed a commit per nit, up to 6248970, which fix the two nits from my review:
0a96697:dokimi/changelog.d/20261024_130000_napetrov_discover-skills-skip-vendored.md:3: the entry now names theskill-catalog:arm and thecatalogcommands, not theskill:arm.6248970:dokimi/docs/README.md:40,evaluating-treatments.md:33and:292,external-content.md:53and the--cataloghelp incommands/novelty.py: each now says vendored and VCS directories are not walked.
Left as is:
dokimi/dokimi/skills/loader.py:27: both suggested fixes change discovery behaviour (a new note, or a smaller pruned set), so the choice stays with the author.
make ci-local at 6248970: 29 passed, 0 failed, 7 skipped.
Not approving yet. Still open: the risk from my review.
…ip-vendored Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
…skips `dokimi catalog formats` walked its own smaller skip set, so a vendored copy under lib/site-packages, venv, .tox and similar was listed as a package that cannot load, while discover_skills and the catalog scan skip it. detect_skill_packages now skips VENDORED_DIR_NAMES, the set the loader walks. test_discovery_skips_each_vendored_name pins the ten names explicitly, so dropping any one of them from the set fails the test. The formats test covers the same case for detect_skill_packages. Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
|
Thanks for the review. Open items, mapped to commits on the branch:
The branch is two commits behind intel/main (one conflict in |
antonwolfy
left a comment
There was a problem hiding this comment.
Review at 56366a0. The test gap from my first review is closed: the ten names are pinned one by one, and catalog formats has its own case. One doc nit is new, and one earlier nit is still open.
What I ran, on a Linux review host at 56366a0:
make ci-local: 29 passed, 0 failed, 7 skipped; changed-line coverage passes.- Mutation runs against the three touched test files: pruning only at the root fails 10 tests; dropping
site-packagesandvenvfrom the set fails 3;formats.pyback to its old skip set fails 1;external/catalog.pyback torglobfails 2.
Nit: three docs still describe --catalog without the vendored-directory rule. The PR rewrote the --catalog help in novelty.py and four docs, but these pages carry the old wording "a template/ copy and a byte-identical mirror ... are left out" (all outside this diff):
README.md:168-169dokimi/docs/skill-novelty-walkthrough.md:44dokimi/docs/skill-novelty.md:604
A reader of these pages assumes a node_modules or .venv copy is still a competitor, while the help text says it is not. scripts/check_docs_review_triggers.py warns that novelty.py changed and the last two pages were not updated. Suggestion: add "vendored and VCS directories (.git, node_modules, site-packages, virtualenvs) are not walked" to the same sentence in each.
Still open from my earlier review:
dokimi/dokimi/skills/loader.py:27: a real skill under a directory namedvenv,.venv,.tox,.noxorsite-packagesis still dropped with no note. Withskills/venv/SKILL.md,skills/site-packages/SKILL.mdandskills/.nox/SKILL.md,discover_skillsreturns neither, andnotesstays empty. Both suggested fixes still stand: a note per pruned directory that holds aSKILL.md, or a smaller set.
Checked, no issues
- Ordering and symlinks:
walk_skill_filessorts thePathlist like the oldrglob; symlinked directories are not followed, and relative roots give the same paths. - Callers: no other recursive
SKILL.mdlookup remains;catalog.py,formats.pyand the loader all use the shared set. - Root inside a vendored directory: still walked, and tested.
- Changelog: one
### Fixedentry with a bold lead-in.
Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
antonwolfy
left a comment
There was a problem hiding this comment.
I pushed a commit per nit, up to 201bb90, which fix the nit from my review:
201bb90:README.md:168,dokimi/docs/skill-novelty-walkthrough.md:44anddokimi/docs/skill-novelty.md:604: the--catalogsentence now says vendored and VCS directories (.git,node_modules,site-packages, virtualenvs) are not walked.
Left as is:
dokimi/dokimi/skills/loader.py:27: both suggested fixes change whatdiscover_skillsreturns or reports, so the choice between a note per pruned directory and a smaller set is left to the author.
make ci-local at 201bb90: 29 passed, 0 failed, 7 skipped.
GitHub CI has not run on these commits: the branch conflicts with main, and Actions runs no workflow on a conflicting PR. CI will check them once main is merged in.
Not approving until CI passes at this head.
|
Merged intel/main in 085c7e3. That covers the merge my last comment said was still missing. The |
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com> # Conflicts: # dokimi/dokimi/skills/loader.py
walk_skill_files dropped dangling symlinks and directories named SKILL.md, so catalog scan lost the error row and exited 0 on a broken skill. The walker now returns every SKILL.md entry; skill_files keeps the is_file guard, so discover_skills still leaves such entries out. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
|
antonwolfy
left a comment
There was a problem hiding this comment.
LGTM. The walker keeps the old rglob results and order apart from the pruned names, and a987465 puts the is_file guard in skill_files so catalog scan reports a broken SKILL.md again while discover_skills leaves it out.
What I ran, on Linux at a987465:
make ci-local: 26 passed, 7 skipped, 2 failed. The two failures are the gitleaks download (the proxy returned 504) and the commit scan that needs it, not this PR. Tests: 8,999 passed; changed-line coverage passes.- Old
rglobagainst the new walker on trees with symlinked files, dangling links, directories namedSKILL.mdand nested vendored directories: same results and order, except for the pruned names. - 20 mutants over the four touched test files (directory entry dropped,
is_fileguard dropped, root-only pruning, in-place prune removed, unsorted walk,rglobback incatalog.pyandformats.py, each of the ten names removed): 19 killed. The survivor removes thetemplate/skip in_scan_skill_files, which no test covers; that predates the PR.
Checked, no issues
- Callers:
walk_skill_filesis used only byskill_files(guarded) and_scan_skill_files;formats.pynow sharesVENDORED_DIR_NAMES. - Docs and help: the ten names in
evaluating-treatments.mdand the changelog match the code; the--cataloghelp matches.
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Summary
discover_skillswalked every directory under the catalog root, including.git,node_modules,site-packagesand virtualenvs. A dependency's copy of a skill there loaded as a skill of the catalog. If the copy differed by even one byte from the real skill, the mirror rule did not drop it, so theskill-catalog:arm offered two rival skills with the same name.Found while working on #211 (trigger-set formats).
Evidence
skills/linux-perfandnode_modules/pkg/skills/linux-perf(a different version) gave twolinux-perfskills.After: it gives one. The new cases are in
tests/test_skill_loader.py:node_modules,.git/modules, and.venv/.../site-packagesare skipped, and a root that itself sits insidenode_modulesis still walked.Merge Danger
Door: two-way
Blast Radius: small. A catalog that keeps real skills under a directory named
venv,.tox,site-packagesor one of the others no longer loads them. These are directory names that would be odd for a skills tree.🤖 Generated with Claude Code