Skip to content

fix(catalog): path-missing skips code spans in URL link labels (#1089) - #1092

Merged
vchamarthi merged 12 commits into
intel:mainfrom
vchamarthi:issue-1089-catalog-check-flags-upstream-example
Nov 25, 2026
Merged

vchamarthi merged 12 commits into
intel:mainfrom
vchamarthi:issue-1089-catalog-check-flags-upstream-example

Conversation

@vchamarthi

Copy link
Copy Markdown
Contributor

Summary

path-missing was reported for [examples/a.py](https://...): the label is the link's text, not a bundled file. link_pieces now skips code spans in the label of a link whose destination has a URL scheme. Refs #1089.

Changes

  • _external_labels in skill_markdown.py finds the labels of inline links, and of full reference links whose definition is a URL, with a URL destination. A label that holds another link is not one.
  • link_pieces leaves code spans inside them out of spans.
  • Tests in tests/test_catalog_path_missing.py and a changelog fragment.
  • docs/external-content.md says a code span in a URL link label is not checked.
  • The first definition of a reference label decides; an undefined reference is text.

Risk

Only code spans in labels of URL links change. Labels of local links and spans outside links are checked as before. path-escapes-skill reads the same spans and gets the same change.

Testing

python -m pytest -q -p no:cacheprovider tests/test_catalog_path_missing.py tests/test_growth_ratchet.py tests/test_catalog_bundle_unreferenced.py tests/test_catalog_validate.py: 354 passed. python -m ruff check on the two changed .py files: passed. Cases cover inline and reference URL labels, a label holding a link, and local links, which are still reported.

Open questions

  • I chose Skip code spans in labels of links whose destination has a URL scheme, in link_pieces over Filtering in path_missing: docs/external-content.md says a link is judged by its destination; one place fixes every span-based check. Is that the behaviour you want?
  • I chose Skip only full reference links [a][ref] whose definition is a URL over Also collapsed [a][] and shortcut [a]: Their key is the label text, blanked when it holds a code span; smallest change. Is that the behaviour you want?

Revert

Plain revert of the commit. Nothing is stored.

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)
Checklist evidence
  • Tests added/updated and pytest passes: 1 test file(s) changed; suite: 24535 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; 1 of 1 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/external-content.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: 1 added file(s), none a run's output
  • New files carry the SPDX license header (or are exempt in .github/.licenserc.yaml): no new source file

Refs #1089.

…#1089)

A code span used as the label of a link to a URL, such as
[`examples/a.py`](https://...), was read as a bundled file and reported
as path-missing. link_pieces now leaves such labels out of the spans;
labels of local links and spans outside links are checked as before.

Refs intel#1089

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@codecov-commenter

codecov-commenter commented Nov 22, 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 95.39474% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.10%. Comparing base (c4312e1) to head (2a902a5).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
dokimi/dokimi/external/skill_markdown.py 95.30% 3 Missing and 4 partials ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1092      +/-   ##
==========================================
+ Coverage   96.07%   96.10%   +0.02%     
==========================================
  Files         475      481       +6     
  Lines       62973    63839     +866     
  Branches    10903    11072     +169     
==========================================
+ Hits        60500    61350     +850     
- Misses       1525     1532       +7     
- Partials      948      957       +9     
Files with missing lines Coverage Δ
dokimi/dokimi/external/link_files.py 100.00% <100.00%> (ø)
dokimi/dokimi/external/skill_markdown.py 97.73% <95.30%> (-2.27%) ⬇️

... and 32 files with indirect coverage changes

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

- notes.md:42 is a local file with a line, not a URL scheme
- a defined [x] or [x][] inside a label counts as a link, so the label is text
- a definition with trailing text is not a definition

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi
vchamarthi marked this pull request as ready for review November 22, 2026 12:31
@vchamarthi
vchamarthi requested a review from a team as a code owner November 22, 2026 12:31
Copilot AI balanced review requested due to automatic review settings November 22, 2026 12:31
@vchamarthi

Copy link
Copy Markdown
Contributor Author

Ready for re-review: 1 commit on issue-1089-catalog-check-flags-upstream-example (7f51598..13a0669).

Changes:

  • _SCHEME_RE no longer matches a name followed by digits only, so notes.md:42 stays a local link.
  • _SCHEME_RE rejects a dotted name followed by digits only, so notes.md:42 stays a local link while tel:1234567890 stays a URL.
  • A defined shortcut or collapsed reference inside a label counts as a link in the nesting check.
  • _DEFINITION_RE accepts only a destination and an optional title.

Checked on the new head: 3 of 3 tests fail before the fix and pass after; full suite with main merged in: 24678 passed, 1 failure that main has too.

What each test shows
  • line suffix stays local: fails before, passes after.
  • shortcut/collapsed link nests: fails before, passes after.
  • trailing text rejects definition: fails before, passes after.
  • tel link with digits is a URL: passes.
  • angle-bracket definition with a space is a URL definition: passes.
  • multi-line title keeps the URL definition: passes.

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

Unresolved link-classification and reference-definition bugs suppress genuine missing-path warnings or retain false ones, while nested-link detection introduces quadratic processing costs.

4 open issues
What changed in this PR

4 new findings.

This PR addresses #1089 by excluding code spans in external URL link labels from catalog path checks, so upstream example names are not treated as bundled files.

Changes:

  • Detects URL labels in inline and full reference links and filters their code spans.
  • Adds regression cases for URL labels, local links, reference definitions, and nested links.
  • Documents the behavior and adds a changelog entry.
File Description
dokimi/​tests/​test_catalog_path_missing.py Adds regression coverage for link-label filtering.
dokimi/​dokimi/​external/​skill_markdown.py Detects external link labels and excludes their code spans.
dokimi/​docs/​external-content.md Documents the URL-label exception to path checks.
dokimi/​changelog.d/​20261121_120000_path-missing-url-label.md Records the catalog warning fix.

Review effort: Balanced

@exai-bot

exai-bot commented Nov 22, 2026 •

Copy link
Copy Markdown

OpenCodeReview: Commit 2a902a5 was not reviewed. This PR has reached its review limit (6 reviews).

CI at `2a902a5`: 5 still running, 16 passing, 3 skipped
Check Status
Mutation of changed lines still running
Test Linux Python 3.14 still running
Test Linux Wheels Python 3.14 still running
Tests (py3.14) still running
Windows smoke test (py3.13) still running

To review this commit: re-request review from exai-bot in the Reviewers list.

Last review (2296544): 1 medium

Open threads from the bot: 0

- A destination is a URL by the rule `_file_ref` uses (`is_uri`), so
  `notes.md:main` stays a local file and `x:example` is a URI.
- A definition counts only at the start of a block, and a title that
  never closes makes it no definition.
  A thematic break between blocks does not hide the definition after it.
- A defined shortcut after an undefined full reference is a link.
- Link-shaped text in a destination or title is literal, and an escaped
  `!` is no image marker.
- Nesting and label lookups use one bracket pass and bisect, not a scan
  of every link per label.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

Ready for re-review: 1 commit on issue-1089-catalog-check-flags-upstream-example (13a0669..f7f7eb1).

Changes:

  • [scripts/deploy.sh](notes.md:main) is a local link and x:example a URI link.
  • [g]: https://example.com "unterminated defines nothing.
  • Ordinary paragraph.\n[guide]: https://example.com defines nothing.
  • A defined [guide] followed by an undefined [undefined] inside a URL label counts as a link.
  • "[guide](notes.md)" in an image title is literal; \![guide](notes.md) has an escaped bang.
  • Nested-link and code-span-in-label checks are no longer quadratic.
  • A definition after prose and a thematic break (***) counts as a definition.

Threads and comments:

  • 10 fixed; each answered in its thread.

Checked on the new head:

  • Not passed: 8 of 10 tests fail before the fix and pass after
  • Full suite with main merged in: 29021 passed, 1 failure that main has too
What each test shows
  • local link with line or symbol suffix: fails before, passes after.
  • URI schemes: fails before, passes after.
  • unterminated titles: fails before, passes after.
  • definition inside a paragraph: fails before, passes after.
  • linear time: fails before, passes after.
  • shortcut fallback: fails before, passes after.
  • image title: fails before, passes after.
  • escaped bang: fails before, passes after.
  • definition after a thematic break: passes before the fix too.
  • definition after prose and a thematic break: passes before the fix too.
  • Also changed, outside the PR's files: dokimi/dokimi/external/link_files.py.

@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: LOCAL (head f7f7eb1)

  • Contract: none
  • Responsibility: none
  • Dependency: none
  • Review depth: skim: local change, check diff + tests
  • Coverage gaps: none

A valid nested link with an empty destination can hide a missing script. I also reproduced the three existing findings for malformed reference syntax and escaped labels.

Ran 148 catalog path tests. Compared the new empty-destination case on both trees and checked its link structure with the CommonMark parser.

Still open on this head: T11, T12, T13.

…1089)

- A reference definition whose bare destination has unbalanced
  parentheses defines nothing.
- A defined shortcut after an invalid inline destination is a link.
- An escaped bracket in a reference label no longer reads as a space,
  so [g\]] is not [g].
- An empty inline destination, [notes](), counts as a link for nesting.
- A definition's destination, not its label, gets its escaped brackets
  back, so [g]: references/a\[b\].md names the file that exists and
  [g\]]: references/missing.md keeps its target.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

Ready for re-review, @napetrov: 1 commit on issue-1089-catalog-check-flags-upstream-example (f7f7eb1..a12ffab) answers your thread.

Changes:

  • A definition with an unbalanced bare destination no longer registers.
  • A defined shortcut after an invalid inline destination counts as a link in the label.
  • Escaped brackets keep their identity in reference labels.
  • An empty inline destination is a link for the nesting check.
  • A reference definition's destination gets its escaped brackets back.
  • Only the destination of a definition is unmasked, so an escaped bracket in its label does not make the splitter drop it.

Threads and comments:

  • 4 fixed; each answered in its thread.

Checked on the new head:

  • Not passed: 5 of 7 tests fail before the fix and pass after
  • Full suite with main merged in: 29288 passed, 1 failure that main has too
What each test shows
  • test_1089_a_definition_with_unbalanced_parentheses_is_no_definition: fails before, passes after.
  • test_1089_a_defined_shortcut_after_an_invalid_inline_destination_is_a_link: fails before, passes after.
  • test_1089_a_definition_label_with_an_escaped_bracket_does_not_define_the_plain_label: fails before, passes after.
  • test_1089_a_reference_use_with_an_escaped_bracket_does_not_use_the_plain_label: fails before, passes after.
  • test_1089_a_link_with_an_empty_destination_in_a_label_means_the_label_is_no_link: fails before, passes after.
  • test_1089_a_reference_definition_with_escaped_brackets_names_its_file: passes before the fix too.
  • test_1089_a_definition_with_an_escaped_bracket_in_its_label_names_its_file: passes before the fix too.

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…el#1089)

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
intel#1089)

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

