Skip to content

feat(places): promote confirmed OSM venue picks into the places catalogue - #119

Merged
bryanfawcett merged 1 commit into
mainfrom
claude/authkit-events-blank-fdljas
Aug 4, 2026
Merged

feat(places): promote confirmed OSM venue picks into the places catalogue#119
bryanfawcett merged 1 commit into
mainfrom
claude/authkit-events-blank-fdljas

Conversation

@bryanfawcett

Copy link
Copy Markdown
Contributor

Summary

  • Closes the remaining "search and creation" gap from the earlier investigation (fix(auth,events,places,og): stale WorkOS domain, venue timezone, place search, OG redesign #118, merged): geocodeAddress already searched places.places first and fell back to Nominatim, but a Nominatim hit was used for exactly one event and then forgotten — it never got promoted into the DB catalogue, so the next search for the same venue hit Nominatim again instead of the (much faster, richer) DB tier.
  • ensurePlaceFromOsmSuggestion now runs when a host confirms an OSM/Nominatim suggestion in the location picker (LocationModal). It's idempotent (keyed on sourceProvenance.legacyId, the same convention the platform's own OSM ingestion pipeline uses — verified against live sample docs), enriches the pick via a single-element Overpass API lookup to infer a placeType from the closed enum, and writes a paired external/organization entity alongside the place (every place needs an entity owner per the validator).
  • Both document shapes were verified directly against the real production places/entity Atlas validators (insert → confirm accepted → delete) before wiring this up, since a malformed write to a platform-owned schema is expensive to get wrong.

Type of Change

  • New feature (non-breaking change that adds functionality)

Changes

  • src/app/actions/geocode.tsensurePlaceFromOsmSuggestion, fetchOverpassTags (Overpass single-element tag lookup), inferPlaceType (OSM tag → PlaceDoc.placeType enum mapping), osmType/osmId added to GeocodeSuggestion.
  • src/components/ui/address-autocomplete.tsx — carries source/osmType/osmId through AddressComponents.
  • src/components/modals/location-modal.tsx — calls ensurePlaceFromOsmSuggestion (fire-and-forget) when an OSM-sourced suggestion is confirmed.
  • src/app/actions/geocode.test.ts — idempotency, successful create + tag-based placeType inference, Overpass-unreachable fallback, and never-throws coverage.

Test Plan

  • Existing tests pass (npm run test:run — 792 passed)
  • New tests added for this change (ensurePlaceFromOsmSuggestion: 4 new cases)
  • Lint passes (npm run lint)
  • Build succeeds (npm run build)
  • Manual testing performed — both the entity and place document shapes were inserted into the real production collections, confirmed accepted by the Atlas JSON-Schema validators, then deleted immediately (no test data left behind)

Checklist


Generated by Claude Code

…ogue

Closes the remaining "search and creation" gap: geocodeAddress already
searched places.places first, falling back to Nominatim -- but a
Nominatim hit was used for exactly one event and then forgotten, never
making future searches for the same venue hit the DB tier.

ensurePlaceFromOsmSuggestion (src/app/actions/geocode.ts) now runs when
a host confirms an OSM/Nominatim suggestion in the location picker:

- Idempotent on sourceProvenance.legacyId ("<osmType>/<osmId>") -- the
  same key the platform's own OSM ingestion pipeline uses, confirmed
  against live places.places sample docs, so re-picking the same venue
  never inserts a duplicate.
- Fetches the element's tags from the Overpass API (a single-element
  lookup, not a wide search -- fast, low load) to infer a placeType
  from the closed enum (tourism=hotel -> Accommodation, amenity=
  restaurant -> Restaurant, shop=* -> Store, etc.), falling back to
  LocalBusiness when Overpass is unreachable or the tag doesn't map.
- Writes a paired external/organization entity alongside the place
  (Rule 10 -- every place needs an entity owner), mirroring the exact
  shape every OSM-sourced row in the catalogue already has.
- Never throws -- a catalogue-write failure can't block whatever the
  caller was actually doing (picking a venue for an event).

Verified both document shapes directly against the real production
places/entity validators (insert, confirm accepted, delete) before
wiring this up, since a malformed write to a schema owned by the wider
Mukoko platform is expensive to get wrong.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sn4ULkV3dFFxEq5x3nCdaX
@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nhimbe Ready Ready Preview Aug 3, 2026 11:52pm

Request Review

@claude

claude Bot commented Aug 3, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

@bryanfawcett
bryanfawcett marked this pull request as ready for review August 4, 2026 02:47

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@bryanfawcett
bryanfawcett merged commit ba64d95 into main Aug 4, 2026
17 checks passed
@bryanfawcett
bryanfawcett deleted the claude/authkit-events-blank-fdljas branch August 4, 2026 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants