Repository navigation
fix(sheets): emit empty arrays for ranges without notes or links - #1314
saariuslystoned wants to merge 2 commits into
Conversation
sheets notes and sheets links built their results in nil slices, so a range with no notes or links printed "notes": null or "links": null. Under --results-only, notes unwrapped to null and links fell back to the whole envelope, because the unwrapper only selects arrays. Start both slices empty, as other list commands do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR makes Sheets notes and links return empty JSON arrays when a range contains no matching annotations. Example: Run gog --json --results-only sheets links s1 'Sheet1!A1:A1' for a cell containing plain text.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current-main JSON output bug with a minimal change; the earlier changelog finding is resolved and no actionable defects remain. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Sheets CLI retrieves grid data, collects cell annotations, and passes the resulting collections to shared JSON formatting or table output. flowchart LR
CLI[Sheets CLI] --> API[Sheets grid response]
API --> Collect[Annotation collectors]
Collect --> Format[JSON formatter]
Format --> Transform[Optional results only transform]
Transform --> Output[Standard output]
Technical reviewBest possible solution: Land the two collector initialization fixes with the focused regression coverage and corrected Unreleased entry. Do we have a high-confidence way to reproduce the issue? Current-main collectors and shared JSON transformation explain the reported outputs directly, supported by contributor before-and-after CLI output; no target code was run during this read-only review. Is this the best way to solve the issue? Initializing empty collections in their existing owners is the smallest complete fix and matches existing empty-list regression contracts elsewhere in the CLI. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e8428c36dd31. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 8, 2026, 2:18 PM ET / 19:18 UTC (Revision 2). |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thank you for the fix. I reproduced the claim and consolidated emitting empty Sheets notes and links as arrays into #1336, with regression coverage and your coauthor credit retained. The full |
What problem this solves
gog sheets notesandgog sheets linkscollect their rows in nil slices (var notes []sheetsCellNote,var links []sheetsCellLink). For a range with no notes or no links, the JSON output carriesnullinstead of an empty array, and--results-onlygets worse:unwrapPrimaryonly selects array values. Empty notes therefore unwrap to barenull, and empty links fall back to the whole envelope, sojq '.[]'andjq lengthfail exactly when a range is empty. Other list commands already emit[]for empty results and pin it with tests, for exampleTestGmailFiltersList_JSONEmptyArrayandTestExecute_FormsResponsesList_JSONEmptyArray.Change
Start both slices empty (
notes := []sheetsCellNote{},links := []sheetsCellLink{}). Non-empty output and text output are unchanged.Evidence
TestSheetsNotesAndLinks_EmptyRangeJSONIsEmptyArrayrunsgog --json sheets notes|linksthrough the CLI entry point, with and without--results-only, against anhttptestSheets response containing one plain cell. It fails onmain(e8428c3) with"notes" = nulland passes with this change, as do the existing Sheets tests.A built
bin/gogfrommainand from this branch was run against a local Sheets stand-in throughGOG_GOOGLE_API_BASE_URL, with an emptyGOG_HOMEand the file keyring. The stand-in is not Google:make cipassed locally (macOS arm64, go1.27.3).This changes local output only. The Sheets request is unchanged, and no live spreadsheet was used.
🤖 Generated with Claude Code