Skip to content

fix(drive): accept commas in drive labels file apply field flags - #1319

Closed
saariuslystoned wants to merge 2 commits into
openclaw:mainfrom
saariuslystoned:fix/drive-labels-comma-values
Closed

saariuslystoned wants to merge 2 commits into
openclaw:mainfrom
saariuslystoned:fix/drive-labels-comma-values

Conversation

@saariuslystoned

@saariuslystoned saariuslystoned commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

What problem this solves

The help for gog drive labels file apply documents comma-separated values for multi-value fields, for example --selection field=choiceId[,choiceId], --integer field=123[,456], --date and --user. --text is documented as field=value. All five are plain []string flags without sep:"none", so Kong splits every value on commas before parseDriveLabelFieldAssignment sees it. The second half then has no =:

$ gog drive labels file apply <file> <label> --selection status=c1,c2
label field assignments must be field=value          (exit 2)
$ gog drive labels file apply <file> <label> --text 'note=Hello, world'
label field assignments must be field=value          (exit 2)

The documented multi-value form never worked from the command line, and neither does a text value with a comma in it. Only --fields-json gets either through. The existing tests build DriveLabelsFileApplyCmd in Go and skip CLI parsing, so they don't see this.

Change

  • --text, --selection, --integer, --date and --user get sep:"none", as other field=value-style flags in the repo do, for example --rrule. Repeating a flag still adds more fields.
  • A text field holds one value, so --text now keeps everything after the first = as that value instead of splitting it on commas. The other four keep their documented comma splitting, which now actually runs.

Evidence

  • TestDriveLabelsFileApply_CommaValuesThroughCLI parses --text 'note=Hello, world' --selection status=c1,c2 --integer count=1,2 --user owners=a@example.com,b@example.com through Kong and checks the modifyLabels body that an httptest Drive server receives. On main (e8428c3) it fails with label field assignments must be field=value. With this change it gets ["Hello, world"], ["c1","c2"], [1,2] and both users. The existing Drive labels tests pass.

  • A built bin/gog from main was run against a local stand-in through GOG_GOOGLE_API_BASE_URL. --selection=status=c1,c2 and --integer=n=1,2 exit 2 with that error before any request; single values reach the --force confirmation as expected.

  • The same built-CLI run with a gog binary from this branch, against a stand-in that logs request bodies (not Google):

    $ gog --json --force drive labels file apply file1 label1 --text 'note=Hello, world' --selection status=c1,c2 --integer count=1,2 --user owners=a@example.com,b@example.com
    main:   label field assignments must be field=value    exit=2, no request sent
    branch: {"modifiedLabels":[{"id":"label1"}]}            exit=0
            POST /drive/v3/files/file1/modifyLabels
            {"fieldId":"note","setTextValues":["Hello, world"]}
            {"fieldId":"status","setSelectionValues":["c1","c2"]}
            {"fieldId":"count","setIntegerValues":["1","2"]}
            {"fieldId":"owners","setUserValues":["a@example.com","b@example.com"]}
    
  • make ci passed locally (macOS arm64, go1.27.3).

No live Drive label was changed.

🤖 Generated with Claude Code

The --text, --selection, --integer, --date and --user flags were plain
string slices, so the CLI split each value on commas before
parseDriveLabelFieldAssignment saw it. The documented field=a,b forms
and any text containing a comma failed with "label field assignments
must be field=value". Mark the flags sep:"none" and keep a text value
whole, since a text field holds one value.

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

clawsweeper Bot commented Nov 8, 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:bug Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 8, 2026
@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Preserve commas in Drive label text assignments and pass documented multi-value assignments intact through CLI parsing.

Example: Run gog drive labels file apply file1 label1 --text 'note=Hello, world' --selection status=c1,c2.

  • Before: The command rejects the comma-split arguments with 'label field assignments must be field=value'.
  • After: The request contains text 'Hello, world' and selection values c1 and c2.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused contract-restoring fix with shipped-CLI request evidence, useful regression coverage, and no open findings; hosted validation awaits workflow approval.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The updated body records the fixed gog binary using the documented API relay against a local HTTP stand-in, with intact text and typed comma-separated values in the outgoing modifyLabels request and a successful result; this resolves the earlier built-CLI proof request.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Documented multi-value label flags and text containing commas fail before a request is sent.
Reason: This restores the existing CLI contract with a small correction and meaningful regression coverage.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this PR fixes a documented parsing bug still present on main, and both earlier review blockers are resolved.

Priority: P2
Reviewed head: cc2a5929a125a760fc4c6ddb141ce2100f487cea

Before merge

  • Await maintainer action - Approve the CI, CodeQL, and Docker workflow runs for head cc2a592.

Findings

None.

Agent review details

How this fits together

Kong parses CLI flags, the Drive labels command builds field modifications, and the Google API client sends a modifyLabels request after confirmation.

flowchart LR
A[CLI arguments] --> B[Kong flag parsing]
B --> C[Drive label field modifications]
C --> D[Confirmation and dry run]
D --> E[Google Drive client]
E --> F[Drive modifyLabels endpoint]
Loading

Technical review

Best possible solution:

Land the focused parser correction after the approved workflows pass.

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

Main's flag declarations and assignment parser explain the failure, supported by the contributor's base-failure trace; no target code was run during this read-only review.

Is this the best way to solve the issue?

The change fixes the parsing boundary in the existing command and preserves typed validation, confirmation, and request ownership.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Drive label assignment flags and text parsing keeps the original intent (1faed6b: Expand Google service surfaces with file-label mutations and typed field assignments; the original help already promises comma-separated multi-value fields.)
  • Unreleased changelog keeps the original intent (chore(release): open 0.48.1 development cycle #1307: Open the 0.48.1 development section while preserving finalized release notes.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

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.

Review metrics

Metric Value Why it matters
Patch scope Production +12/-10; tests +60; changelog +2 The regression test exercises CLI parsing and the resulting HTTP request, covering the boundary skipped by existing tests.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • remove status: 📣 needs proof: Current PR status label is status: ⏳ waiting on maintainer.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: Documented Drive label assignments fail for comma-containing values; the impact is limited to this command and fields-json provides a workaround.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • 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-08T16:04:48.650Z sha 9b5e277 :: needs real behavior proof before merge. :: [P3] Add the PR reference to the Unreleased changelog entry

Reviewed November 8, 2026, 2:19 PM ET / 19:19 UTC (Revision 2).

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

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 8, 2026
steipete added a commit that referenced this pull request Nov 14, 2026
Consolidate reproduced command bugs from #1308, #1311-#1319, #1321-#1326 and issues #1328, #1329, #1330, #1331, #1335.

Co-authored-by: Bobby Bones <159389674+saariuslystoned@users.noreply.github.com>
Co-authored-by: Sebastien Tardif <sebtardif@ncf.ca>
@steipete

Copy link
Copy Markdown
Collaborator

Thank you for the fix. I reproduced the claim and consolidated accepting commas inside Drive label field flag values into #1336, with regression coverage and your coauthor credit retained. The full make ci gate, built-CLI checks for the new request-validation fixes, and exact-head GitHub CI passed. Closing this PR as superseded by the merged implementation in #1336.

@steipete steipete closed this Nov 14, 2026
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: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. 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.

2 participants