GeezerVison is showing github.com — id(web): a heading containing a hard break is corrupted on save — break becomes a literal backslash and the heading splits into a paragraph · Issue #1388 · developing-today/code
id(web): a heading containing a hard break is corrupted on save — break becomes a literal backslash and the heading splits into a paragraph #1388DescriptionBug: a heading containing a hard break is corrupted on save — break becomes a literal backslash and the rest of the heading splits into a new paragraph
Found in pkgs/id/src/web/markdown.rs (the markdown ⇄ ProseMirror codec), verified this run on main 95bfedb4 with a standalone probe crate carrying a verbatim copy of src/web/markdown.rs (comrak 0.56; probe logs in the goal workspace hidden_files/probe-2026-10-27-creator-a2/out3.log cases setext-hardbreak-backslash / setext-hardbreak-spaces, PM-side case heading-hardbreak in out2.log).
Reproduction (pure markdown in, no editor tricks needed)
A setext heading is a multi-line paragraph, so it can contain a hard break:
(or the same with two trailing spaces after Title instead of the backslash.)
-
Parse direction: markdown_to_prosemirror produces one heading node whose inline content is text "Title", hard_break, text "more here" — the parse-side NodeValue::LineBreak arm (markdown.rs:295) emits hard_break regardless of the containing block, and placement validation (markdown.rs:979: "paragraph" | "heading" => child == Placement::Inline) accepts it, since hard_break is inline.
-
Save direction: the hard_break arm (markdown.rs:1385) builds a comrak NodeValue::LineBreak inside the Heading node built at markdown.rs:1141, and format_commonmark renders it as a backslash + newline inside the ATX heading line:
-
Re-parsing that saved file yields a different document: a heading whose text is Title\ (a literal backslash character has been added to the user's text) followed by a new plain paragraph more here. The heading the user had is split in two and gains a stray \.
The same PM doc built directly in the editor (e.g. convert a paragraph containing a hard break into a heading — heading in richSchema is inline* content, pkgs/id/web/src/editor.ts:46) corrupts identically.
Why this is a codec bug, not just a renderer quirk
A direct comrak parse → format_commonmark control renders the same bytes (probe out4.log, DIRECT cases) — comrak's renderer cannot spell a line break inside an ATX heading either. But the codec's contract is ProseMirror fidelity (cf. #1031, #1370), and here the PM document itself changes across one open → save cycle. The codec already solves exactly this shape of problem for table cells: #1017's append_table_cell_child (markdown.rs:~1560) degrades a hard/soft break to a single space because "a table cell is single-line content in markdown". A heading is single-line content in markdown for the same reason, and gets no such degradation.
Suggested fix direction (triage decides)
Degrade LineBreak children of a Heading to a space in the save direction (mirroring #1017's table-cell handling), or equivalently normalize them in the parse direction, so a heading with a hard break saves as # Title more here and re-opens as the same single heading. Rejecting with a ConversionError would be worse than the space degradation (it would make the whole document unsavable).
Acceptance criteria
-
Title\ + newline + more here + ===== (and the two-trailing-spaces variant) round-trips to a single heading containing Title more here (or an equivalent single-line spelling) — no literal backslash added, no paragraph split.
- A hand-built PM heading containing a
hard_break saves without corrupting on re-parse; output is a fixpoint.
- Hard breaks in paragraphs still save as hard breaks (existing behaviour unchanged).
- Regression test in
web::markdown tests next to the id(web): saving a table cell with a hard break or a list panics in the markdown codec — ill-formed comrak AST #1017 table-cell tests; existing codec tests still pass.
Activitydeveloping-today commented on Oct 27, 2026 added kind/bugSomething isn't working (prefixed form of the classic bug label) task/triageQueue packet kind: verify, reproduce, and route this item app/idPackage/app: id (pkgs/ or apps/ in this repo) effort/sSmall: expected under 2 hours of work on Oct 27, 2026dezren39 commented on Oct 27, 2026 🤖 Agent note · filed
- Agent: new-issue-creator-code-a
- Session / ID: new-issue-creator-code-a cron run 2026-10-27 04:43 CDT
- Found via: filed this run
- Task: Verified with a standalone probe crate carrying a verbatim copy of src/web/markdown.rs (comrak 0.56) on main 95bfedb (logs hidden_files/probe-2026-10-27-creator-a2/out3.log cases setext-hardbreak-backslash/setext-hardbreak-spaces, out2.log case heading-hardbreak, out4.log DIRECT comrak controls): a setext heading containing a hard break parses to a PM heading with a hard_break child (markdown.rs:295, placement validation :979 accepts it as inline), and the save arm (markdown.rs:1385) builds a comrak LineBreak inside the Heading (built :1141), which format_commonmark renders as '# Title' + newline — re-parsing yields heading text 'Title' (literal backslash added) plus a new paragraph 'more here'. Headings are single-line markdown content but get none of the break degradation id(web): saving a table cell with a hard break or a list panics in the markdown codec — ill-formed comrak AST #1017 built for table cells (append_table_cell_child, markdown.rs:~1560). Enqueued as a triage packet to repo-health-code-pilot — degrade-to-space vs parse-side normalization is a triage decision.
- Expectation: triage decides the degradation point; done when a heading containing a hard break round-trips as one heading with no added backslash and no split, with a regression test.
- Links: probe evidence in goal hidden_files (see issue body)
dezren39 commented on Oct 27, 2026 🤖 Agent note · handed off (duplicate consolidation from #1492)
- Agent: new-issue-creator (new-issue-creator-code-a, Lane A)
- Session / ID: cron job new-issue-creator-code-a, run 2026-10-27 13:15 CDT
- Found via: filed this run (as id(web): a hard_break inside a heading corrupts on save — the heading splits, a literal backslash appears and doubles on the next save; hard_breaks at block ends and in a break-only paragraph are silently dropped #1492, being closed as a duplicate of this issue)
- Task: transferring the parts of id(web): a hard_break inside a heading corrupts on save — the heading splits, a literal backslash appears and doubles on the next save; hard_breaks at block ends and in a break-only paragraph are silently dropped #1492 that this issue does not yet cover, verified this run on main a1321fd with a verbatim-codec probe crate on the laptop (markdown.rs sha256 f0b6b9cd, comrak 0.56.0; logs hidden_files/probe-2026-10-27-laneA-1315/out2.log + out3.log + out4.log):
- Backslash doubling confirmed: PM heading [a, hard_break, b] -> save
# a\ + b -> reopen heading text a\ -> second save writes # a\\ (the literal backslash doubles once, then stabilizes). Heading-start placement mirrors it (## \ -> ## \\).
- Trailing hard_breaks are silently dropped on save in every container probed: paragraph [text, hard_break] -> saved
before; heading [a, hard_break] -> ## a; blockquote paragraph and list-item paragraph trailing breaks likewise (out4.log). No error, no normalization marker.
- A paragraph whose only content is a hard_break is deleted outright on save: PM [paragraph [hard_break], paragraph x] -> saved file is
x only.
- Table-header cells already have an implicit policy (mid-cell break -> space, stable; trailing cell break leaves the table padding non-fixpoint:
| a | -> | a |) — the id(web): saving a table cell with a hard break or a list panics in the markdown codec — ill-formed comrak AST #1017 degradation this issue proposes to mirror.
- Expectation: effort/s — when this issue is triaged, please fold placements 2-3 into the same placement-policy decision (they share the root cause: the save arm at markdown.rs:1385 emits LineBreak with no placement policy); id(web): a hard_break inside a heading corrupts on save — the heading splits, a literal backslash appears and doubles on the next save; hard_breaks at block ends and in a break-only paragraph are silently dropped #1492 is closed as duplicate and its queue task 1528 cancelled so nothing double-books.
- Links: id(web): a hard_break inside a heading corrupts on save — the heading splits, a literal backslash appears and doubles on the next save; hard_breaks at block ends and in a break-only paragraph are silently dropped #1492 (duplicate, closed); probe ~/git/fleet/probe-2026-10-27-laneA-1315 (laptop)
dezren39 commented on Nov 3, 2026 🤖 Agent note · blocked / escalated
dezren39 commented on Nov 8, 2026 🤖 Agent note · done (triaged — CONFIRMED live; escalation was a misread; shepherd packet owed under #6838)
- Agent: queue worker (repo-worker-code), lane code-l
- Session / ID: task 11941
- Found via: queue claim · done-task-only verification audit (issue queue: no reconciliation between open issues and queue coverage — non-creator filings never get queue items #7016)
- Task: Triage the remainder of id(web): a heading containing a hard break is corrupted on save — break becomes a literal backslash and the heading splits into a paragraph #1388 (heading hard_break corrupted on save) — queue-done with no landed evidence.
- Verdict (fresh state, 2026-11-08): Bug CONFIRMED still live. Current main
801ceb9cb1: pkgs/id/src/web/markdown.rs:5093 still maps hard_break => NodeValue::LineBreak with no heading-side policy (only the id(web): saving a table cell with a hard break or a list panics in the markdown codec — ill-formed comrak AST #1017 table-cell and id(web): edge whitespace in text runs is written on save but stripped on reopen — a whitespace-only paragraph is deleted outright #1420 save-trim policies exist). The fix exists only in PR fix(id): normalize hard breaks in headings on save #4624 (OPEN, head queue/6503-1388-hard-break-heading, no labels; checks: OpenCode metered-provider guard SUCCESS, CodeRabbit SUCCESS — the id test tier has still never run on it).
- The
user/escalated block was a misread — de-escalated by this note. Task 8165 blocked/escalated on 2026-11-03 solely because PR fix(id): normalize hard breaks in headings on save #4624's author is dezren39. That account is the shared fleet GitHub account that authors every queue PR, and PR fix(id): normalize hard breaks in headings on save #4624's head is a queue/* branch from task 6503 — it is not a Drew-owned PR, and it carries no held / user/owned / do-not-merge / do-not-auto-edit labels. Same correction as id: F12.11 delta and binary frames (screen patches, resume tokens) #805 / PR feat(id): resume tokens and bounded screen baselines — #805 Phase 2 #5036 (2026-11-04) and mcpx: tool views and composed tool sets — rename/pin/hide, cross-server namespaces, script-backed tools, and generators that emit declarations #1933 / PR feat(mcpx): toolViews slice 1 — rename/pin/hide on alias views (#1933) #2976 (2026-11-01). Labels updated with this note: user/escalated, queue/blocked, status/blocked, status/triaged removed.
- Routing — honest state: I cancelled task 8165 (cancel reason records the misread) to clear its block for a fresh shepherd enqueue, then hit the known enqueue trap (fleet-queue (turso): no revive/requeue verb — dead-at-cap tasks can only be reset via direct SQL; enqueue dedupe ignores status #6838):
fleet queue enqueue dedupe-hits the cancelled task 8165 under repo-health:v1:pr:developing-today/code:pr:4624 and creates nothing — terminal dedupe hits return the old row instead of reviving it. So no live shepherd task exists right now. The validated shepherd packet is ready at hidden_files/lane-l-2026-11-07/packet-1388-shepherd.json (goal workspace) — enqueue it unchanged when fleet-queue (turso): no revive/requeue verb — dead-at-cap tasks can only be reset via direct SQL; enqueue dedupe ignores status #6838 lands a revive path, or work PR fix(id): normalize hard breaks in headings on save #4624 directly from this note: update onto current main, run the targeted id codec tests (the missing gate), disposition Codex, merge when verified. Do NOT open a competing implementation.
- Links: PR fix(id): normalize hard breaks in headings on save #4624 fix(id): normalize hard breaks in headings on save #4624 · Enqueue trap fleet-queue (turso): no revive/requeue verb — dead-at-cap tasks can only be reset via direct SQL; enqueue dedupe ignores status #6838 · Audit queue: no reconciliation between open issues and queue coverage — non-creator filings never get queue items #7016
dezren39 commented on Nov 10, 2026
state: done
task: 14747
lane: code-g
pr: 7947
outcome: fixed_on_main
Closing #1388 as fixed on main. The fix — normalize_hard_break_placement / hard_break_is_trailing in pkgs/id/src/web/markdown.rs, with tests for heading mid-break, setext roundtrip, heading edge breaks, paragraph trailing breaks, and break-only paragraphs — was committed as 8625764 and merged via PR #7947 on 2026-11-09 (targeted cargo test -p id --lib hard_break run recorded on task 14168 before merge). Verified fresh 2026-11-10 (task 14747, lane code-g): the function and all five tests are present in current origin/main, and the original PR #4624 carrying the same commit is closed as superseded (git cherry patch-equivalence). Reopen if the corruption reproduces on current main.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|