fix: stop CI failing on forked PRs for want of a geocoding key - #908
Open
edwh wants to merge 1 commit into
Open
Conversation
CircleCI does not pass project environment variables to jobs built from forked pull requests, so GOOGLE_API_CONSOLE_KEY is empty on those runs. Every geocode then returns false, group creation 422s on groups.geocode_failed, and the Playwright suite fails at its first createGroup() - so all 50 tests fail and the job times out, looking exactly like the contributor having broken something. That is what is happening on #906, whose diff removes eleven unused component registrations and cannot affect group creation at all: none of the changed components is reachable from the create page. Adds a StubGeocoder answering from a fixed table, used only when GEOCODER_STUB is set, which CI sets only when it has no key. It keeps the ForceGeocodeFailure sentinel failing, and falls back to London for an unlisted place so a new test fails on what it is testing rather than on the stub. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
edwh
force-pushed
the
fix/e2e-geocoder-without-api-key
branch
2 times, most recently
from
September 8, 2026 16:17
613788a to
1ca8e77
Compare
Collaborator
Author
|
Verified the stub path rather than assuming it, since this repo's own runs always have the real key and so never exercise it. Pushed a throwaway commit forcing So the container really did resolve the stub, and the full Playwright suite passed with it in play — which is what a forked PR will get. That commit is now dropped; the branch is back to the clean version, which had already passed green on its own (pipeline #5007). |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



The symptom
Forked pull requests fail CI in a way that looks like the contributor broke everything: all 50 Playwright tests fail at
createGroup, and the job times out. #906 is the current example — 2 of 50 passing, on a diff that only removes unused component registrations.The cause
CircleCI doesn't pass project environment variables to jobs built from forked PRs, so
GOOGLE_API_CONSOLE_KEYis empty on those runs.The evidence is in the logs: on a
developrun the string "restarters" is masked 68 times (a project env var's value), while #906's log has no masked strings at all — nothing was injected.With no key,
Geocoder::geocode()returnsfalse,API\GroupControllerthrowsValidationExceptionongroups.geocode_failed, the create form 422s and never redirects to/edit/, andwaitForURL('**/edit/**')times out. Every test callscreateGroup, so every test fails, from the first one.Reproduced locally: blanking the key makes
geocode('London')returnfalse.The fix
A
StubGeocoderanswering from a fixed table, bound only whenGEOCODER_STUBis set — which CI sets only when there's no key, so runs on this repo still exercise the real geocoder, and production can't reach it.It keeps the
ForceGeocodeFailuresentinel failing, and falls back to London for an unlisted place so a new test fails on what it's actually testing.The alternative — turning on CircleCI's "pass secrets to forked PRs" — would hand the project's API keys to anyone who opens a fork PR. Not worth it for a geocoding lookup the tests don't need to be real.
Tests
6 unit tests: the stub is off unless deliberately enabled, it satisfies the
Geocodercontract, it answers the address the e2e suite actually types, it ignores case and whitespace, it falls back rather than failing, and it still fails for the sentinel. ExistingGeocoderTeststill passes.Note for #906
Because CircleCI builds the fork's head rather than a merge, #906 will keep failing until this lands and that branch merges
develop.🤖 Generated with Claude Code