Skip to content

feat: insert Google Docs dropdown chips from the CLI - #1351

Open
lmjabreu wants to merge 2 commits into
openclaw:mainfrom
lmjabreu:feat/docs-dropdown-chips
Open

lmjabreu wants to merge 2 commits into
openclaw:mainfrom
lmjabreu:feat/docs-dropdown-chips

Conversation

@lmjabreu

@lmjabreu lmjabreu commented Nov 23, 2026 •

Copy link
Copy Markdown

Related: #638

What Problem This Solves

People who keep status or priority labels in a Google Doc as dropdown chips can't add those chips from gog. gog docs inserts person, date and file chips (#638), but not dropdowns, which the Docs API didn't expose when #638 shipped. Today the only way is to hand-build a batchUpdate call with your own access token.

User Impact

Two new commands:

  • gog docs insert-dropdown <docId> --definition <id or title> [--option <id or value>] inserts a dropdown chip from a definition already in the doc. It takes the same placement flags as insert-person: --index, --at-end, --tab, --batch, and --at, which replaces the matched text with the chip in one request.
  • gog docs list-dropdowns <docId> [--tab] lists each dropdown definition with its options, so you don't have to dig IDs out of gog docs raw.

When both IDs are given, nothing is fetched first. A title or display value is resolved case-insensitively within the tab being written to (--tab, or the first tab), and an unknown option fails with the list of valid values before anything is written.

Why This Change Was Made

The Docs API now has insertDropdown, and the pinned google.golang.org/api (v0.316.0) already has the types. This follows the existing smart-chip commands rather than adding a new pattern. Creating a new dropdown definition (createDropdownDefinition) is left out to keep this PR small.

Evidence

  • Unit tests cover insertion by ID with no lookup, --at replacement after resolving a title and a display value, an unknown option failing before any write, list-dropdowns --json, and resolving names only in the target tab when two tabs share a definition ID (reverting the tab fix makes that test fail).
  • A mutation test that removes the dropdown location wiring makes the insert tests fail.
  • make ci passes locally.
  • Live run against a real Doc, with the shipped binary (document ID redacted). It lists the definition, inserts an option by title and display value, reads the chip back from the document JSON, then removes it:
$ gog --version
v0.48.2-0.20261123175114-bc5f86b60809+dirty
(built from bc5f86b6 plus the tab fix)

$ gog docs list-dropdowns DOC_ID
TAB	DEFINITION	TITLE	OPTION	VALUE
t.0	kix.zdkq8eftgiq1	Work status	dropdownItem.jyuv48e2vvk7	🚀 Shipped
t.0	kix.zdkq8eftgiq1	Work status	dropdownItem.xl50zhf46dk6	📝 Spec
t.0	kix.zdkq8eftgiq1	Work status	dropdownItem.cfg8uwhcikv2	🔨 Decided
t.0	kix.zdkq8eftgiq1	Work status	dropdownItem.d2vvqhgq0dtd	💡 Proposed
t.0	kix.zdkq8eftgiq1	Work status	dropdownItem.xbg4gowxsyfh	❓ Question

$ gog docs insert-dropdown DOC_ID --definition "work status" --option "💡 proposed" --at-end --json
{
  "atIndex": 7885,
  "definition": "work status",
  "definitionId": "kix.zdkq8eftgiq1",
  "documentId": "DOC_ID",
  "inserted": true,
  "option": "💡 proposed",
  "optionId": "dropdownItem.d2vvqhgq0dtd"
}

$ gog docs raw DOC_ID | jq <dropdown elements in the last paragraph>
[
  {
    "startIndex": 7885,
    "dropdown": {
      "dropdownDefinitionId": "kix.zdkq8eftgiq1",
      "selectedOptionId": "dropdownItem.d2vvqhgq0dtd",
      "displayValue": "💡 Proposed"
    }
  }
]

$ gog docs delete DOC_ID --start 7885 --end 7886   # clean up the proof chip
documentId	DOC_ID
deleted	1 characters
range	7885-7886

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lmjabreu
lmjabreu requested a review from a team as a code owner November 23, 2026 17:51
@clawsweeper

clawsweeper Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 23, 2026
@clawsweeper

clawsweeper Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: ready, awaiting a maintainer decision.

What this changes

Adds commands to list Google Docs dropdown definitions and insert chips using an existing definition and option.

