Skip to content

fix(sites): keep requested false bools in sites get JSON - #1308

Closed
SebTardif wants to merge 2 commits into
openclaw:mainfrom
SebTardif:fix/sites-get-false-bools
Closed

SebTardif wants to merge 2 commits into
openclaw:mainfrom
SebTardif:fix/sites-get-false-bools

Conversation

@SebTardif

@SebTardif SebTardif commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

gog sites get --json drops requested false booleans. The command asks Drive for driveFileGetFields (which includes starred and hasThumbnail) or for a custom --fields mask, then JSON-encodes the drive.File. Those bools are tagged omitempty, and sites get did not set ForceSendFields.

An unstarred site with no thumbnail therefore omits both starred and hasThumbnail. A custom mask that names trashed omits trashed when the file is not trashed. gog drive get --json already calls forceRequestedDriveFileBools before it writes JSON. Sites list and search go through writeDriveFileList, which does the same. Sites get now calls that same helper.

This was introduced with Google Sites support in #574 (2026-05-10) and has been present for 179 days.

Evidence

Shipped bin/gog from commit 4376d004fd5f12f24951aee000b8909a31ced7f5 (v0.48.0-3-g4376d004) was run against a local Drive stand-in at http://127.0.0.1:61660. GOG_GOOGLE_API_BASE_URL forwarded the Drive files.get call there. The stand-in is not Google. Both requests had no Authorization header, and X-Forwarded-Host was www.googleapis.com.

The stand-in returned starred, hasThumbnail, and trashed as false on both calls. The default call also returned name and mimeType.

$ ./bin/gog version
v0.48.0-3-g4376d004 (4376d004fd5f 2026-11-05T23:00:26Z)

$ ./bin/gog sites get site1 --json
{
  "site": {
    "hasThumbnail": false,
    "id": "site1",
    "mimeType": "application/vnd.google-apps.site",
    "name": "Team Site",
    "starred": false
  }
}

$ ./bin/gog sites get site1 --fields id,name,trashed --json
{
  "site": {
    "id": "site1",
    "name": "Team Site",
    "trashed": false
  }
}

Default JSON includes "starred": false and "hasThumbnail": false. It does not include trashed, even though the stand-in sent "trashed": false. The custom command includes "trashed": false and does not add starred or hasThumbnail, even though the stand-in sent both as false.

Real behavior proof

  • Behavior or issue addressed: gog sites get --json omitted requested false booleans. An unstarred site with no thumbnail lost starred and hasThumbnail. --fields id,name,trashed lost trashed when the site was not trashed.
  • Real environment tested: macOS, Go 1.27.3, built /tmp/pr-wave/gogcli/bin/gog at 4376d004fd5f (v0.48.0-3-g4376d004). GOG_GOOGLE_API_BASE_URL was http://127.0.0.1:61660, a local Drive stand-in. GOG_ACCOUNT was the label local@standin.test. GOG_HOME was /tmp/gog-f032-proof/home. No Google account was used.
  • Exact steps or command run after this patch:
cd /tmp/pr-wave/gogcli
GOG_HOME=/tmp/gog-f032-proof/home \
GOG_ACCOUNT=local@standin.test \
GOG_GOOGLE_API_BASE_URL=http://127.0.0.1:61660 \
./bin/gog version

GOG_HOME=/tmp/gog-f032-proof/home \
GOG_ACCOUNT=local@standin.test \
GOG_GOOGLE_API_BASE_URL=http://127.0.0.1:61660 \
./bin/gog sites get site1 --json

GOG_HOME=/tmp/gog-f032-proof/home \
GOG_ACCOUNT=local@standin.test \
GOG_GOOGLE_API_BASE_URL=http://127.0.0.1:61660 \
./bin/gog sites get site1 --fields id,name,trashed --json
  • Evidence after fix: terminal output from that binary, then the stand-in log for the same two calls:
$ ./bin/gog version
v0.48.0-3-g4376d004 (4376d004fd5f 2026-11-05T23:00:26Z)

$ ./bin/gog sites get site1 --json
{
  "site": {
    "hasThumbnail": false,
    "id": "site1",
    "mimeType": "application/vnd.google-apps.site",
    "name": "Team Site",
    "starred": false
  }
}

