fix(worker): treat empty EXIF GPS as missing location and backfill Null Island rows #1272
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/gps-null-island"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary\n- Empty/undef EXIF GPS IFDs (every GPS rational 0/0, both hemisphere Refs empty — verified on real Samsung Galaxy S25+ JPEGs) parsed to exactly (0.0, 0.0) in the media worker (metadata-extractor 2.19.0
GpsDirectory.getGeoLocation()accepts empty strings + 0/0 rationals) and were ingested aslocation_source='embedded_exif'at Null Island, poisoning location-based album-suggestion clustering.\n- worker-media:extractEmbeddedLocationnow omits a (0.0, 0.0) fix when the GPS rationals are missing/zero-denominator or both Refs are blank; genuine (0,0) fixes with well-formed N/E refs are preserved (dedicated test).\n- api:WorkerResultService.location()defensively treats an incoming exact (0.0, 0.0) claim as no location; single-axis zeros (e.g. 0.0/10.3 on the equator) stay untouched, and the existing COALESCE semantics keep prior values.\n- Migration V169: backfills existingmedia_itemsrows with latitude = 0 AND longitude = 0 to NULL (also NULLslocation_source;location_updated_atkept). V168 was already taken on this base.\n\nProduction impact check before deploy:SELECT COUNT(*) FROM media_items WHERE latitude = 0 AND longitude = 0;(~hundreds of rows for this install; all photos since 2026-07-12 are affected).\n\n## Validation\n-rtk ./gradlew :apps:worker-media:test --tests '*MediaJobHandlersTest*'→ BUILD SUCCESSFUL, 58 tests, 0 failures (incl. new empty-GPS-IFD→no-location and genuine-(0,0)→kept tests).\n-rtk ./gradlew :apps:api:test --tests '*WorkerResultLocationIngestTest*' --tests '*WorkerResultIssueClassificationTest*' --tests '*WorkerResultClassInstanceCandidateTest*'→ BUILD SUCCESSFUL, 9 tests, 0 failures.\n- Negative-checked both guards: with each guard stashed, the new tests fail; restored and re-verified green.\n\n## Note\nThe GPS values themselves cannot be recovered from the stored originals (the files genuinely carry empty GPS) — this fix only stops the corruption going forward and cleans existing rows; affected photos simply have no location.