Repository navigation
Conversation
catalog check findings gave no position outside a few message texts, and eight mechanical codes said what was wrong without the edit that clears it. A finding row now has an optional line (1-based, in SKILL.md, or in path) and an optional path (a bundled file), each only when the check knows it: body links and paths, name, description and unknown frontmatter keys, and bundled scripts. cli_output.v1 gains path and catalog_eval.v1 gains line. The messages of name-mismatch, name-format, name-missing, description-too-long, script-crlf, link-missing, path-missing and frontmatter-unknown-key end with the fix. tests/fixtures/finding_codes holds one skill per code that can be raised from disk. Fixes intel#942 Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
✅ OpenCodeReview: Found nothing that must be fixed in this commit. CI at Review limit reached. This PR has had 6 reviews, so it will only be reviewed again when you ask. Other findings not posted (3)2 should fix, 1 not shown by a run Review details
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1324 +/- ##
==========================================
+ Coverage 96.19% 96.21% +0.02%
==========================================
Files 499 505 +6
Lines 66465 67354 +889
Branches 11542 11693 +151
==========================================
+ Hits 63933 64803 +870
- Misses 1563 1570 +7
- Partials 969 981 +12
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open issues
key_line()won’t detect valid YAML with leading indentation before a top-level key (e.g. ` name:… · Newlocate()filters on truthiness (if value), which will drop legitimate falsy values (notably… · New This sets a singlelinewhile the message may list multiple unknown keys; using the first sorted… · New_bundle_findings()now unconditionally re-readsSKILL.mdfrom disk to compute locations. If the… · New
What changed in this PR
Adds optional location metadata (line, path) to catalog check findings and updates several finding messages to end with an explicit “fix” clause, aligning outputs/schemas/docs and adding tests/fixtures to cover the new contract.
Changes:
- Add optional
line/pathto findings (emitted only when known) across JSON/JSONL and CLI output subjects + update JSON schemas. - Update messages for multiple “mechanical” finding codes to end with the action that resolves the finding.
- Add a new location-focused test suite and a comprehensive offline fixture catalog for finding codes.
| File | Description |
|---|---|
| dokimi/tests/test_catalog_path_missing.py | Updates exact wording assertions for path-missing message “fix” clause. |
| dokimi/tests/test_catalog_output_docs.py | Relaxes finding key set assertion to allow optional script, line, path. |
| dokimi/tests/test_catalog_finding_locations.py | Adds coverage for line/path presence/absence and “fix” message suffixes. |
| dokimi/tests/fixtures/finding_codes/similar-skills-exist/similar-b-case/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/similar-skills-exist/similar-a-case/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/pipe-to-shell/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/permission-bypass-flag/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/path-missing/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/path-escapes-skill/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/outside.md | Adds shared fixture file referenced by other fixtures. |
| dokimi/tests/fixtures/finding_codes/name-missing/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/name-mismatch/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/name-format-case/Bad_Name/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/name-conflict/two/conflict-case/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/name-conflict/one/conflict-case/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/mirror-drift/two/drift-case/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/mirror-drift/one/drift-case/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/link-missing/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/link-escapes-skill/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/legacy-model-id/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/install-unpinned/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/frontmatter-unknown-key/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/frontmatter-parse/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/duplicate/two/dup-case/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/duplicate/one/dup-case/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/description-when-not-checked/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/description-too-long/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/description-no-when/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/description-near-duplicate/beta-case/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/description-near-duplicate/alpha-case/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/bundle-file-unreferenced/references/orphan.md | Adds fixture bundled file for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/bundle-file-unreferenced/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/body-too-large/SKILL.md | Adds large-body fixture to trigger body-too-large. |
| dokimi/tests/fixtures/finding_codes/allowed-tools-unrestricted-bash/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/tests/fixtures/finding_codes/allowed-tools-unknown/SKILL.md | Adds fixture skill content for offline code coverage. |
| dokimi/dokimi/schemas/cli_output.v1.json | Makes line optional and adds optional path to finding schema. |
| dokimi/dokimi/schemas/catalog_eval.v1.json | Adds optional line to eval finding schema. |
| dokimi/dokimi/external/validate.py | Computes and attaches line/path to findings; updates several messages with fix clauses. |
| dokimi/dokimi/external/script_checks.py | Updates script-crlf message to include an explicit fix. |
| dokimi/dokimi/external/findings.py | Extends Finding with line/path and adds locate() helper for conditional emission. |
| dokimi/dokimi/external/finding_lines.py | Adds helpers to locate frontmatter/body references and derive path-missing needles. |
| dokimi/dokimi/external/catalog_eval_inventory.py | Uses locate() to include optional location/script fields in eval inventory findings. |
| dokimi/dokimi/external/bundle_paths.py | Updates path-missing message to include explicit fix clause. |
| dokimi/dokimi/commands/catalog_scan.py | Emits optional finding script/line/path via locate(). |
| dokimi/dokimi/commands/catalog_eval.py | Omits null line in CLI output subjects (sparse=True). |
| dokimi/dokimi/commands/catalog.py | Includes optional line/path in emitted CLI output findings, omitting null line. |
| dokimi/dokimi/cli_output.py | Adds optional path to CLI output findings and sparse mode to omit null line. |
| dokimi/docs/catalog-jsonl.md | Documents optional line/path and “message ends with fix” convention. |
| dokimi/changelog.d/20261126_150000_catalog-finding-line-path-fix.md | Adds changelog entry describing optional location fields + message updates. |
Review effort: Lite
| linked = frozenset(text.removeprefix("./") for text in (_file_ref(raw, link=True) for raw in targets) if text) | ||
| return [finding for finding in found if finding is not None] + [ | ||
| Finding("warn", "path-missing", message) | ||
| text = skill.path.read_text(encoding="utf-8") |
There was a problem hiding this comment.
I couldn't reproduce this: grep -n "read_text" dokimi/dokimi/external/validate.py gives 301: text = skill.path.read_text(...) 492: text = skill.path.read_text(...). I don't think it's a defect, because Skill holds only the parsed body, not the file text, and the line numbers need the frontmatter length, so _bundle_findings reads SKILL.md as _frontmatter_findings already does; it is one small read per skill.
Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
The line of a link finding is the earliest line holding any form of the target (a reference definition above an inline link), key_line accepts a frontmatter indented as a whole, locate() omits only unset values, and a frontmatter-unknown-key finding that lists several keys carries no line. validate.py is split so it stays under the 800-line cap: the link and path checks of a skill body move to external/bundle_findings.py. plugin_delta ignores seed_requested like seed, so unseeded arms with different dropped seed values pair. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
This is ready for another look: I've pushed 3 commits on Changes:
Exai-bot's comment:
Threads:
Not caused by this PR:
What I checked on the new commit:
What each test shows
|
A reference definition such as ]: missing.md matched ]: missing.md.bak, a padded first link ( missing.md ) lost to a later unpadded one, a destination in <...> ended at its first space, and parenthesised prose matched as a link. Match the destination exactly, only after ]( or a reference label, and report the earliest line. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
This is ready for another look: I've pushed 1 commit on Changes:
Threads:
What I checked on the new commit:
What each test shows
|
A reference definition inside a blockquote and an inline link whose destination sits on the line after its opener were skipped, so the finding pointed at a later occurrence. The lookup now ignores blockquote markers and matches across one line break, returning the destination's line. A blank line, or a change between quoted and unquoted text, ends the link, so an unfinished opener no longer captures text from another block. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
This is ready for another look: I've pushed 1 commit on Threads:
What I checked on the new commit:
What each test shows
|
| import re | ||
| from typing import Optional | ||
|
|
||
| _BLOCKQUOTE = re.compile(r"^(?: {0,3}>)+ ?") |
There was a problem hiding this comment.
Impact: a supported tab-separated blockquote reference is skipped, so link-missing.line points to a later occurrence instead of the first destination.
Trigger: body >\t[n]: missing.md\n\n[later](missing.md)\n after four frontmatter lines, with the file absent.
Evidence: outside_fences uses QUOTE_MARK_RE = r"[ \t]{0,3}>[ \t]?" and removes the tab, allowing extraction of the definition on line 5. This pattern removes only >, leaving a leading tab that the reference matcher (^ {0,3}) rejects; link_line therefore returns line 7. Align quote normalization with the extractor and add a location regression for this input.
Workaround: replace the tab after > with a space.
Should fix: A run shows it; it was not judged to be met in ordinary use.
Shown by running: exit 1 (at the head) · exit 1 (at the merge base, which cannot run it) · exit 0 (at the head with the fix)
python proof_c3.py
What the proof does: Calls link_line on a body with a tab-separated quoted definition before a later link and checks the first occurrence's line is returned.
The problem shows as the output TAB-QUOTE-LINE.
dokimi/proof_c3.py
import sys
from dokimi.external.finding_lines import link_line
text = "---\na: b\nc: d\n---\n>\t[n]: missing.md\n\n[later](missing.md)\n"
got = link_line(text, "missing.md")
if got != 5:
print("TAB-QUOTE-LINE got", got, "expected 5")
sys.exit(1)TAB-QUOTE-LINE got 7 expected 5
| lines = _lines(text) | ||
| end = _frontmatter_end(lines) | ||
| first = 0 if end is None else end + 1 | ||
| body = _unquoted(lines[first:]) |
There was a problem hiding this comment.
Impact: link-missing.line can point into an excluded code example rather than the link requiring repair. Trigger: after four frontmatter lines, use body ```markdown\n> [example]: missing.md\n```\n[real](missing.md)\n (without the leading space before the opening fence). Evidence: bundle_findings extracts only the real link through outside_fences, but _unquoted retains fenced contents and now makes the quoted definition match; this returns line 6 instead of 8. Previously that quoted definition did not match. Apply fence exclusion while preserving original line positions, and add a catalog-level regression. Workaround: inspect the real link manually or remove the matching example.
Should fix: A run shows it; it was not judged to be met in ordinary use.
Shown by running: exit 1 (at the head) · exit 1 (at the merge base, which cannot run it) · exit 0 (at the head with the fix)
python proof_c1.py
What the proof does: Calls link_line on a body whose fenced example holds a quoted definition and checks it returns the line of the real link.
The problem shows as the output FENCED-EXAMPLE-LINE.
dokimi/proof_c1.py
import sys
from dokimi.external.finding_lines import link_line
text = "---\na: b\nc: d\n---\n```markdown\n> [example]: missing.md\n```\n[real](missing.md)\n"
got = link_line(text, "missing.md")
if got != 8:
print("FENCED-EXAMPLE-LINE got", got, "expected 8")
sys.exit(1)FENCED-EXAMPLE-LINE got 6 expected 8
| body = _unquoted(lines[first:]) | ||
| word = re.escape(raw) | ||
| form = re.compile( | ||
| rf"(?:\]\(|^ {{0,3}}\[[^\]]*\]:)[ \t]*(?:\n[ \t]*)?(?:<(?P<a>{word})>|(?P<b>{word})(?=[\s)\x00]|$))", |
There was a problem hiding this comment.
Impact: an unfinished multiline opener can steal the location of a later valid link.
Trigger: > [q](\n> missing.md\n\n[real](missing.md)\n.
Evidence: extraction splits at the blank line and rejects the unfinished [q] link because it has no closing ), so only [real] supplies the target. This new cross-line regex nevertheless returns 2 rather than 4; the second assertion in test_an_opener_does_not_continue_into_a_blockquote explicitly codifies that incorrect result.
Fix: Validate the complete link within its paragraph before selecting its destination, and change that regression to expect 4; use a separate closed quoted link to test the valid case.
Workaround: remove unfinished openers.
Should fix: A run shows it; it was not judged to be met in ordinary use.
Shown by running: exit 1 (at the head) · exit 1 (at the merge base, which cannot run it) · exit 0 (at the head with the fix)
python proof_c2.py
What the proof does: Calls link_line on a body with an unclosed multiline opener before a real link and checks the real link's line is returned.
The problem shows as the output UNFINISHED-OPENER-LINE.
dokimi/proof_c2.py
import sys
from dokimi.external.finding_lines import link_line
text = "---\na: b\nc: d\n---\n> [q](\n> missing.md\n\n[real](missing.md)\n"
got = link_line(text, "missing.md")
if got != 8:
print("UNFINISHED-OPENER-LINE got", got, "expected 8")
sys.exit(1)UNFINISHED-OPENER-LINE got 6 expected 8
|
str.splitlines also splits at U+2028, form feed and other separators, so a finding after one named a later line than an editor shows. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
…h fixes The fix named the directory or the declared name even when it failed name-format, so following it led to name-format and back to name-mismatch. Each side is offered only when it passes NAME_PATTERN and NAME_MAX. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
link_line and text_line searched fenced code, so a fenced copy above the real link or span took its line. They now search fenced_view (the lines outside_fences keeps, with their indices) and map them back to file lines. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
link_line matched [q]( and a destination on the next line though no ) came before the blank line, so the link the check rejected took the line of the real one. The second assertion of test_an_opener_does_not_continue_into_a_ blockquote encoded this bug (2); it now closes [q] and the bare case is 4. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
|
Pushed four commits on top of
|
xaleryb
left a comment
There was a problem hiding this comment.
Approved on a187b8f. Catalog findings now carry the file and line and state the fix; our commits keep the line right after U+2028, form feeds, fenced copies and an unclosed inline link, and make the name advice offer only valid names so it never loops. Full suite and gates are green on the head merged with main. Windows smoke had not started (the hosted Windows queue was stuck); every other check passed.

Summary
Fixes #942.
catalog checkfindings now carry an optionallineandpath, and the messages ofname-mismatch,name-format,name-missing,description-too-long,script-crlf,link-missing,path-missingandfrontmatter-unknown-keyend with the fix. Scenarios 3 and 5 were fixed by #1050 and scenario 7 bydocs/finding-codes.md.Changes
Findinghas optionallineandpath; they go into the--format jsonrow, the--jsonlrow andcli_output.v1subjects only when set (dokimi/external/findings.py,dokimi/cli_output.py).lineis set for body links and backticked paths (the first line holding them), forname,descriptionand unknown frontmatter keys (the key's line);pathis set for bundled script findings.install-unpinnedstays one finding with no line.cli_output.v1.jsongains an optionalpath,catalog_eval.v1.jsonan optionalline;docs/catalog-jsonl.mdand a changelog fragment describe them.tests/fixtures/finding_codesandtests/test_catalog_finding_locations.py; the two exact-wording assertions ofpath-missingand the key set intests/test_catalog_output_docs.pywere updated.--jsonsubjects leave out a nullline, solineis no longer required incli_output.v1.json; body lookups start after the frontmatter; quoted frontmatter keys are found; thepath-missingpath is read from its repr.(link)before any prefix, apath-missingfinding is located by the code span as written, a leading BOM is skipped, andname-missinghas the line of an emptyname:key.Risk
The text of eight messages changes, so anyone matching on it breaks; the docs already say to match on
code. The new keys are optional and present only when set, but a consumer that rejects unknown keys in a finding row will seelineandpath. Incatalog_eval.v1a finding'spathalready names the skill directory, so onlylineis added there.lineis no longer a required key of acli_output.v1finding (catalog check --jsonandcatalog eval --jsonomit it when null); other commands still writeline: null.Testing
python -m pytest -q -p no:cacheprovider testsgives 29829 passed and 1 failed:tests/test_repo_compare_interval.py::test_the_row_p_places_zero_where_large_deltas_round_p_at_zero_apart, a numeric test inrepo comparethat this change does not touch.tests/test_growth_ratchet.pyandruff checkon the changed files pass.Open questions
See the decisions: the
lineof a link or path is the first line ofSKILL.mdthat holds it, and the fixture scripts and thehidden-unicodeskill are written by the test.lineof a link or backticked path is the first line ofSKILL.mdthat holds it, andpath-missingis located by its first quoted word over Carrying the exact match offset out oflink_pieces: smallest change; the offset is not returned by the existing scanners. Is that the behaviour you want?catalog_eval.v1onlylineis added, because a finding'spaththere already names the skill directory over Reusingpathfor the bundled file in that schema: it would change the meaning of a required key;scriptalready carries the bundled path there. Is that the behaviour you want?script-crlf,script-lint,script-syntax) are written by the test, not shipped, andscript-lintis not required because it needsrufforshellcheckon the PATH over Shipping them undertests/fixtures/finding_codes: a shipped broken.pyfails the project's ownruff checkand the licence header check. Is that the behaviour you want?SKILL.mdfiles carry the licence header as an HTML comment in the body over Adding the directory to.github/.licenserc.yaml: no change outsidedokimi/. Is that the behaviour you want?hidden-unicodefixture is built by the test withchr(0x200B), not committed over Committing the raw zero width space: a reviewer cannot see it in a diff. Is that the behaviour you want?fastcontextdescription was left as it is over Adding awhenclause todata/skills/fastcontext, which scenario 4 mentions in passing: the maintainer's decision for scenario 4 lists only the fixture catalog and its test, and the bundled skill text is measured by the evaluation arms. Is that the behaviour you want?Revert
A plain revert removes the fields and restores the old messages; rows already written with
lineorpathstay valid, as consumers ignore unknown keys.Checklist
pytestpassesruff,mypy, and schema checks passAGENTS.mdraise/exit and test names the doc, contract or issue it traces to.github/.licenserc.yaml)Related issues:
commands/catalog.py,external/validate.py); it is closed, and adding optional finding keys does not change its listing counts.path-missingcode anddocs/finding-codes.md; the new fix clause andlinemust not change when the finding fires.scriptkey;pathshould follow the same present-only-when-set rule and agree with it.--fail-on-codebehaviour.pathandlinemust keepfileas SKILL.md.Existing assertions this changes, each for a scenario of the issue:
dokimi/tests/test_catalog_output_docs.py:65: scenario 2, Allows optional line/path fields while retaining the three required finding fields and rejecting unrelated keys.dokimi/tests/test_catalog_path_missing.py:221: scenario 6, Updates the exact wording assertion to include the imperative required by scenario 1.dokimi/tests/test_catalog_path_missing.py:226: scenario 6, Preserves the backtick quoting check while updating the exact wording for the required imperative.Review points edit lines of recent commits:
dokimi/dokimi/schemas/cli_output.v1.json(7125813 feat(report): one summary over cli_output.v1 documents, the leaves it ). Each commit's own tests still pass; none of their assertions changes except those listed above for a scenario of the issue.Checklist evidence
pytestpasses: 35 test file(s) changed; suite: 34141 passed; 1 failing test(s) fail on the base branch too: tests/test_repo_compare_interval.py::test_the_row_p_places_zero_where_large_deltas_round_p_at_zero_apart; 15 of 15 proof(s) fail before the changeruff,mypy, and schema checks pass: passed: ci.yml:static / ruff check, ci.yml:typecheck / mypy, ci.yml:static / schema-check, ci.yml:static / schema_compat vs the PR basedokimi/docs/catalog-jsonl.md,dokimi/tests/fixtures/finding_codes/allowed-tools-unknown/SKILL.md,dokimi/tests/fixtures/finding_codes/allowed-tools-unrestricted-bash/SKILL.md,dokimi/tests/fixtures/finding_codes/body-too-large/SKILL.md,dokimi/tests/fixtures/finding_codes/bundle-file-unreferenced/SKILL.mdAGENTS.md: nothing left open; mutation of changed lines ranraise/exit and test names the doc, contract or issue it traces to: every new error path and test names a doc, contract or issue.github/.licenserc.yaml): every new source file carries the headerFixes #942.