fix(api): support service-hosted Discovery documents - #1049
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 5:04 AM ET / 09:04 UTC. ClawSweeper reviewWhat this changesThe PR retries a central Google Discovery Directory 404 at a safely derived service-hosted document URL and adds fallback-boundary tests. Merge readiness✅ Ready for maintainer review This clean, proof-positive PR should remain open for normal maintainer merge review; the linked Discovery retrieval bug is not fixed on current main yet. Priority: P2 Review scores
Verification
How this fits togetherGeneric flowchart LR
A[Generic API command] --> B[Discovery document client]
B --> C[Central Discovery Directory]
C --> D{Document found?}
D -->|Yes| E[Resolve API method]
D -->|Default-directory 404| F[Service-hosted document]
F --> E
E --> G[Build API request]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Merge the narrow fallback with its boundary tests while retaining the existing target-URL validation for authenticated calls. Do we have a high-confidence way to reproduce the issue? Yes: the supplied credential-free terminal evidence and independent collaborator review reproduce the central Directory 404 on main and show success at this exact PR head. Is this the best way to solve the issue? Yes: limiting fallback to a default-directory 404 and a validated service-derived HTTPS host is a compatible, maintainable repair. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against be4037f7c8f6. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
LAND recommended for head $ gog api describe meet v2 meet.conferenceRecords.list
{"id":"meet.conferenceRecords.list","method":"GET","path":"v2/conferenceRecords"}
exit 0
$ gog --dry-run api call meet v2 meet.conferenceRecords.list --params '{"pageSize":1}'
Dry run: would api.call
{"api":"meet","has_body":false,"http_method":"GET","method":"meet.conferenceRecords.list","url":"https://meet.googleapis.com/v2/conferenceRecords?pageSize=1","version":"v2"}
exit 0The first JSON above projects the method ID, HTTP method, and path from the command output. No code correction was needed. The maintainer landing should add the changelog entry thanking @goutamadwant and retain contributor credit. |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(api): support service-hosted Discovery documents This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Landed in e7dede7 with contributor credit, changelog thanks, and a README note. Full local |
Closes #1048
What Problem This Solves
Fixes an issue where
gog api describeandgog api callreturned a central Discovery Directory 404 for APIs such as Meet v2 whose Discovery document is published only on the service host.Why This Change Was Made
The Discovery client now retries a default-directory 404 against the safely constructed
{api}.googleapis.com/$discovery/rest?version={version}URL. ExplicitGOG_DISCOVERY_BASE_URLoverrides, non-404 responses, and unsafe service names do not trigger fallback. Existing OAuth request and redirect host validation remains unchanged.User Impact
Generic API commands can resolve service-hosted Discovery documents, including Meet v2 resources not exposed by first-class commands, without brittle environment-variable URL fragments.
Evidence
go test ./internal/discoveryapi ./internal/cmdmake cigo run ./cmd/gog api describe meet v2 meet.conferenceRecords.listgo run ./cmd/gog --dry-run api call meet v2 meet.conferenceRecords.list --params '{"pageSize":1}'The regression test fails on current main at the central Directory 404 and passes after the fallback. The credential-free live command resolves the official Meet v2 Discovery document, and the dry run builds
https://meet.googleapis.com/v2/conferenceRecords?pageSize=1.Captured after-fix terminal output (no account or credentials used):
Limitations
The fallback only runs after a 404 from the implicit default central Directory. It does not apply to explicit Discovery base overrides, non-404 responses, or service names that are not safe DNS labels. No authenticated Meet API request was made.
Disclosure: AI was used to understand the codebase and review the fix.