Repository navigation
fix(catalog): a <...> URL keeps its pipe and a destination its spaces; pin the bracket counter - #752
Open
antonwolfy wants to merge 4 commits into
Open
antonwolfy wants to merge 4 commits into
antonwolfy wants to merge 4 commits into
Conversation
…; pin the bracket counter Settles two review points of intel#459 (T11.2 and T13.2). The end-of-URL scan cut every URL at a `|`, so `<https://acme.dev/a|b>` was probed as `https://acme.dev/a`. A delimited URL (an autolink or a `<...>` destination) now ends at its `>` only; the undelimited case still ends at a pipe. In a table row (a line that starts with `|`) an unescaped pipe still ends the URL, because a GFM table splits its row at it before it reads links. A `<...>` destination may hold spaces under CommonMark: `[a](<https://acme.dev/x y>)` was cut at the space and `/x` was probed. It is now read up to its `>` and httpx requests `/x%20y`. An autolink holds no space and is unchanged. Tests pin both and the table-row choice, and `[see https://acme.dev/a[b]c] for more` kills the mutant that drops `brackets -= 1`. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 2 selected item(s). CI at Review details
|
exai-bot
reviewed
Nov 14, 2026
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #752 +/- ##
=======================================
Coverage 95.71% 95.72%
=======================================
Files 414 415 +1
Lines 55310 55369 +59
Branches 9509 9518 +9
=======================================
+ Hits 52941 53000 +59
Misses 1466 1466
Partials 903 903
🚀 New features to boost your workflow:
|
Settles the review point that `.rstrip()` cut the trailing space of `[a](<https://acme.dev/x >)`, so `/x` was probed instead of `/x%20`. The destination is now taken up to its `>` as written. Tests cover the extraction, the request, and the unclosed `<` fallback branch that codecov reported as partial. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
exai-bot
reviewed
Nov 14, 2026
… destination Review point 4575431969: the scan for a "<...>" destination stopped at any ">" and refused any "<", so "[a](<https://acme.dev/x y\>z>)" was probed as "/x y\" instead of "/x%20y%3Ez", and an escaped "<" left the destination unscanned. The scan now reads a backslash escape of ASCII punctuation as one unit, keeping the original text so that _clean_url decodes it. The test covers extraction of both escapes and the request the transport sees. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
`[a](<https://acme.dev/x\<z>)` extracted nothing: the template guard saw the `<` after the match before the angle scan ran. The guard now runs after the scan and ignores a destination the scan closed at its `>`. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
Contributor
|
Pushed 1 commit to
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to the review of #459, where two points were left open: a delimited URL is cut at
|and at a space, and no test pins the bracket counter (T11.2, T13.2).On
main,extract_urls("<https://acme.dev/a|b>")gives['https://acme.dev/a']andextract_urls("[a](<https://acme.dev/x y>)")gives['https://acme.dev/x'], although the punctuation of an autolink or a<...>destination is part of the URL, and the probe requests the wrong page. Replacingbrackets -= 1withpassin_clean_urlpasses the whole suite.Changes
dokimi/dokimi/external/online_checks.py: in_clean_url, adelimitedURL (an autolink or a<...>destination) ends at its>only, so a|inside it stays. The undelimited case still ends at|.|before it reads links, and extraction sees the row as one text. A line that starts with|is therefore passed astable_row, and there an unescaped pipe still ends a delimited URL (| <https://acme.dev/a|b> | x |giveshttps://acme.dev/a). A table without a leading pipe is not detected._distinct_urlsreads a<...>link destination up to its>, blanks included (a trailing one too);[a](<https://acme.dev/x y>)is requested ashttps://acme.dev/x%20y(httpx encodes the space). An autolink holds no space under CommonMark and is unchanged. A backslash-escaped>or<(any backslash escape of ASCII punctuation) does not end or stop the scan:[a](<https://acme.dev/x y\>z>)is requested ashttps://acme.dev/x%20y%3Ez.dokimi/tests/test_catalog_online.py: the pipe in an autolink and in a destination, the table-row cases, the spaced destination with a mocked transport that sees/x%20yonly, and[see https://acme.dev/a[b]c] for more, which pinsbrackets -= 1.Risk
A URL in
<...>that holds a|, or a<...>destination that holds a space or an unmatched)/], is now probed whole instead of cut. A skill that has such a link gets its real target checked, so alink-deadcan appear or go. Nothing else changes: the docs do not say where a URL ends, so none changed.Testing
On a Linux review host, at
213e757(onmainb4bcfa4):make ci-local: 33 passed, 0 failed, 14 skipped (job conditions, no semgrep or micromamba, other-Python legs). 20402 tests passed, 19 skipped; the coverage of changed lines step passed.mainprints['https://acme.dev/a'] ['https://acme.dev/x']; this branch gives['https://acme.dev/a|b'] ['https://acme.dev/x y'].main's code: the pipe test and the spaced-destination test fail.brackets -= 1→passfailstest_an_unbalanced_closing_bracket_ends_the_url_after_a_balanced_pair; droppingtable_rowfrom the pipe condition failstest_a_pipe_in_an_angle_delimited_url_is_part_of_it_outside_a_table_row; not reading the angle destination to its>failstest_an_angle_destination_keeps_its_spaces_and_is_probed_with_the_path_encoded. The bracket test passes onmain: it pins behaviour that already held.<...>is kept:extract_urls("[a](<https://acme.dev/x >)")gives['https://acme.dev/x ']and the probe requests/x%20; with.rstrip()restored the spaced-destination test fails. An unclosed[a](<https://acme.dev/x y)falls back to the bare URLhttps://acme.dev/x, which covers the branch codecov reported as partial.<...>destination:extract_urlsgives['https://acme.dev/x y>z']for[a](<https://acme.dev/x y\>z>)and['https://acme.dev/x y<z']for the\<form, and the mocked transport sees/x%20y%3Ezonly. With the previous scan the same test fails (/x y\was read).Revert
A plain revert restores the cut at
|and at a space. Nothing is stored.Checklist
pytestpassesruff,mypy, and schema checks passAGENTS.md.github/.licenserc.yaml)