Skip to content

fix: a directory a walk cannot list is an error, not a smaller tree, in select_docs, the skill link check and catalog provenance - #1636

Open
antonwolfy wants to merge 9 commits into
intel:mainfrom
antonwolfy:fix/unlistable-skill-docs
Open

antonwolfy wants to merge 9 commits into
intel:mainfrom
antonwolfy:fix/unlistable-skill-docs

Conversation

@antonwolfy

@antonwolfy antonwolfy commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Same cause as #1168, #1481 and #1510: a glob or an os.walk with no onerror skips a directory it cannot list (mode 0o111, non-root), so the result is a smaller tree that is counted or trusted as the whole. Three sites still do it on main:

Issue Input On main
#1383 docs/top.md, docs/sub/a.md, include docs/**/*.md, chmod 111 docs/sub select_docs gives ['top.md'] (listable: ['a.md', 'top.md']); min_docs and max_docs are checked against the smaller count
#1479 skill with SKILL.md and a hidden .h/ holding a link to a file outside the skill, chmod 111 skill/.h check_skill returns demo; build_plugin then fails in the copy with shutil.Error [('.../skill/.h', '.../plugin/skills/demo/.h', "[Errno 13] Permission denied ...")], not a ValueError
#1480 root with a/SKILL.md and sub/x/SKILL.md, chmod 111 sub the scan gives [('demo', True, .../a/SKILL.md), ('sub', False, None)] and catalog provenance drops the sub row at its continue: the table and its summary are for a smaller tree, with no word

Each follows how #1481 reported the same condition: a refusal of the command's own error type that names the directory. #1383 takes the issue's first option (walk the directories an include pattern lists with an onerror, then keep Path.glob's matching), so **, hidden files and exclude match as before. #1480 takes the first option too (an InputError, as catalog trigger-set --catalog exits 2), not a note under the table.

Closes #1383
Closes #1479
Closes #1480

