Repository navigation
Conversation
The internal geocoder/query and geocoder/reverse endpoints used the geocoder-laravel facade, whose Google provider is built from config/geocoder.php when the config loads, before the API key from the settings table is set. Its Chain provider swallowed the resulting failure, so both endpoints returned [] while places/lookup, which goes through Geocoding, resolved the same address. Route both lookups through Geocoding::geocoder() so they share the settings-backed API key, region and locale. Fixes fleetbase/fleetbase#723
Merged
GeocoderController no longer resolves the geocoder-laravel facade, so
the seam test's app('geocoder') stand-in was never consulted and the
unbound fleetops geocoder tried a live Google request.
Place, PlaceSearch and the v1 Place and Driver controllers still called the geocoder-laravel facade. Its Google provider is built from config/geocoder.php when the config loads, before the settings-table API key is set, and its Chain provider swallows the failure, so these lookups silently returned no results (the same bug #408 fixed for the internal geocoder endpoints). They now go through Geocoding::geocoder(). Geocoding::lookupAddress() and lookupCoordinates() return the raw address results; a failed lookup still resolves to an empty collection, so place creation keeps its raw-address fallback, but the failure is now logged instead of hidden. The driver tracking endpoint keeps calling the geocoder directly so its failures still reach Sentry. config/geocoder.php now passes the region where GoogleMaps expects it (it passed the locale) and uses the default cache store instead of a 'geocode' store that does not exist. It only matters for code outside fleetops that still uses the facade. Tests bind 'fleetops.geocoder' stand-ins instead of app('geocoder'). Refs fleetbase/fleetbase#723
With every test injecting fleetops.geocoder, nothing built the live Google geocoder or reached Geocoding::query()'s rethrow, the import raw-address fallback, or PlaceSearch's outer guard.
roncodes
force-pushed
the
fix/geocoder-facade-callers-use-configured-geocoder
branch
from
October 19, 2026 04:48
50006ec to
64cc345
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/v0.6.74 #409 +/- ##
===================================================
Coverage 100.00% 100.00%
- Complexity 13591 13596 +5
===================================================
Files 634 634
Lines 49331 49342 +11
===================================================
+ Hits 49331 49342 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
roncodes
deleted the
fix/geocoder-facade-callers-use-configured-geocoder
branch
October 19, 2026 05:49
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.
Follow-up to #408 for fleetbase/fleetbase#723. Stacked on #408: this branch contains its commit, so merge #408 first. After that, this diff shrinks to this PR's own two commits.
Problem
#408 fixed the internal
geocoder/queryandgeocoder/reverseendpoints. Every other caller of the geocoder-laravel facade had the same bug. The facade builds its Google provider fromconfig/geocoder.phpwhen the config loads, which is before the settings-table API key is set. Its Chain provider then swallows the failure, so the lookup returns nothing:Place::createFromGeocodingLookup,getValuesFromGeocodingLookup,createFromCoordinates,insertFromCoordinatesPlaceSearch::geocode(the plain-text fallback branch)Api\v1\PlaceController::geocodeAddress(address-only place creation)Api\v1\DriverController(locality and country on driver tracking)Change
Geocoding::lookupAddress()andGeocoding::lookupCoordinates()useGeocoding::geocoder()withGeocodeQuery::create/ReverseQuery::fromCoordinatesand returncollect(...->all()), so callers get the same shape as before. A failed lookup still resolves to an empty collection, matching what the facade did. That keeps place creation's raw-address /(0, 0)fallback from turning into a 500 on installs without a Google key. The failure is now logged as a warning instead of hidden.DriverControllercallsGeocoding::geocoder()directly. Its existing try/catch still reports geocoder failures to Sentry.server/src.config/geocoder.phpI fixed this file rather than deleting it. Removing it would make the facade fall back to the package's default config, which adds a GeoPlugin provider. Code outside fleetops may still resolve
app('geocoder').GoogleMapsargument is the region, but the file passed the locale. It now passesenv('GOOGLE_MAPS_REGION').'geocode', which is not defined anywhere. It is nownull, the default store.Tests
fleetops.geocoder(geocodeQuery/reverseQuery/all) instead ofapp('geocoder'). TheGeocoder::clearResolvedInstances()calls are gone.fleetops.geocoder: building the live Google geocoder,Geocoding::query()rethrowing, the import raw-address fallback, andPlaceSearch's outer guard. The full suite passes locally with the 100% coverage gate.fleetops.geocoderwas unbound. They now bind a geocoder that throws on purpose.lookupAddress/lookupCoordinatesreturn raw addresses, log failures and return empty results, andcreateFromGeocodingLookupkeeps its raw-address fallback.php scripts/pest-runner.php --debug <file>(exit 0). php-cs-fixer is clean.Follow-up outside this repo
storefront'sServiceQuoteControllerContractsTestandOrderEditorApplyCoverageTestbindapp('geocoder')stand-ins for fleetops place creation. They should move tofleetops.geocodertoo.Refs fleetbase/fleetbase#723