$ ./bin/gog sites get site1 --fields id,name,trashed --json
{
  "site": {
    "id": "site1",
    "name": "Team Site",
    "trashed": false
  }
}
STANDIN GET /drive/v3/files/site1 auth False fwd www.googleapis.com
STANDIN body {"id": "site1", "name": "Team Site", "mimeType": "application/vnd.google-apps.site", "starred": false, "hasThumbnail": false, "trashed": false}
STANDIN GET /drive/v3/files/site1 auth False fwd www.googleapis.com
STANDIN body {"id": "site1", "name": "Team Site", "starred": false, "hasThumbnail": false, "trashed": false}

auth False means the request had no Authorization header.

  • Observed result after fix: Default JSON includes "starred": false and "hasThumbnail": false and leaves out trashed. The custom mask includes "trashed": false and does not add the unrequested false fields starred or hasThumbnail.
  • What was not tested: a signed-in Google account. This machine has no Sites credential, so both commands used the local stand-in only.

Testing

  • This commit changes CHANGELOG.md only. gofmt was not run because no Go file changed. SitesGetCmd still calls forceRequestedDriveFileBools before WriteJSON.
  • go test ./internal/cmd/ -count=1 -timeout 20m -vet=off -run TestSitesGet_JSONKeepsRequestedFalseBools completed (ok, 0.427s).
  • make build produced bin/gog v0.48.0-3-g4376d004.

Sites get encoded the Drive file without ForceSendFields. Boolean
fields tagged omitempty dropped starred and hasThumbnail when false,
and a custom mask dropped trashed the same way. Drive get already
calls forceRequestedDriveFileBools before it writes JSON.

The regression covers an unstarred site with no thumbnail and a
custom mask that requests trashed.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
@clawsweeper

clawsweeper Bot commented Nov 5, 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: 🧂 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:bug Preliminary submission classification; full source review pending. labels Nov 5, 2026
@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Preserve requested false boolean values in Google Sites metadata JSON.

Example: Run gog sites get site1 --fields id,name,trashed --json for the untrashed Team Site.

  • Before: The site object omits trashed.
  • After: The site object includes "trashed": false without adding unrequested false booleans.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A minimal, contract-preserving repair with focused command coverage and supplied shipped-CLI proof; ordinary exact-head CI remains in progress.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Exact-head macOS bin/gog output exercises SitesGetCmd through the shipped CLI and real Drive client against a local HTTP stand-in: default JSON retains false starred/hasThumbnail, and the custom mask retains false trashed while omitting unrequested false fields; matching transport logs support both calls, without claiming live Google-account validation.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Scripts cannot distinguish requested false Sites metadata from omitted metadata in JSON output.
Reason: This restores the existing shared Drive metadata contract without adding options or changing request defaults.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current-main Sites JSON omission with the existing shared helper; the earlier changelog finding is resolved, and no actionable defects remain.

Priority: P2
Reviewed head: 4376d004fd5f12f24951aee000b8909a31ced7f5

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Sites CLI requests metadata through the Drive client, preserves boolean fields selected by the request mask, and writes a site JSON envelope to stdout.

flowchart LR
 A[Sites get command] --> B[Drive metadata request]
 B --> C[Drive file response]
 C --> D[Requested boolean helper]
 D --> E[Site JSON envelope]
 E --> F[Standard output]
Loading

Technical review

Best possible solution:

Land the one-line shared-helper integration with its focused regression coverage and corrected Unreleased entry.

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

Current-main Sites get omits the shared preservation step before SDK JSON serialization; the added command regression covers both affected masks, and this review ran no target code.

Is this the best way to solve the issue?

Reusing the existing helper is the smallest complete fix and preserves the established mask and conditional-field contracts.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Shadow: Raw commit 806d1b0 adds internal/cmd/sites.go:102 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 806d1b01088a; files: internal/cmd/sites.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.

Review metrics

Metric Value Why it matters
Change scope Production +1 line; tests +89 lines; changelog +2 lines The production fix reuses the existing serializer owner, while two command scenarios check requested-field retention and unrequested-field omission.

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: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Requested false metadata disappears from Sites machine-readable output, affecting scripts with a limited blast radius.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • 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-05T22:53:23.438Z sha 5d30108 :: needs real behavior proof before merge. :: [P3] Add the required changelog reference and contributor credit

Reviewed November 5, 2026, 6:10 PM ET / 23:10 UTC (Revision 2).

AGENTS.md requires a pull request reference and contributor thanks
on a user-visible Unreleased change. The sites get line had neither.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
@SebTardif

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review
The changelog entry credits this pull request and @SebTardif. The shipped gog binary was run against a local Drive stand-in. Evidence is in the body.

@clawsweeper

clawsweeper Bot commented Nov 5, 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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 5, 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 preserving requested false values in Sites metadata JSON 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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants