Repository navigation
fix(sheets): keep each sheet row on one line in text output - #1316
saariuslystoned wants to merge 3 commits into
Conversation
sheets get and sheets datasource table read joined raw cell values with tabs, so a cell with a line break or tab split its row in text and --plain output. Escape cells with the existing oneLine helper, as the links, notes, format and validation tables already do. JSON output is unchanged. 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 escapes cell line breaks and replaces embedded tabs with spaces in both Sheets value readers’ text and TSV output. Example: Alice’s row contains address "1 Main St\nBerlin" and note "a\tb".
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current Sheets output bug with a focused shared formatter; the previous finding and proof requests are resolved, and no actionable defects remain. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherSheets CLI commands receive cell arrays from Google’s API and render JSON, aligned text, or TSV; this change affects only text and TSV rendering. flowchart LR
A[Sheets CLI commands] --> B[Google Sheets API]
B --> C[Cell arrays]
C --> D[Unchanged JSON output]
C --> E[Shared value row formatter]
E --> F[Existing oneLine helper]
F --> G[Text or TSV output]
Technical reviewBest possible solution: Use the existing oneLine convention in one shared value-row formatter while retaining separator tabs and lossless JSON. Do we have a high-confidence way to reproduce the issue? Current-main source directly demonstrates delimiter leakage, and the contributor supplies failing-base and passing-branch CLI output for newline, CRLF, and tab-containing cells. Is this the best way to solve the issue? The shared formatter is a small complete repair for the reported inputs and follows established Sheets formatting behavior without adding another escaping policy. 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. 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, 3:11 PM ET / 20:11 UTC (Revision 2). |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the helper-only cases into the command-path test. 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 keeping multiline Sheets cells on a single text-output row into #1336, with regression coverage and your coauthor credit retained. The full |
What problem this solves
docs/automation.mddescribes--plainas stable TSV.gog sheets getwrites each cell withfmt.Sprintf("%v", cell)and joins cells with tabs, so a cell that contains a line break or a tab breaks the row. Multi-line cells are common in Sheets: an address, notes, and anything entered with Ctrl+Enter.The one data row comes out as two lines. The second line looks like a row starting with
Berlin, and the tab insidea<TAB>badds a column.sheets datasource table readbuilds its rows the same way.The other Sheets cell tables already avoid this.
sheets links,sheets notes,sheets formatandsheets validationpass their values throughoneLine(internal/cmd/sheets_presentation.go), which writes a line break as\nand a tab as a space.calendar events --locationcollapses multi-line addresses for the same reason.Change
sheets getandsheets datasource table readnow share a smallsheetsValueRowLinehelper. It passes each cell through the existingoneLinebefore joining, so each sheet row stays one output line with one column per cell:This applies to text and
--plainoutput. JSON output is unchanged and still the lossless form. Cells without line breaks or tabs print exactly as before.Evidence
TestSheetsGetCmd_PlainKeepsMultilineCellsOnOneRowrunsgog --plain sheets getthrough the CLI entry point against anhttptestSheets server that returns a cell with\nand one with\t. It fails onmain(e8428c3) with the split row shown above, and passes with this change. The same test also covers a\r\ncell, a number and a boolean. The existingTestSheetsGetCmd_PlainOutputTSVand the rest of the Sheets tests pass.Built
gogbinaries frommainand from this branch were run against a local Sheets stand-in throughGOG_GOOGLE_API_BASE_URL(not Google).values.getreturnsAlice | 1 Main St\nBerlin | a\tbandBob | 2 High St\r\nParis | ok;spreadsheets.getreturns the repo's Connected Sheets fixture. Each stdout line is shown as a Python repr:The aligned text mode (no
--plain) splits the same way onmainand stays on one line per row on the branch.--json --results-only sheets getprints the same value on both:[["Name","Address","Note"],["Alice","1 Main St\nBerlin","a\tb"],["Bob","2 High St\r\nParis","ok"]].Every
make cistep passed on6a3b0c5(go1.27.3). The Go test suite (go test -count=1 ./...) ran on a second macOS arm64 machine, and the fmt, lint, deadcode, docs, agent-skills and node checks ran locally.This changes local formatting only. The request to Google is unchanged, and no live spreadsheet was used. Anyone who relied on raw line breaks in text output will now see
\n;--jsonkeeps the original value.🤖 Generated with Claude Code