Skip to content

feat(catalog): add line and path to findings, state the fix - #1324

Merged
xaleryb merged 10 commits into
intel:mainfrom
vchamarthi:issue-942-catalog-check-finding-guidance-source-3
Nov 28, 2026
Merged

xaleryb merged 10 commits into
intel:mainfrom
vchamarthi:issue-942-catalog-check-finding-guidance-source-3

Conversation

@vchamarthi

Copy link
Copy Markdown
Contributor

Summary

Fixes #942. catalog check findings now carry an optional line and path, and 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. Scenarios 3 and 5 were fixed by #1050 and scenario 7 by docs/finding-codes.md.

Changes

  • Finding has optional line and path; they go into the --format json row, the --jsonl row and cli_output.v1 subjects only when set (dokimi/external/findings.py, dokimi/cli_output.py).
  • line is set for body links and backticked paths (the first line holding them), for name, description and unknown frontmatter keys (the key's line); path is set for bundled script findings. install-unpinned stays one finding with no line.
  • cli_output.v1.json gains an optional path, catalog_eval.v1.json an optional line; docs/catalog-jsonl.md and a changelog fragment describe them.
  • New tests/fixtures/finding_codes and tests/test_catalog_finding_locations.py; the two exact-wording assertions of path-missing and the key set in tests/test_catalog_output_docs.py were updated.
  • --json subjects leave out a null line, so line is no longer required in cli_output.v1.json; body lookups start after the frontmatter; quoted frontmatter keys are found; the path-missing path is read from its repr.
  • Link lookups match (link) before any prefix, a path-missing finding is located by the code span as written, a leading BOM is skipped, and name-missing has the line of an empty name: 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 see line and path. In catalog_eval.v1 a finding's path already names the skill directory, so only line is added there. line is no longer a required key of a cli_output.v1 finding (catalog check --json and catalog eval --json omit it when null); other commands still write line: null.

Testing

python -m pytest -q -p no:cacheprovider tests gives 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 in repo compare that this change does not touch. tests/test_growth_ratchet.py and ruff check on the changed files pass.

Open questions

See the decisions: the line of a link or path is the first line of SKILL.md that holds it, and the fixture scripts and the hidden-unicode skill are written by the test.

  • I chose line of a link or backticked path is the first line of SKILL.md that holds it, and path-missing is located by its first quoted word over Carrying the exact match offset out of link_pieces: smallest change; the offset is not returned by the existing scanners. Is that the behaviour you want?
  • I chose In catalog_eval.v1 only line is added, because a finding's path there already names the skill directory over Reusing path for the bundled file in that schema: it would change the meaning of a required key; script already carries the bundled path there. Is that the behaviour you want?
  • I chose The script fixtures (script-crlf, script-lint, script-syntax) are written by the test, not shipped, and script-lint is not required because it needs ruff or shellcheck on the PATH over Shipping them under tests/fixtures/finding_codes: a shipped broken .py fails the project's own ruff check and the licence header check. Is that the behaviour you want?
  • I chose The fixture SKILL.md files carry the licence header as an HTML comment in the body over Adding the directory to .github/.licenserc.yaml: no change outside dokimi/. Is that the behaviour you want?
  • I chose The hidden-unicode fixture is built by the test with chr(0x200B), not committed over Committing the raw zero width space: a reviewer cannot see it in a diff. Is that the behaviour you want?
  • I chose The fastcontext description was left as it is over Adding a when clause to data/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 line or path stay valid, as consumers ignore unknown keys.

Checklist

  • Tests added/updated and pytest passes
  • 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)

Related issues:

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
  • Tests added/updated and pytest passes: 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 change
  • ruff, 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 base
  • Docs updated (or N/A): updated: dokimi/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.md
  • Self-reviewed per "Before opening a PR" in AGENTS.md: nothing left open; mutation of changed lines ran
  • Each new raise/exit and test names the doc, contract or issue it traces to: every new error path and test names a doc, contract or issue
  • No ad-hoc run artifacts committed: 35 added file(s), none a run's output
  • New files carry the SPDX license header (or are exempt in .github/.licenserc.yaml): every new source file carries the header

Fixes #942.

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>
@vchamarthi
vchamarthi requested a review from a team as a code owner November 27, 2026 01:28
Copilot AI balanced review requested due to automatic review settings November 27, 2026 01:28
@exai-bot

exai-bot commented Nov 27, 2026 •