Changes

  • runner/spec.py: new _refuse_unlistable, called for each include pattern after its glob. It walks the pattern's parts as Path.glob does (_next_steps): a literal part is entered, through a link too, and the last literal name is looked up, not listed; a wildcard part lists the directory and enters the directories it matches, links included; ** lists, enters the directories below it without following links, and also matches none. It raises DocSelectionError("cannot list <dir>: <reason>") for a directory that cannot be listed. A directory the exclude list drops together with the files below it (_excludes_subtree: an entry that names the directory or a parent, docs/sub or docs/sub/**, or has a form that ends in * and matches it, docs/s*; not an entry for one file name below it such as docs/*/x, nor docs/sub?/**, whose form docs/sub? matches docs/sub/ through the ? but no file below it, which leaves docs/sub/a.md selected on a listable tree, so the unlistable directory is an error; not docs/[s]ub, which matches the directory and no file in it, so the files stay selected on a listable tree and the directory is an error) (at the start of the walk too), one outside the root (a .. pattern or a link out), a path that is not there and a link whose target cannot be reached are not listed by the pattern and stay no error. A directory that resolve() cannot follow (it raises RuntimeError on Python before 3.13, or OSError) leads nowhere and is not walked, so the old min_docs error comes out. _outside_links and the leaves_root closure are not touched.
  • harnesses/skill_treatment.py: _check_links passes _refuse_unlisted as the onerror of its os.walk, and _check_link_loops calls it where its visit returned on an OSError (the comment saying the copy reports it is gone). It raises a ValueError naming the folder, before the copy. A folder load_skill already refuses (not under a dot-named, vendored or __pycache__ folder it leaves out, More rglob/os.walk sites list or digest a directory tree and skip a subdirectory they cannot list #1168) is left to it, so cannot load skill at ... is unchanged; the existing test_check_skill_says_a_skill_it_cannot_list_does_not_load stays as it was. A folder under such a left-out folder, __pycache__/sub, is refused by the link check, since load_skill never names it and the copy would fail on it.
  • commands/catalog_provenance.py: new _refuse_unlisted, applied to the entries of read_skill_manifest and, when a skills.yaml lists some skills, to the scan that finds the rest. An entry that is unlisted, has an error and whose path is a directory with no SKILL.md file (a directory or a dangling link named SKILL.md is no file) raises InputError("--root: <dir> cannot be listed (...), so the skills under it may be missing") before any row is printed. A directory with no search permission (mode 0o000) holds no SKILL.md we can read, so it is refused the same way, not with a PermissionError from the probe. A manifest entry with no file, and a skill whose own folder cannot be listed (its row has a SKILL.md), keep the old behaviour.
  • Docs: dokimi/README.md (benchmark spec exit codes), docs/coding-harnesses.md (skill delivery), docs/external-content.md (catalog provenance). No page added.
  • Tests: tests/test_select_docs_unlistable.py, tests/test_skill_links_unlistable.py, tests/test_provenance_unlistable.py, tests/test_select_docs_link_loops.py.
  • Changelog fragments (Fixed), one per issue.

Risk

  • benchmark run with a golden_manifest now exits 2, naming the directory, where it ran on the smaller document set. A tree whose directories are all listable is unchanged.
  • A skill with a hidden, vendored or __pycache__-nested folder that cannot be listed is now refused by check_skill / build_plugin (the cell fails before the image build), where check_skill passed it and the copy failed with a shutil.Error.
  • catalog provenance exits 2 for a root with such a directory, where it printed a smaller table. A root with no such directory prints the same table.
  • Open PR fix(repo): inspect names unreadable instruction files and plugin manifests (#1271) #1328 edits _outside_links and adds _leaves_root in runner/spec.py, the neighbour of the new helper. The helper is a separate function after _symlink_note, and the only line added to select_docs is one call, so the two should merge without conflict.
  • The link-walk onerror in _check_links is redundant in effect with the one in _check_link_loops: with either alone check_skill refuses the repro. Both are kept, as the issue asks, so each pass refuses on its own; a test with the loop check stubbed pins the walk's.

Testing

On a Linux review host, at 1aea8f5c (on main 101e0b9a):

  • make ci-local: 37 passed, 1 failed, 16 skipped (docker and network jobs, semgrep, micromamba, the fuzz job, the jobs a PR condition or another job's matrix gates). The pytest run is 35468 passed, 1 failed, 28 skipped. The failure is tests/test_import_architecture.py::test_package_uses_the_new_modules (dokimi.runs.resolve imports dokimi.utils), which fails the same way on main's code (not touched here; filed separately as dokimi.runs.resolve imports dokimi.utils, which test_package_uses_the_new_modules refuses #1629). Scan commits and the mutation of changed lines pass.
  • Merged with today's main, tests/test_runner_spec.py::test_min_docs_error_on_a_looping_docs_link_is_a_selection_error raised RuntimeError from the new helper's resolve(); the helper now guards it (tests/test_select_docs_link_loops.py, 2 cases for the resolve failure fail without the guard).
  • The repros fail at main and pass here: test_select_docs_unlistable.py 4 failed, 6 passed on main (first: DID NOT RAISE DocSelectionError), test_skill_links_unlistable.py 6 failed, 2 passed (first: DID NOT RAISE ValueError, and shutil.Error from build_plugin), test_provenance_unlistable.py 2 failed, 3 passed (DID NOT RAISE InputError). All pass at the head.
  • Mutants: each new assertion block fails on a break of its own line: the call in select_docs, the walk's outside-the-root return (a .. pattern and a link out, one test each), the exclude check at the start of the walk, the exclude check not dropping the root for a .* pattern, a literal part listed instead of entered (a link reached by name, and the last name of docs/*/a.md), a wildcard part not following a link, a wildcard entering a directory it does not match or one the last part matches, ** also matching no directory, ** ending the pattern, ** following a link, the link-target-unreachable tolerance, the walk's onerror, the loop check's call, the load_skill carve-out and the ancestor check for __pycache__/sub, and the provenance probe's OSError (mode 0o000, both with and without a manifest). The resolve guard: replacing except (RuntimeError, OSError) fails both cases of the helper test.
  • Repros of the review points, each failing at the previous head aa75ca18 and passing here: alias/a.md through an in-root link to a mode 0o111 directory, docs/sub/**/*.md whose base the exclude list drops, docs/*/*.md through a link to a mode 0o111 directory (now an error naming it), ../outside/**/*.md with ../outside at mode 0o111, docs/*/a.md over a mode 0o111 docs/sub (selects a.md), __pycache__/sub at mode 0o111 (refused by check_skill), and catalog provenance over a mode 0o000 sub (exit 2 where it raised PermissionError).
  • Repros of the second round, each failing on a copy with that fix reverted and passing here: a mode 0o111 sub holding an empty directory sub/SKILL.md or a dangling link of that name beside sub/x/SKILL.md (with and without a skills.yaml): catalog provenance exits 2 naming sub; include=["docs/**/*.md"], exclude=["docs/[s]ub"] over a mode 0o111 docs/sub: select_docs raises cannot list ...docs/sub (on a listable tree it selects a.md, top.md, x.md). 5 of the 35 tests of test_provenance_unlistable.py and test_select_docs_unlistable.py fail on those reverts.
  • Repros of the third round: include=["docs/**/*.md"], exclude=["docs/*/x"] over a mode 0o111 docs/sub holding a.md beside a readable docs/top.md: at 4d8fc2fa select_docs returned top.md alone, now it raises cannot list ...docs/sub (the listable tree selects a.md, top.md, x.md); that test fails on the previous head's code. exclude=["docs/s*"] and ["docs/sub"] still drop the directory with no error. Mutants: matching rel_dir + "/x" again fails the docs/*/x test; dropping the trailing-* clause fails the docs/s* test; keeping only the startswith or only the == of the named-directory clause fails the test of an unlistable docs/sub/deep below an excluded docs/sub and the ["docs/sub"] assertion. For the catalog provenance lines codecov named: Python 3.11 and 3.12 raise PermissionError from Path.is_file for a name inside a mode 0o000 folder, where 3.13 returns False, so the except OSError of _holds_skill_file ran on no 3.13 input. A test now makes is_file raise it and expects exit 2; narrowing the except to FileNotFoundError fails it.
  • Repro of the fourth round: include=["docs/**/*.md"], exclude=["docs/sub?/**"] over a mode 0o111 docs/sub holding a.md beside a readable docs/top.md: the form docs/sub? matches docs/sub/ and no file below it, so on a listable tree a.md is selected and the unlistable directory now raises cannot list ...docs/sub (before, top.md alone). The test fails on a copy with the old trailing-* check on the pattern restored, and on main's code (which has no check).
  • Not run: Python 3.11, 3.12 and 3.14 (this host runs 3.13), the Windows and macOS legs, the docker and network jobs. A non-root user is needed for the tests (they skip when the process can list a mode 0o111 directory).

Open questions

None.

Revert

A plain revert restores the old behaviour (a smaller tree read without a word). Nothing is stored.

Checklist

  • Tests added/updated and pytest passes [one failure, test_package_uses_the_new_modules, which fails the same on main]
  • ruff, mypy, and schema checks pass
  • Docs updated (or N/A) — see the docs-drift checklist in CONTRIBUTING.md
  • Self-reviewed per "Before opening a PR" in AGENTS.md
  • Each new raise/exit and test names the doc, contract or issue it traces to
  • No ad-hoc run artifacts committed
  • New files carry the SPDX license header (or are exempt in .github/.licenserc.yaml)

…st (intel#1383)

select_docs expanded each include pattern with Path.glob, which skips a directory it cannot list (mode 0o111, non-root) without an error. With docs/top.md and docs/sub/a.md, include docs/**/*.md and docs/sub unlistable, it returned top.md alone, and min_docs and max_docs were checked against that smaller count.

Each include pattern's walk is now checked for a directory it has to list: an unlistable one raises DocSelectionError naming it. A directory the exclude list drops, one no match can lie under, a path the pattern only names, a path that is not there and a link that leaves the root are not listed by the pattern and stay no error. The check is a new helper, apart from _outside_links.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…ntel#1479)

_check_links walked the skill with os.walk and no onerror, so a link out of the skill inside a hidden or vendored folder that cannot be listed (mode 0o111, non-root) was never checked. check_skill returned the name, and build_plugin then failed in the copy with a shutil.Error instead of the ValueError the other refusals raise. _check_link_loops returned on the same OSError, leaving it to the copy.

Both now raise a ValueError naming the folder, before the copy. A folder load_skill already refuses (any but a dot-named, vendored or __pycache__ one) is left to it, so its error is unchanged.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…ist (intel#1480)

Since the scan gives an error row for a directory above the skills that cannot be listed, catalog provenance dropped it at the _skill_file(...) is None branch: the skills under that directory were missing from the table and its summary, with no note.

Such a row (unlisted, with an error, its path a directory with no SKILL.md) now raises an InputError naming the directory, before any row is printed, with or without a skills.yaml. A manifest entry with no file, and a skill whose own folder cannot be listed, keep their behaviour.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…rror (intel#1383)

The unlistable-directory check resolved the include pattern's base link with no guard, so a link that loops, where resolve raises RuntimeError (Python before 3.13) or OSError, escaped select_docs instead of giving the min_docs error.

A link that resolve cannot follow leads nowhere, so the check now treats it as not walked and goes on. Tests cover the resolve failure and a loop below the pattern's base.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
@antonwolfy
antonwolfy requested a review from a team as a code owner December 4, 2026 22:38
Copilot AI balanced review requested due to automatic review settings December 4, 2026 22:38
@antonwolfy antonwolfy self-assigned this Dec 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Directory traversal mishandles exclusions and symlinks, causing false errors or silently missed documents, while unreadable loader-excluded subdirectories can pass validation and fail during plugin builds.

4 open issues
What changed in this PR

4 new findings.

This PR makes dokimi report directories it cannot list instead of silently accepting incomplete document sets, skill checks, or provenance tables.

Changes:

  • Add listing-error handling to document selection, skill validation, and catalog provenance.
  • Add regression tests for permissions, exclusions, and symlink behavior.
  • Document the error behavior and add changelog fragments.
File Description
dokimi/​tests/​test_skill_links_unlistable.py Tests skill validation before copying.
dokimi/​tests/​test_select_docs_unlistable.py Tests listing failures and selection boundaries.
dokimi/​tests/​test_select_docs_link_loops.py Tests looping-link handling.
dokimi/​tests/​test_provenance_unlistable.py Tests provenance refusal and preserved behavior.
dokimi/​README.md Documents benchmark listing errors.
dokimi/​dokimi/​runner/​spec.py Adds document-tree listing validation.
dokimi/​dokimi/​harnesses/​skill_treatment.py Handles listing failures in link checks.
dokimi/​dokimi/​commands/​catalog_provenance.py Refuses incomplete provenance scans.
dokimi/​docs/​external-content.md Documents provenance exit behavior.
dokimi/​docs/​coding-harnesses.md Documents skill-folder refusal.
dokimi/​changelog.d/​20261204_100200_provenance-unlistable.md Records the provenance fix.
dokimi/​changelog.d/​20261204_100100_skill-links-unlistable.md Records the skill-check fix.
dokimi/​changelog.d/​20261204_100000_select-docs-unlistable.md Records the document-selection fix.

Review effort: Balanced

Comment thread dokimi/dokimi/runner/spec.py Resolved
Comment thread dokimi/dokimi/runner/spec.py Resolved
Comment thread dokimi/dokimi/runner/spec.py Resolved
@exai-bot

exai-bot commented Dec 4, 2026 •

Copy link
Copy Markdown

✅ OpenCodeReview: Review complete: 0 finding(s) across 2 selected item(s).

CI at 1aea8f5: 21 passing, 4 skipped.

Review limit reached. This PR has had 6 reviews, so it will only be reviewed again when you ask.
To ask: re-request review from exai-bot in the Reviewers list.

Test notes (3)
  • dokimi/tests/test_select_docs_unlistable.py: dokimi/tests/test_select_docs_unlistable.py passes at the head and also at the merge base, where the code this pull request changes is still as it was. No test in it fails without the change, so none of them would notice if the change were undone.
  • dokimi/tests/test_skill_links_unlistable.py: dokimi/tests/test_skill_links_unlistable.py passes at the head and also at the merge base, where the code this pull request changes is still as it was. No test in it fails without the change, so none of them would notice if the change were undone.
  • dokimi/dokimi/runner/spec.py:133: With if any(form.endswith("*") and fnmatch.fnmatch(rel_dir + "/", form) for form in _zero_dir_forms(pattern)): changed to if not (any(form.endswith("*") and fnmatch.fnmatch(rel_dir + "/", form) for form in _zero_dir_forms(pattern))):, the tests still pass: dokimi/tests/test_provenance_unlistable.py, dokimi/tests/test_select_docs_link_loops.py, dokimi/tests/test_select_docs_unlistable.py, dokimi/tests/test_skill_links_unlistable.py, dokimi/tests/test_unlistable_sites.py. If this condition matters, a test should pin it.
Review details
  • Commit reviewed: 1aea8f5 against merge base 3489a1d
  • Coverage: 2 files in 1 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 80k tokens (54k from cache), 18s
  • Tool calls: 6 (4 file_read, 1 local_check_results, 1 pr_threads)
  • small change set: 2 files

Comment thread dokimi/dokimi/runner/spec.py Resolved
Comment thread dokimi/dokimi/runner/spec.py Resolved
@codecov-commenter

codecov-commenter commented Dec 4, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.49%. Comparing base (101e0b9) to head (1aea8f5).
⚠️ Report is 18 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1636      +/-   ##
==========================================
+ Coverage   96.47%   96.49%   +0.02%     
==========================================
  Files         561      569       +8     
  Lines       74345    75325     +980     
  Branches    12840    12996     +156     
==========================================
+ Hits        71722    72686     +964     
- Misses       1605     1611       +6     
- Partials     1018     1028      +10     
Files with missing lines Coverage Δ
dokimi/dokimi/commands/catalog_provenance.py 96.11% <100.00%> (+0.61%) ⬆️
dokimi/dokimi/harnesses/skill_treatment.py 97.15% <100.00%> (+0.11%) ⬆️
dokimi/dokimi/runner/spec.py 95.18% <100.00%> (+3.84%) ⬆️

... and 77 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@napetrov napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Change class: CONTRACT (head aa75ca1)

  • Contract: candidate. errors dokimi/dokimi/commands/catalog_provenance.py:95; errors dokimi/dokimi/harnesses/skill_treatment.py:151
  • Responsibility: none
  • Dependency: none
  • Review depth: check the changed surface: callers, docs, tests pin new behaviour
  • Coverage gaps: none

Open issues to resolve on aa75ca18.

  • On a non-root Linux run, the base selects the visible document when a separate include targets an excluded directory. The head raises DocSelectionError while listing the excluded directory. Earlier finding
  • The base reads a named file through an in-root alias to a searchable directory. The head attempts to list that directory and raises DocSelectionError. Earlier finding

Reviewed the diff, edge cases and prior threads. Focused tests: 23 passed on head. The full local suite was outside coverage.

…s and no more

select_docs now walks an include pattern as Path.glob does: a literal part is entered (through a link too) and the last literal name is looked up, not listed, a wildcard part lists and follows a link to a directory, `**` lists and skips links. A directory outside the root or dropped by the exclude list is not listed, at the start of the walk as below it. So `alias/a.md`, `docs/*/a.md`, `../outside/**/*.md` and an include whose base the exclude list drops no longer raise, and a directory reached through a link by `docs/*/*.md` is listed (review threads on spec.py).

The skill link check leaves to load_skill only a folder it names: one under a `__pycache__` it leaves out is refused by the link check, as the copy would fail on it (skill_treatment.py thread).

catalog provenance treats a folder it cannot even search (mode 000) as holding no SKILL.md instead of raising PermissionError from the probe (catalog_provenance.py thread).

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
@antonwolfy

Copy link
Copy Markdown
Contributor Author

(commented) ### Change class: CONTRACT (head aa75ca1)

@napetrov (#1636 (review)): Its two open points are the threads 4806872319 (a directory the exclude list drops, where a literal path starts) and 4806872244 (a named file through an in-root link); both are fixed in 622bcdd, with the repros and tests in those replies.

Comment thread dokimi/dokimi/runner/spec.py Resolved
provenance: a folder that cannot be listed and holds a directory or a dangling link named SKILL.md passed the exists() check of _holds_skill_file, so _skill_file dropped its row and the skills beside it went unseen; the check is now is_file(), the test _skill_file applies.

select_docs: an unlistable directory the exclude list matches itself but not the files below it (docs/[s]ub) was pruned before listing, while its files stay selected on a listable tree; it is pruned only when the exclusion also covers a file below it, and otherwise raises.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
Comment thread dokimi/dokimi/runner/spec.py Resolved
…exclude list covers its whole subtree

An exclude such as `docs/*/x` matched the synthetic name `docs/sub/x`, so an unlistable `docs/sub` holding `a.md` was pruned and `select_docs` returned `top.md` alone with no error, while the listable tree selected both. The walk now prunes a directory only when an exclude entry names it or a parent (`docs/sub`, `docs/sub/**`) or ends in `*` and matches it (`docs/s*`).

catalog provenance: cover the `OSError` branch of the SKILL.md lookup, which Python 3.11 and 3.12 raise for a folder with mode 000, with a test that makes `is_file` raise it.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
Comment thread dokimi/dokimi/runner/spec.py Resolved
…e ending in /* covers

Review point: `exclude=["docs/sub/*"]` drops every file below `docs/sub`, but `_excludes_subtree` matched the directory name `docs/sub` against the pattern, which fnmatch refuses, so an unlistable `docs/sub` raised DocSelectionError. A pattern that ends in `*` is now matched against the directory plus a `/`, so `docs/sub/*` and `docs/*/*` count as covering the subtree; `docs/sub/a*` still does not.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
Comment thread dokimi/dokimi/runner/spec.py Resolved
@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Mutation of changed lines

⚠️ No break was missed, but only 65 of 70 were caught; the rest were waived, timed out or errored

At 1aea8f5: 65 caught · 0 missed · 5 waived

Not checked:

  • 7 changed lines were not mutated

Marked harmless with mutation-ok:

Where Operator Change Reason
dokimi/dokimi/runner/spec.py:227 delete-statement seen.add((real, parts)) → pass see above
dokimi/dokimi/runner/spec.py:135 return-none False → None None is as false as False
dokimi/dokimi/runner/spec.py:225 drop-clause not real.is_relative_to(root_resolved) or (real, parts) in seen → (not real.is_relative_to(root_resolved)) ``seen`` only keeps ``**/**`` from walking a directory twice
dokimi/dokimi/runner/spec.py:251 drop-clause recursive and rest → (rest) a wildcard part walking its own directory again lists only what it listed alread
dokimi/dokimi/runner/spec.py:272 return-none False → None None is as false as False

Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary.

… of an exclude matches

An exclude such as docs/sub?/** has the forms docs/sub?/* and docs/sub?. The second matches docs/sub/ through the ? but no file below it, so _excludes_subtree dropped an unlistable docs/sub while _is_excluded kept docs/sub/a.md selected, and the result lost a document without an error. The matching form must itself end in *. This settles the review thread on spec.py:132.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>

@napetrov napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Change class: CONTRACT (head 1aea8f5)

  • Contract: candidate. errors dokimi/dokimi/commands/catalog_provenance.py:106; errors dokimi/dokimi/harnesses/skill_treatment.py:152
  • Responsibility: none
  • Dependency: none
  • Review depth: check the changed surface: callers, docs, tests pin new behaviour
  • Coverage gaps: none

1 blocking, 0 minor.

Document selection, skill link checks and catalog provenance now report unlistable directories. Document selection can still refuse a path whose matching files are all excluded.

CI on head 1aea8f5: 0 failing Actions jobs; merge base 101e0b9 is behind base tip 5225c2a.

Compared the change and input edges against the merge base and checked existing threads and GitHub Actions. Runtime checks used focused Linux tests and local fixtures. Focused tests on the head: head 45 passed in 1.86s.

seen.add((real, parts)) # mutation-ok[delete-statement]: see above
if real != root_resolved:
rel = real.relative_to(root_resolved).as_posix()
if _excludes_subtree(rel, exclude):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

blocking: A complete selection can fail on excluded Markdown

dokimi/dokimi/runner/spec.py:224 The walk proves that whole subtrees are excluded without considering what the include can select (C2). The previous whole-subtree case is fixed. Earlier thread

How to check: Include README.md and docs/**/*.md, exclude docs/*.md, and make docs/restricted search-only. Base selects README.md. Head raises DocSelectionError, even though the matched documents are excluded.
Expected: Use the remaining include pattern when checking exclusions. Here the exclude glob covers all eligible Markdown below docs.

@vchamarthi vchamarthi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@antonwolfy, could you fix the small thing I've marked fix before merge (in the line comments) and fix what napetrov's thread on dokimi/dokimi/runner/spec.py:224 still points out? I'll approve once that's done.
I'll approve once that's done.

Optional, non-blocking (1)
  • dokimi/dokimi/commands/catalog_provenance.py:105: catalog provenance prints a table with no error when a folder above the skills cannot be listed but holds a readable SKILL.md (main has it too).

What I checked on 1aea8f5:

  • When I changed the code on purpose, the tests still passed for 4 of 12 changes, and no test pins these down yet (non-blocking): dokimi/dokimi/commands/catalog_provenance.py:93 (the handled error is raised again), dokimi/dokimi/harnesses/skill_treatment.py:200 (the handled error is raised again), dokimi/dokimi/runner/spec.py:216 (the handled error is raised again) and 1 more.
  • The 87 changed tests pass, and fail on main as expected.
  • The full test suite passes with main merged in (37,801 tests), apart from failures main has too.
  • It merges cleanly onto main.

partial clone) reports `history: partial` with `missing_blobs`; fetch them for an exact count.
When a manifest leaves the head of the matched path unspecified, the behind column reads
`unknown`. Its JSON fields `at_head`, `behind_commits`, and `behind_months` are null. `--format json` adds the upstreams, one row per skill and a `summary`.
A directory under `--root` that cannot be listed, above the skills, exits 2 and names the directory (`--root: <dir> cannot be listed (Permission denied), so the skills under it may be missing`) with no table, since the table would describe a smaller tree.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fix before merge (blocking): The new sentence in external-content.md says an unlistable directory above the skills exits 2, but one with a readable SKILL.md is listed with no error.

I tested this suggestion: it fixes the problem, and the tests still pass.

Suggested change
A directory under `--root` that cannot be listed, above the skills, exits 2 and names the directory (`--root: <dir> cannot be listed (Permission denied), so the skills under it may be missing`) with no table, since the table would describe a smaller tree.
A directory under `--root` that cannot be listed and holds no `SKILL.md`, above the skills, exits 2 and names the directory (`--root: <dir> cannot be listed (Permission denied), so the skills under it may be missing`) with no table, since the table would describe a smaller tree.
Details

I tried catalog provenance --root on a/SKILL.md, sub/SKILL.md and sub/x/SKILL.md, with sub at mode 0o111. It prints a table with the rows a and sub, no sub/x row, and no error. The sentence says such a directory exits 2 with no table, and I'd expect the sentence to cover only a directory with no SKILL.md file, as the PR description does.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

6 participants