@vlad-perevezentsev vlad-perevezentsev 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.

🟢 LGTM · checked 406961b · nothing required from @vchamarthi

🔀 Merge: safe now · merges cleanly into current main, 34 commits behind, its tests pass on the merge · after it, #1118 needs a rebase (external/skill_markdown.py)

✅ make ci-local --offline: 24,490 passed · ⚠️ schema_compat fails from the base (novelty, repo_event), not from this PR · ✅ both new tests fail at a12ffab · ✅ "---\n[x\n" * 8000: 0.06 s, was 0.98 s

Inline and full-reference URL labels are skipped, and every earlier bot and reviewer case keeps its test.

Fixed in this branch, up to 406961b:

  • Unclosed labels after --- were parsed in quadratic time: d901862 caps a definition label at 999 characters, as CommonMark does.
  • Labels that are only code spans shared one key: bdf1a19 reads reference keys from the paragraph as written.
  • The docs promised every link to a URL: 2a35120 names the inline and full-reference forms; shortcut and collapsed ones are still checked.

napetrov
napetrov previously approved these changes Nov 24, 2026

@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: LOCAL (head 406961b)

  • Contract: none
  • Responsibility: none
  • Dependency: none
  • Review depth: skim: local change, check diff + tests
  • Coverage gaps: none