Example: Insert the 💡 Proposed option from the Work status dropdown.

  • Before: Users must construct a Google Docs API request themselves.
  • After: Run gog docs insert-dropdown DOC_ID --definition "work status" --option "💡 proposed" --at-end.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Concrete live proof and resolved prior findings support the patch; unresolved feature direction caps overall readiness.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The updated body supplies redacted terminal output from the CLI against a real Doc, showing definition listing, title/value insertion, matching chip readback and cleanup; the binary includes the tab fix.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: Users cannot insert existing Google Docs status or priority dropdown chips through gog.
Reason: The contribution offers concrete value with a restrained implementation, but the new CLI surface needs owner direction.

Merge readiness

⏳ Ready, awaiting maintainer decision

Keep open: this PR adds a capability absent from main, fixes both prior findings, and now supplies live CLI proof; maintainer direction on the new commands remains unresolved.

Priority: P2
Reviewed head: a052707b629cd4393696b4edfac3cdae065b649e
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should gog expose insert-dropdown and list-dropdowns for existing Google Docs definitions?
  • Recommendation: Approve the narrow scope: Support listing existing definitions and inserting their options, leaving definition creation for separate work.
  • Why: The feature follows the existing chip primitives, but the recorded maintainer work and discussion do not explicitly approve this added command surface.

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Docs CLI resolves definitions and placement, then uses the existing smart-chip insertion path to submit a Docs API request or queue it in an existing batch.

flowchart LR
  A[CLI arguments] --> B[Dropdown commands]
  B --> C[Docs definition lookup]
  C --> B
  B --> D[Shared insertion planner]
  D --> E[Docs batchUpdate]
  D --> F[Existing batch queue]
Loading

Technical review

Best possible solution:

Retain the narrow existing-definition scope and shared insertion owner if the feature owner approves the two new commands.

Do we have a high-confidence way to reproduce the issue?

This is a feature addition; source confirms the capability is absent from main, and the supplied terminal transcript demonstrates the proposed insertion path.

Is this the best way to solve the issue?

Reusing the existing insertion planner and tab helpers is appropriate, and the revised lookup now respects the insertion tab without adding another write path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 31c4e14186e8.

Provenance checked

  • Shared smart-chip insertion keeps the original intent (3bed2b0: Expose native Docs chip primitives through a shared insertion path.)
  • Placement and batching keeps the original intent (107b9fb: Centralize placement resolution while retaining the existing batch submission flow.)
  • Generated command and skill inventories keeps the original intent (4ddec67: Generate service skill inventories from the public CLI schema.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current-main capability boundary: Main registers person, file and date chip commands but no dropdown commands; its sedmat dropdown branch remains unsupported. (internal/cmd/docs.go:46, 31c4e14186e8)
  • Prior findings resolved: The revision restricts insertion lookup to the explicit target tab or first tab, adds multi-tab coverage, and adds the PR reference and contributor thanks to Unreleased. (internal/cmd/docs_dropdowns.go:165, a052707b629c)
  • Live proof and direction: The full updated body records listing Work status, inserting dropdownItem.d2vvqhgq0dtd by title/value at index 7885, reading back 💡 Proposed, and cleanup; the binary is identified as the earlier head plus the tab fix. There are no submitted reviews or maintainer direction comments. (a052707b629c)
  • Feature history: The merged feat(docs): add document shaping helpers #668 introduced native chip primitives; docs: native smart-chip insertion (Person, Dropdown, Date, File) #638 deferred dropdowns until API support existed. Peter Steinberger subsequently carried batching and placement refactors. One follow-history traversal reached an unavailable old blob; direct introduction and refactor commits were readable. (internal/cmd/docs_smart_chips.go:180, 3bed2b06e788)
  • Imported API contract: The directly imported v0.316.0 client scopes definitions to tabs, supports InsertDropdownRequest location and selected option, and defaults an omitted selection to the first option. (docs/v1/docs-gen.go:3072, 35ecdc151456)
  • Existing storage compatibility: Batch requests already serialize arbitrary Docs requests as json.RawMessage; this PR changes neither the persisted batch envelope nor existing settings or document data formats. (internal/cmd/docs_batch_store.go:104, a052707b629c)

Likely related people:

  • Peter Steinberger: Raw commit 107b9fb adds internal/cmd/docs_smart_chips.go:205 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 107b9fbbadc0; files: internal/cmd/docs_smart_chips.go)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: ⏳ waiting on maintainer.

Label justifications:

  • P2: A useful, limited-scope Docs capability without an urgent production regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-23T18:05:50.138Z sha bc5f86b :: needs real behavior proof before merge. :: [P2] Resolve dropdown definitions within the insertion tab | [P3] Credit the contributor in the changelog entry

Reviewed November 23, 2026, 3:36 PM ET / 20:36 UTC (Revision 2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lmjabreu

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Nov 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant