Repository navigation
Description
Finding
PR #3746 added inline code-span tracking to protect_newline_destinations so a destination-shaped string inside a closed code span is not protected. The tracking has no reset: a backtick run opens a span that only an equal-length run closes, and the state is carried across blank lines, headings, and every other block boundary to the end of the document. In CommonMark an unmatched backtick run is literal text, not a code span — so after any stray/unmatched backtick in prose (a common typo in notes), the scanner believes the rest of the document is code, and every genuine newline destination after it silently loses protection. That is the exact load/save corruption the protection exists to prevent, reintroduced for a whole class of real documents.
Evidence
- Source PR: fix(id/web): newline-destination protection skips literal code contexts (#1707) #3746 (merged, merge commit
40f561e8a69d6c272bc2a099e1690de756802714) — "fix(id/web): newline-destination protection skips literal code contexts (id(web): #1543's newline-destination protection rewrites literal code text (code spans, indented blocks, long fences) and joins destinations across whitespace blank lines #1707)". id(web): #1543's newline-destination protection rewrites literal code text (code spans, indented blocks, long fences) and joins destinations across whitespace blank lines #1707 is CLOSED; dedupe searches (protect_newline_destinations, "newline destination backtick span", "unmatched backtick") return no covering issue. - Current main
2aca793a345a88b2f11a815fc190da4df07e0ee0,pkgs/id/src/web/markdown.rs::2444fn protect_newline_destinations:2469let mut span: Option<usize> = None;— the only span state; nothing in the function ever resets it at a blank line or block boundary.:2514protection is gated onspan.is_none().:2573-2575a backtick run setsspan = Some(n)when none is open and clears it only on a run of exactly the same length.
- Probe (this run): a faithful line-for-line Python port of the function as on current main, run twice with identical results:
- Control
"[x](<a\nb>)\n"→ protected, token issued. - Closed span
"`[x](<a\nb>)`\n"→ not protected (the intended id(web): #1543's newline-destination protection rewrites literal code text (code spans, indented blocks, long fences) and joins destinations across whitespace blank lines #1707 behaviour). "the \foo flag does x\n\nx\n"` (one stray backtick, destination in a later paragraph) → not protected.- Same-paragraph stray backtick and a stray double-backtick run → also not protected.
- Control
- PR fix(id/web): newline-destination protection skips literal code contexts (#1707) #3746's own test (
test_newline_destination_protection_skips_literal_contexts) pins only a properly closed span, fences, and indented blocks; no unmatched-run case is covered.
Why it matters
The id web editor's notes are exactly the kind of prose that accumulates a stray backtick. From that character on, every link or reference definition whose destination contains a newline is parsed without the token protection, so its URL is handled by comrak's default path instead of the round-trip-safe one — silent link corruption on load/save for the remainder of the document, with no error anywhere.
Acceptance criteria
- A document containing an unmatched backtick run still gets newline-destination protection for genuine destinations after it (span state ends at the paragraph/block boundary at the latest, matching CommonMark's treatment of an unclosed span as literal text).
- The id(web): #1543's newline-destination protection rewrites literal code text (code spans, indented blocks, long fences) and joins destinations across whitespace blank lines #1707 cases still pass: destinations inside properly closed inline spans, fences, and indented blocks remain unprotected.
- A regression test pins the unmatched-backtick case (same-paragraph and later-paragraph destinations).
Activity
developing-today commentedon Nov 8, 2026
CODE-2272
dezren39 commentedon Nov 9, 2026
🤖 Agent note · handed off
opencode(lane row 5542, no session bound), so this lane handed it off per runbook §1b and did not work it itself.handed_offand parked task 13151 for 1200s. Labels synced to the parked set on issue id(web/markdown): #3746's code-span tracking never resets — one unmatched backtick disables newline-destination protection for the rest of the document #7557.35 remaining items
dezren39 commentedon Nov 9, 2026
Agent note pr_opened task 14420 lane code-p (resume of lane code-d implementation): branch queue/14420-7557-code-span-blank-line at d5f133e was already pushed; PR #8061 now OPEN created live by lane code-p (rate limit cleared), superseding outbox OB-2026-11-09-T14420D1208-PR and OB-2026-11-09-T14420D1208. Tests recorded by lane code-d: targeted 2 passed, web::markdown 267 passed. agent-note:v1 task=14420
fix(id/web): unmatched backtick no longer disables newline-destinatio…
Merge pull request #8061 from developing-today/queue/14420-7557-code-…