The empty inner link now prevents an enclosing URL from hiding a missing script. Checked the prior malformed-destination, shortcut-fallback and escaped-label cases in the implementation and focused path tests. Complexity checks were reviewed statically.

Coverage: 59 passed, 102 deselected in 1.07s. CI reported no failing or pending jobs on 406961be7.

@napetrov
napetrov dismissed their stale review November 24, 2026 05:22

The reviewed change passes its focused checks. This branch conflicts with current main in dokimi/dokimi/external/skill_markdown.py. Please resolve the conflict so the combined change can be reviewed.

Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com>
_bracket_pairs walked every character of a paragraph in Python, so
link_pieces grew faster than the code span scan on texts of long runs
(test_runs_with_no_closer_are_read_in_linear_time[skill_markdown-*]).
It now visits only the brackets.

Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

🟢 Ready for re-review · 2 commits on issue-1089-catalog-check-flags-upstream-example (406961b..f6ef580)

Next: @napetrov, @vlad-perevezentsev: re-review the new head.

Changes

  • _bracket_pairs in skill_markdown.py visits only the [ and ] characters instead of every character.

Verified on the new head: ✅ 1/1 tests fail before the fix, pass after · ✅ full suite with main merged in: 30801 passed · ✅ second reader: nothing raised · ⚠️ 1 test removed or renamed

What each test shows
  • link_pieces reads long backtick runs in linear time: fails before, passes after.
  • path-missing tests of both sides pass after the merge: passes.
  • Removed or renamed tests: test_repo_validate_out_writes_the_report.
  • Left to GitHub's own checks: agent-quality.yml:external-catalog-smoke, ci.yml:static / pre-commit, ci.yml:static / Install gitleaks, ci.yml:static / Scan commits, ci.yml:fidelity / Install the pinned Claude Code, ci.yml:test-latest, ci.yml:test-seeds, ci.yml:package-smoke.

…does (intel#1089)

A reference label with an unescaped bracket or only spaces, and a
definition title with an escaped delimiter, were misread as URL
links or definitions. A thematic break now ends the paragraph, so a
label cannot close across it.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

Ready for re-review: 1 commit on issue-1089-catalog-check-flags-upstream-example (f6ef580..2296544).

Threads and comments:

  • 4 fixed; each answered in its thread.

Checked on the new head: 2 of 2 tests fail before the fix and pass after; full suite with main merged in: 31407 passed, 1 failure that main has too.

What each test shows
  • malformed labels, a thematic break, a file with a line suffix, nested references and trailing definition text keep the span checked: fails before, passes after.
  • a definition title may hold an escaped delimiter: fails before, passes after.

…intel#1089)

A '[ ]: url' line was skipped as a rejected definition but the scan went on
as at a block start, so a following '[g]: url' registered and hid a missing
script in '[`scripts/deploy.sh`][g]'. Take the ordinary-line branch.
Tests also pin the line-suffix, nested shortcut and trailing-text inputs.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

Ready for re-review: 1 commit on issue-1089-catalog-check-flags-upstream-example (2296544..2a902a5).

Changes:

  • A definition line with a blank label ends definition collection for its paragraph.

Threads and comments:

  • 1 fixed; each answered in its thread.

Checked on the new head: 1 of 1 tests fail before the fix and pass after; full suite with main merged in: 31511 passed, 1 failure that main has too.

What each test shows
  • Missing span is reported after a blank-label line and a following definition: fails before, passes after.

@vchamarthi
vchamarthi merged commit 6c8434e into intel:main Nov 25, 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.

6 participants