Copy link
Copy Markdown

✅ OpenCodeReview: Found nothing that must be fixed in this commit.

CI at a187b8f: 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.

Other findings not posted (3)

2 should fix, 1 not shown by a run

Review details
  • Commit reviewed: a187b8f against merge base ce3fd9f
  • Coverage: 2 files in 1 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 375k tokens (291k from cache), 1m16s
  • Tool calls: 22 (13 file_read, 3 code_comment, 3 code_search, 2 local_check_results, 1 ci_log_search)
  • small change set: 2 files

Comment thread dokimi/dokimi/external/validate.py Resolved
@codecov-commenter

codecov-commenter commented Nov 27, 2026 •

Copy link
Copy Markdown

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

Codecov Report

❌ Patch coverage is 98.72611% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.21%. Comparing base (1673824) to head (a187b8f).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
dokimi/dokimi/external/finding_lines.py 96.87% 1 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
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     
Files with missing lines Coverage Δ
dokimi/dokimi/cli_output.py 100.00% <100.00%> (ø)
dokimi/dokimi/commands/catalog.py 99.08% <100.00%> (ø)
dokimi/dokimi/commands/catalog_eval.py 98.87% <ø> (ø)
dokimi/dokimi/commands/catalog_scan.py 97.34% <100.00%> (+<0.01%) ⬆️
dokimi/dokimi/eval/plugin_delta.py 92.94% <100.00%> (ø)
dokimi/dokimi/external/bundle_findings.py 100.00% <100.00%> (ø)
dokimi/dokimi/external/bundle_paths.py 100.00% <ø> (ø)
dokimi/dokimi/external/catalog_eval_inventory.py 88.33% <100.00%> (+0.04%) ⬆️
dokimi/dokimi/external/findings.py 100.00% <100.00%> (ø)
dokimi/dokimi/external/script_checks.py 93.04% <ø> (ø)
... and 3 more

... and 23 files with indirect coverage changes

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

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.

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
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 / path to 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

Comment thread dokimi/dokimi/external/finding_lines.py Resolved
Comment thread dokimi/dokimi/external/findings.py Resolved
Comment thread dokimi/dokimi/external/validate.py Resolved
Comment thread dokimi/dokimi/external/validate.py Outdated
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")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor Author

This is ready for another look: I've pushed 3 commits on issue-942-catalog-check-finding-guidance-source-3 (cdbefde..44a4bba).

Changes:

  • plugin_delta pairs unseeded runs whose dropped seed_requested values differ.

Exai-bot's comment:

  • Covered by the fix to the first thread: the earliest line across link forms is used.

Threads:

  • I answered each one in its thread: 4 fixed, 1 not a defect.

Not caused by this PR:

  • Outside the PR: dokimi/dokimi/eval/plugin_delta.py:72; _validate_run_config compares seed_requested, so two unseeded arms with seed_requested 1 and 2 raise cannot compute plugin delta across different seed_requested: 1 vs 2, although the docs allow different seed values.
  • Outside the PR: dokimi/dokimi/commands/repo.py:215; _budget_step builds ['dokimi','repo','budget','-repo'] for the source -repo, with no -- before it, so argparse rejects the suggested command.

What I checked on the new commit:

  • 4 of 5 new tests fail before the fix and pass after it; the other passes before the fix too, so it guards the change rather than reproduce a bug.
  • The full test suite passes with main merged in (37,525 tests), apart from 1 failure main has too.
What each test shows
  • a reference definition above an inline link gives the earlier line: fails before, passes after.
  • an indented frontmatter is found: fails before, passes after.
  • locate keeps falsy values: fails before, passes after.
  • several unknown keys carry no line: fails before, passes after.
  • unseeded runs with different seed_requested pair: passes before the fix too.
  • Also changed, outside the PR's files: dokimi/dokimi/eval/plugin_delta.py.

Comment thread dokimi/dokimi/external/finding_lines.py Resolved
Comment thread dokimi/dokimi/external/finding_lines.py Resolved
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>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

This is ready for another look: I've pushed 1 commit on issue-942-catalog-check-finding-guidance-source-3 (44a4bba..e1af73d).

Changes:

  • A reference definition is located at its own line, not at one whose destination only starts with it.
  • A padded first link is located as the first occurrence.
  • A destination in angle brackets ends only at >, so it is not taken for a shorter link.
  • Parenthesised prose is not taken for a link: an inline form needs ]( and a reference needs a label at line start.

Threads:

  • I answered each one in its thread: 3 fixed.

What I checked on the new commit:

  • 3 of 5 new tests fail before the fix and pass after it; the other 2 pass before the fix too, so they guard the change rather than reproduce a bug.
  • The full test suite passes with main merged in (37,630 tests), apart from 1 failure main has too.
What each test shows
  • reference prefix collision: fails before, passes after.
  • two reference definitions: fails before, passes after.
  • padded first link: fails before, passes after.
  • angle-bracketed destination with a space: passes before the fix too.
  • parenthesised prose: passes before the fix too.

Comment thread dokimi/dokimi/external/finding_lines.py Resolved
Comment thread dokimi/dokimi/external/finding_lines.py Resolved
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>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

This is ready for another look: I've pushed 1 commit on issue-942-catalog-check-finding-guidance-source-3 (e1af73d..3517346).

Threads:

  • I answered each one in its thread: 2 fixed.

What I checked on the new commit:

  • 3 of 4 new tests fail before the fix and pass after it; the other passes before the fix too, so it guards the change rather than reproduce a bug.
  • The full test suite passes with main merged in (37,714 tests), apart from 1 failure main has too.
What each test shows
  • blockquoted definition is located at its own line: fails before, passes after.
  • multiline inline link is located at its destination line: fails before, passes after.
  • an unfinished opener does not capture text across a blank line: passes before the fix too.
  • an opener does not continue into a blockquote: fails before, passes after.

Comment thread dokimi/dokimi/external/finding_lines.py Outdated
import re
from typing import Optional

_BLOCKQUOTE = re.compile(r"^(?: {0,3}>)+ ?")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

bug · should fix
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

Comment thread dokimi/dokimi/external/finding_lines.py Outdated
lines = _lines(text)
end = _frontmatter_end(lines)
first = 0 if end is None else end + 1
body = _unquoted(lines[first:])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

bug · should fix
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

Comment thread dokimi/dokimi/external/finding_lines.py Outdated
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]|$))",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

bug · should fix
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

@xaleryb

xaleryb commented Nov 28, 2026

Copy link
Copy Markdown
Contributor
  • Ran: head 3517346 merged with main 8d9d1ea, catalog check --format json, each skill with 4 frontmatter lines.
  • Name advice loops: directory Bad_Name with no name -> add 'name: Bad_Name' -> name-format; then name: bad-name -> name-mismatch ... or set name to 'Bad_Name', which returns to name-format. Directory a with name: A_b -> rename the directory to 'A_b'. Expected: offer a name only when it passes NAME_PATTERN and NAME_MAX, otherwise ask for one kebab-case name for both. Then every stated edit ends with no name-* error.
  • Fenced copy first: a fenced [g](missing.md) on line 7 and the real link on line 10 -> line 7, expected 10. A fenced scripts/missing.py on line 6 and the real span on line 9 -> path-missing 6, expected 9. The check skips fenced code, but link_line/text_line search it. Expected: search only the lines outside_fences keeps, with their source indices.
  • U+2028 or a form feed on line 5 and a link on line 7 -> line 8, expected 7. _lines uses str.splitlines; splitting on \r\n|\r|\n fixes it.
  • No commits from us: the head moved during this round.

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

xaleryb commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Pushed four commits on top of 3517346:

  • 4699067: finding lines split only at CR LF, CR and LF; str.splitlines also split at U+2028, form feed and the like, so every later line was off by one.
  • 6c5da1e: name-missing and name-mismatch offer a name only when it passes NAME_PATTERN and NAME_MAX, otherwise they ask for one kebab-case name for both; a test follows every offered edit and asserts no state repeats.
  • ce3fd9f: link_line and text_line search only the lines outside_fences keeps (new fenced_view, mapped back to file lines), so a fenced copy no longer takes the line; this replaces _unquoted and also drops a tab after >. docs/catalog-jsonl.md updated.
  • a187b8f: an inline link counts only when its ) comes before the paragraph ends, so an unclosed > [q]( no longer takes the line of [real] (the finding_lines.py:92 thread); the second assertion of test_an_opener_does_not_continue_into_a_blockquote encoded that bug and now closes [q].

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

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.

@xaleryb
xaleryb merged commit 0475c44 into intel:main Nov 28, 2026
25 checks passed
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.

catalog check finding guidance, source locations and automation gates

5 participants