Repository navigation
Description
Summary
In the id web markdown codec (pkgs/id/src/web/markdown.rs), saving a document with adjacent bullet lists that use different markers (-, +, * with no blank line between them — three separate one-item lists) writes literal <!-- end list --> HTML comments into the user's file. Worse, the result is not a fixpoint and grows on every save: on the next save each comment block additionally becomes a ```html code fence, and the save after that duplicates them again. A document with two list boundaries gains two more code blocks per save, forever.
Evidence (verified this run, main 76672b9)
Standalone probe crate carrying a verbatim copy of src/web/markdown.rs (comrak 0.56.0, the locked version). Probe logs: goal hidden_files/probe-2026-10-26-1815/ (batch2.log case mixed_markers, inspect.log).
Input:
- a
+ b
* cParse (inspect.log): three separate bullet_list PM nodes — correct; the PM model has no marker attribute, so the three lists are indistinguishable from one list except for being separate nodes.
Save 1:
- a
<!-- end list -->
- b
<!-- end list -->
- cSave 2 (the comments from save 1 now reparse through the HTML-block path, cf. #982, and come back as code fences, while fresh comments are emitted again):
- a
<!-- end list -->
```html
<!-- end list -->- b
<!-- end list -->- c
Save 3 doubles the accumulated ```` ```html ```` blocks again (two per list boundary; full sequence in `inspect.log`). Every open→save cycle permanently adds blocks to the file.
## Root cause (code evidence)
- Save direction `json_to_ast` (list arms, `markdown.rs:997-1045`) builds a separate comrak `List` node per PM `bullet_list`; comrak's CommonMark renderer separates two adjacent lists of the same type by emitting an `<!-- end list -->` HTML comment — the codec passes that through verbatim into the saved file.
- On reparse, a standalone comment is an HTML block; the codec's HTML-block handling (the behaviour tracked in #982) turns it into a ```` ```html ```` fenced block, while the renderer emits fresh `<!-- end list -->` comments for the still-adjacent lists — hence unbounded growth instead of a fixpoint.
## Why it matters
Mixed-marker adjacent lists appear in real notes (and in files produced by other editors). A user who opens such a file in the id web editor and saves repeatedly watches their document accumulate comment lines and then duplicated code fences — visible corruption that compounds, in the same non-fixpoint family as #944/#981 but with growth per save.
## Acceptance criteria
- `- a` / `+ b` / `* c` (and the two-list case) saves to a form that is a fixpoint from the first save: repeated open→save cycles are byte-stable.
- No `<!-- end list -->` comments or ```` ```html ```` artefacts are introduced into the saved file.
- The saved form still renders as the same list items with the same text (merging the adjacent bullet lists into one list on save is acceptable — the PM model cannot represent the marker distinction anyway; separating them by a construct that round-trips is equally acceptable).
- Regression tests in `web::markdown` assert byte-stability over at least three consecutive saves; existing markdown tests pass.
Suggested direction (triage decides): coalesce adjacent `bullet_list` nodes (same for ordered lists with a continuous `start`, if reproducible) in `json_to_ast` or in the parse direction, rather than letting comrak's renderer invent separators the codec cannot reparse. Interaction with #982 (HTML blocks → ```` ```html ````) should be noted: fixing #982 alone does not stop the comment emission, and fixing the emission alone leaves the comment-reparse path armed for user-authored comments between lists.
Dedup: searched open + closed issues for `end list`, `mixed marker`, `adjacent list` — no matches. #982 covers user-authored HTML blocks becoming code fences, a different trigger; this issue is about the codec's own renderer emitting comments it cannot round-trip.
Activity
developing-today commentedon Oct 26, 2026
CODE-186
dezren39 commentedon Oct 26, 2026
🤖 Agent note · filed
- a/+ b/* cparses to three bullet_list PM nodes; save 1 emits literal<!-- end list -->comments (comrak renderer separating adjacent same-type lists built by json_to_ast list arms markdown.rs:997-1045); save 2 turns prior comments into ```html fences (the id(web): HTML blocks (comments, <details>, <div>) are rewritten as ```html code blocks on save #982 HTML-block path) plus fresh comments; save 3 doubles the fences — unbounded growth per save, no fixpoint. Enqueued as a triage packet to repo-health-code-pilot (coalesce-on-save vs parse-side coalescing is the triage choice; interacts with id(web): HTML blocks (comments, <details>, <div>) are rewritten as ```html code blocks on save #982).16 remaining items
Merge pull request #1037 from developing-today/queue/1209-1032-coales…
dezren39 commentedon Oct 27, 2026
🤖 Agent note · done
crash-gateand its aggregate, a Nix stdenv build-infra failure (gawk/gnugrep/gnumake-musl/gnused derivations failing to build on the runner), unrelated to this change. Merged under the standing criteria.