fix(editor): load a body followed by two or more item rows #231
No reviewers
Labels
No labels
bug
enhancement
needs-triage
ready-for-agent
ready-for-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/deckle!231
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "lab/20261012-1740"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #230
Problem
An items owner whose file pretty-prints its rich-text body and rows onto their own lines (
Body.then two{{< img />}}lines, the shapetext-media.yamland AGENTS.md teach) could not be opened in the editor once it had two or more rows.GET /api/element/bodyanswered422 adjacent text nodes: it pulled the rows out of the children and serialized the rest, and the newline text nodes the rows had separated were now side by side.The save path (
elemops.ApplyEdit) already merged such runs with its owncoalesceText. The read path did not. One split, implemented twice, one copy correct.Change
elemops.PartitionItemsnow returns a serializable rest itself (adjacent text merged into fresh copies, bytes preserved), so every caller is covered by construction.ApplyEditdrops its separate merge;handleElementBodygains a comment pointing at the guarantee.TestPartitionItemsCoalescesLeftoverText(elemops: merges, serializes, never mutates the caller's tree) andTestElementBodyLoadsBodyFollowedByPrettyPrintedRows(server: the GET loads, GET then save is a fixed point for the body the editor sees). Both fail onmain.Not in scope
The save still writes rows and body glued onto one line (noisy diffs, inter-row whitespace leaking into the translation hash). That is a canonical-layout change with manual and skill impact and is tracked in a separate issue.
No documented behaviour changes: AGENTS.md and the skills are untouched.
🤖 Generated with Claude Code
A hand-authored items owner that pretty-prints its rich-text body and rows onto their own lines ("Body.\n{{< img />}}\n{{< img />}}") failed to open in the editor: GET /api/element/body pulled the rows out of the children and serialized the rest, and the two newline text nodes the rows had separated were now adjacent, which the serializer refuses. The save path already merged such runs with its own coalesceText; the read path did not — one split implemented twice, one copy correct. PartitionItems now hands back a serializable rest itself, so every caller is covered and ApplyEdit's separate merge goes away. Regression tests at the elemops layer (the split merges and copies) and the HTTP layer (the GET loads and GET → save is a fixed point for the body). Closes #230 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>[autoland] verdict: pass
PASS. Validated against
validation-core.md.ci / build-and-testgreen on the PR head (run 227, 16m12s). Not re-run.Closes #230; head is a lab run branch.elemops.PartitionItemsnow coalesces adjacent text inrest(fresh copies, bytes preserved);ApplyEditdrops its own merge; regression tests at the elemops and HTTP layers. Every other caller of the split (WouldClobberBody,forms.go,translation.go) either uses only the items side or checks block children, so the merged rest changes nothing for them.mainis clean; the four commits main gained since the branch point are all web/i18n.No CONCERNS.