Fix Google Photos Picker discovery#1203
Conversation
Greptile SummaryThis PR fixes Google Photos Picker, Forms, and Keep discovery by routing their URLs to service-hosted endpoints instead of the central
Confidence Score: 5/5Safe to merge. The change is additive: a narrow override map for three known-broken services, with all other services unaffected. All changed paths are covered by targeted unit tests. The URL normalization function is well-exercised in both directions for each overridden service. The scope injection logic is additive and only activates when a document omits metadata. The React change is display-only. No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "Handle central Google discovery override..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e91270abe9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return override?.preserveServiceHostedUrl === true | ||
| ? `https://${host}/$discovery/rest?version=${version}` | ||
| : `${DISCOVERY_SERVICE_HOST}/${service}/${version}/rest`; |
There was a problem hiding this comment.
Route central overrides through service hosts
When a user or existing stored config supplies https://www.googleapis.com/discovery/v1/apis/{forms|keep|photospicker}/v1/rest, the earlier www.googleapis.com branch returns the same central URL before this override runs, so fetchGoogleDiscoveryDocument still fetches the 404 endpoint this fix is trying to avoid. Please apply the override in the central branch too, or reject those central URLs, so refresh/manual add paths using normalized central URLs do not keep failing.
Useful? React with 👍 / 👎.
d2a0e7d to
3ff0a97
Compare
Summary
Fix Google APIs whose live Discovery documents only work at their service-hosted URL. This covers Google Photos Picker, Forms, and Keep. Also show required OAuth scopes in the generic OAuth app registration form.
Bug
I added Google Photos Picker support and the Picker bug in the same PR, so there was never a known-good upstream Picker path.
Picker's live Discovery URL is
https://photospicker.googleapis.com/$discovery/rest?version=v1; the rewritten central URL returns 404. Its live document also omits OAuth scope metadata, so Picker could be added without the requiredhttps://www.googleapis.com/auth/photospicker.mediaitems.readonlyscope.The test fixture missed this because it was more complete than Google's live document. While validating the deployed fix, the default Google bundle exposed the same service-hosted-only Discovery issue for Forms and Keep.
Introduced in: #1137
Related normalizer change: #1106
Fix
The UI change is disclosure-only. It does not request new permissions.
Screenshot
Validation
bun run --cwd packages/plugins/google test -- src/sdk/discovery.test.ts src/sdk/plugin.test.tsbun run --cwd packages/react test -- src/components/oauth-client-form.test.tsexecutor v1.5.23:/returns 200 and/mcpreturns unauthenticated 401.