Skip to content

docs push: corrupted output when inserting consecutive italic-wrapped paragraphs containing markdown links #72

@jtsternberg

Description

@jtsternberg

docs push: corrupted output when inserting consecutive italic-wrapped paragraphs containing markdown links

Summary

Pushing markdown that inserts multiple consecutive single-line paragraphs — each italic-wrapped, two of which contain markdown links — produces garbled output in the live Google Doc. Paragraph boundaries collapse into a single line, italic spans re-wrap around the wrong runs, and a link's trailing literal becomes its own span pointing at the same URL.

Observed on main at c131c2d6 (uv tool install "git+https://github.com/think41/extrasuite#subdirectory=client").

Minimal repro

before.md (initial Doc content)
# Minimal Repro

Some intro paragraph.

---

*Sessions 1–2. Session 1: 4/13/26. Session 2: 4/20/26. Next session: before the review.*

*Session 2 notes (full context for the reframes above): [Meeting Notes — 4/20/26](https://docs.google.com/document/d/EXAMPLE_NOTES_DOC_TWO/edit?usp=drive_link)*
after.md (target)
# Minimal Repro

Some intro paragraph.

---

*Sessions 1–3. Session 1: 4/13/26. Session 2: 4/20/26. Session 3: 5/5/26. Next session: 5/26/26.*

*Session 1 notes:* Kicked off The Brief.
*Session 2 notes: [Meeting Notes — 4/20/26](https://docs.google.com/document/d/EXAMPLE_NOTES_DOC_TWO/edit?usp=drive_link)*
*Session 3 notes: [Meeting Notes — 5/5/26](https://docs.google.com/document/d/EXAMPLE_NOTES_DOC_THREE/edit)*

Steps:

  1. Convert before.md to a Google Doc (e.g. gws drive files create --upload before.md --upload-content-type text/markdown).
  2. extrasuite docs pull <doc_url> ./pulled.
  3. Replace ./pulled/tabs/Tab_1.md body with after.md's body, keeping the id: t.0 / title: Tab 1 frontmatter sentinel.
  4. extrasuite docs push ./pulled.
  5. Re-pull, or open the live Doc.

Logs report Applied 14 document changes. No errors.

Expected (the bottom of the doc)

*Sessions 1–3. Session 1: 4/13/26. Session 2: 4/20/26. Session 3: 5/5/26. Next session: 5/26/26.*

*Session 1 notes:* Kicked off The Brief.
*Session 2 notes: [Meeting Notes — 4/20/26](...DOC_TWO...)*
*Session 3 notes: [Meeting Notes — 5/5/26](...DOC_THREE...)*

Actual

*Sessions 1–3. Session 1: 4/13/26. Session 2: 4/20/26. Session 3: 5/5/26. Next session: 5/26/26.*

*Session 1 notes:* Kicked off The Brief. *Session 2 notes:* [*Meeting Notes — 4/20/26*](...DOC_TWO...) Session 3 notes: [Meeting Notes — 5/5](...DOC_THREE...)[/26](...DOC_THREE...)

Specific symptoms:

  • All three single-line paragraphs collapse onto one line — paragraph breaks are gone.
  • Italic markers around the third paragraph (*Session 3 notes: ... *) are dropped entirely.
  • Italic markers around the second paragraph (*Session 2 notes: [link]*) are re-applied to the link text only, not the surrounding label.
  • "5/5/26" → split into "5/5" (linked) + "/26" (linked, same URL) — looks like the trailing literal got swept into the link span and then re-split.

This pattern is consistent with index-drift symptoms: insert and updateTextStyle/createParagraphBullets ops interleaving against shifting indices, with formatted runs landing at offsets that don't match the literal content.

Hypothesis

The README explicitly promises "It tracks index drifts and ensures subsequent operations use the correct index" and "Delete and re-insert is a bug." Both seem to be violated when the inserted region contains:

  • Multiple consecutive single-line paragraphs,
  • Italic spans that surround (rather than are surrounded by) markdown links,
  • Adjacent paragraphs with structurally similar text/link patterns.

Larger pushes amplify the issue — a real-world push with similar structural patterns produced ~97 ops and visibly garbled output across ~6 lines of the same shape.

Environment

  • Install: uv tool install "git+https://github.com/think41/extrasuite#subdirectory=client" at c131c2d6.
  • Auth: GOOGLE_WORKSPACE_CLI_TOKEN exchanged from gws auth export --unmasked refresh token (full drive scope, sidesteps drive.file so extrasuite can see a Doc it didn't create).
  • macOS 14, Python 3.14.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions