Repository navigation
Description
What happens
gog docs write <id> --tab <tab> --replace --markdown keeps the list membership of the tab's original last paragraph. If that paragraph is a list item, every paragraph of the new content joins that list: headings, prose, blank paragraphs, and markdown lists, which lose their own list and preset.
Related but separate: gog docs format <id> --tab <tab> --no-bullets without --match removes bullets from every paragraph except the last one. That leftover bulleted empty paragraph makes the next --replace --markdown reproduce the first bug, so the documented recovery does not work.
This looks like the same class as #756 (find-replace inheriting the anchor paragraph style), on the whole-tab replace path.
Repro (v0.48.0, f939ed3, a fresh scratch doc)
-
Seed the tab so its last paragraph is a list item.
a.md:# Seed Intro paragraph. - seed bullet one - seed bullet two
gog docs write $D --tab t.0 --replace --markdown --file a.md. The markdown writer ends with an empty normal paragraph, so make the last paragraph a list item withdocuments.batchUpdate:insertText"seed final bullet" at the last index, thencreateParagraphBulletsover it. Read-back: the last paragraph isBULLETin the same list as the seed bullets. This mirrors a real doc whose body ended in a bulleted line. -
Replace with
b.md:# New heading Plain paragraph one. ## Second heading Plain paragraph two. 1. step one 2. step two
gog docs write $D --tab t.0 --replace --markdown --file b.md -
gog docs raw $D --json, tab t.0 body:1-13 HEADING_1 BULLET (seed list) "New heading" 13-34 NORMAL_TEXT BULLET (seed list) "Plain paragraph one." 34-49 HEADING_2 BULLET (seed list) "Second heading" 49-70 NORMAL_TEXT BULLET (seed list) "Plain paragraph two." 70-71 NORMAL_TEXT BULLET (seed list) "" 71-80 NORMAL_TEXT BULLET (seed list) "step one" 80-89 NORMAL_TEXT BULLET (seed list) "step two" 89-90 NORMAL_TEXT BULLET (seed list) "" -
gog docs format $D --tab t.0 --no-bullets, then raw again: paragraphs 1 to 89 have no bullet, but89-90keepsBULLET (seed list). Running step 2 again brings back all-paragraph bullets.
Control: the same step 2 on a tab whose last paragraph is a normal empty paragraph gives the expected result. Headings and prose have no bullet, and only "step one" and "step two" are bulleted, in their own new list.
Expected
--replace --markdowngives each paragraph only the list membership its markdown implies, whatever the tab's previous last paragraph was. For example, rundeleteParagraphBullets(and reset indentation) over the whole tab range, including the final paragraph, before or after the insert.format --no-bulletswithout--matchcovers the final paragraph too. In a real doc, a rawdeleteParagraphBulletswhose range runs from 1 to the segment end index was accepted and cleared it.
Impact
A whole-tab markdown rewrite of a real document turned all 47 paragraphs, including all 7 headings, into one bulleted list. The only recovery was a raw documents.batchUpdate (deleteParagraphBullets over the full range, then createParagraphBullets for the intended list).
Environment
gog v0.48.0 (f939ed3), Linux, OAuth user account, Docs API with tabs.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Nov 12, 2026
Codex review: this still needs some work.
Summary
Keep open: current main retains both defects, and the earlier paragraph-style fix covers a different replacement path.
Reproducibility: Current source establishes the preserved terminal newline, missing list reset, and excluded final empty paragraph; the reporter provides live v0.48.0 read-back and a control, but this review ran no tests or live mutations.
Next step
Establish failing regressions for inherited terminal bullets and final-empty-paragraph removal, then repair the replacement reset and no-match formatting range.
Review details
Best possible solution:
Reset the surviving paragraph’s bullets and indentation before rendering replacement markdown, and include the final empty paragraph when removing bullets without --match.
Do we have a high-confidence way to reproduce the issue?
Current source establishes the preserved terminal newline, missing list reset, and excluded final empty paragraph; the reporter provides live v0.48.0 read-back and a control, but this review ran no tests or live mutations.
Is this the best way to solve the issue?
A focused terminal-paragraph reset and paragraph-aware bullet-removal range address both defects without changing append or inline replacement semantics.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning medium; reviewed against 6f910fffac0a.
Label changes
Label changes:
P2: A reproducible, limited-scope Docs editing defect corrupts paragraph formatting and defeats the normal bullet-removal recovery.impact:other: Document list membership, heading presentation, and intended numbering are corrupted during a supported markdown rewrite.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.clawsweeper:queueable-fix: Current issue advisory state selects this label.clawsweeper:fix-shape-clear: Current issue advisory state selects this label.Label justifications:
P2: A reproducible, limited-scope Docs editing defect corrupts paragraph formatting and defeats the normal bullet-removal recovery.impact:other: Document list membership, heading presentation, and intended numbering are corrupted during a supported markdown rewrite.Evidence reviewed
Acceptance criteria:
What I checked:
internal/cmd/docs_write_markdown.go:336, 6f910fffac0a)internal/cmd/docs_mutation.go:339, 6f910fffac0a)internal/cmd/docs_format.go:234, 6f910fffac0a)internal/docsformat/format.go:411, 6f910fffac0a)internal/cmd/docs_write_markdown_tab_test.go:19, 6f910fffac0a)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.Reviewed November 12, 2026, 5:34 PM ET / 22:34 UTC.