Skip to content

Wire the OSM SoA bake into the /osm cockpit (endpoint + overlay), and scope the V1→V3 key migration - #108

Merged
AdaWorldAPI merged 4 commits into
mainfrom
claude/q2-osm-map-reencoding-56p5e2
Aug 10, 2026
Merged

Wire the OSM SoA bake into the /osm cockpit (endpoint + overlay), and scope the V1→V3 key migration#108
AdaWorldAPI merged 4 commits into
mainfrom
claude/q2-osm-map-reencoding-56p5e2

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Connects two halves that were built to meet and never wired: openstreetmap-website-rs produces a Morton-sorted V3 slab of real OSM rows, and q2's /osm cockpit renders a slippy map — but only ever fetched raster tiles. The bake had no consumer; the cockpit had no real feature data.

What lands

GET /api/osm/features/:z/:x/:y (osm_features.rs) — mmaps the baked RowSlab at OSM_SLAB_PATH, calls tile_range(z,x,y) with raw OSM-XYZ, decodes morton_at → lon/lat and read_identity(entity_type, ordinal). Caps rows per tile but reports total alongside returned, so a dense tile is honest about truncation rather than looking complete. Unset/unopenable slab ⇒ 503, never a panic.

Feature overlay in /osm (osm.rs) — fetches visible tiles and draws points over the basemap, positioned in the same tile-pixel space as the raster <img>s (including the tx - wx world-wrap correction, so markers stay under the right world copy at low zoom / across ±180°). Opt-in toggle mirroring the Garmin drape's posture, with a status line for loading / no-slab / truncated.

The key-space finding, measured

The plan documents a real V1/V2 → V3 gap, and the measurement is the point:

q2 osm_tiles.rs V3 substrate
tiers 3 (heel/hip/twig) 4 (+leaf)
depth z=24 z=32
Y axis XYZ TMS flip
round-trip error 0.27–1.69 m 1.13 mm

The bake side was never V1osm-soa-bake::identity consumes lance_graph_contract::identity_quad at classid(4)+payload(12), the four cascade tiers occupy GEO_V3_FACET rails 0–3, and the baked artifact self-reports classid 0x0F011000 (GEO_DOMAIN | CLASSVIEW_V3_SUBSTRATE). Only q2's displayed address is V1, and it is additionally a parallel implementation of math osm_soa_bake::tms already owns.

Because cockpit-server is binary-only and its test binary would not link here, the divergence was falsified where it could build — a probe copying q2's tile_to_hhtl / morton_interleave / lonlat_to_tile verbatim against the real tms::point_to_tiers. Every tier differs at every point (Berlin heel=0x624b vs 0xc8e1). Those V3 values are recorded as the expected-value fixture the migration must reproduce.

The falsifier test is written out in the plan but deliberately not committed. It fails against current V1 code — that is its job — and landing it beside an implementation I could not execute would ship a coordinate-key migration whose correctness was never observed. A wrong key silently mis-addresses every row. It should land with the migration, on a machine that can link, and be seen to go red-then-green.

Importantly: the overlay renders correctly without that migration, since the query path already goes through tile_range. Phase 3 makes the displayed address agree with the slab's key.

Slab provenance

Berlin baked and published this session: 2,525,052 rows / 1,292,826,624 bytes / 37.3s, under the same <repo>/bakes/<version>/ + SHA256SUMS convention as the existing bakes, with sizes read back after upload.

Verification status — honest

  • cargo check -p cockpit-server --testsclean, zero errors (full compile-time check incl. tests).
  • Embedded overlay JS extracted and node --check'd — clean (a Rust compiler can't see inside that string literal).
  • Phase-1 tests passed 3/3 earlier in the session, including a genuine anti-vacuity falsifier.
  • Not done: a browser load of /osm against a real slab. Linking cockpit-server repeatedly exhausted this environment's disk (one attempt crashed LLVM on an untouched dependency). That end-to-end check remains the gating item and should be the first thing done where the binary can link.

Draft until that runs.


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Added an optional OSM feature overlay to the /osm cockpit.
    • Display point markers for features visible within the current map area.
    • Added loading, availability, result-count, and truncation status indicators.
    • Added a tile-based API for retrieving OSM features and supporting large baked datasets.
  • Bug Fixes

    • Improved handling of unavailable data sources and temporary feature-query failures.

claude added 4 commits August 8, 2026 13:05
Adds osm-soa-bake as a sibling path dependency and a new handler that
queries the Morton-sorted RowSlab directly (raw OSM-XYZ z/x/y, never
through osm_tiles::tile_to_hhtl — that's a different, display-only
3-tier key). Reads the baked slab via mmap from OSM_SLAB_PATH, decodes
position + identity per row, caps the response and reports total vs
returned for dense tiles.

TDD: cross-checks tile_range against two independently-implemented
forward-geometry functions (osm-soa-bake's point_to_tms_morton and
q2's own osm_tiles::lonlat_to_tile) so the anti-vacuity test can't
pass by accident.

Phase 1 of claude-notes/plans/2026-08-08-osm-soa-cockpit-wiring.md.
Build/test verification still in progress; Phase 2 (GUI overlay) not
started.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NMeiLmtDKhomJNSo2ecbJw
Wires the /osm slippy map's client JS to the /api/osm/features/:z/:x/:y
endpoint added in Phase 1: fetches real OSM rows for tiles in view from
the baked RowSlab and renders them as points layered on the raster
basemap, using the same tile-pixel coordinate space (and world-wrap
offset correction) as the existing raster tile images so they inherit
pan/zoom for free. Opt-in via a new toggle button (mirrors the Garmin
drape's posture) with a status readout for loading / no-slab-baked /
truncated-tile states.

Verification: cargo check -p cockpit-server --tests passed clean
(full compile-time check of the whole crate, zero errors); the embedded
JS was independently syntax-checked with `node --check`. A live browser
run against a real baked slab was not completed this session — see the
Phase-2 verification note in the plan for why (disk exhaustion in this
environment prevented linking cockpit-server's binary/test artifacts
across five separate attempts, including one that crashed LLVM on an
unrelated dependency). That end-to-end check is the first thing a
follow-up session should do.
…g leg

Phase 3 records the measured V1/V2 vs V3 delta for the /osm endpoint.
The bake side is already fully V3 (osm-soa-bake::identity consumes
lance_graph_contract::identity_quad at classid(4)+payload(12); the row's
four cascade tiers occupy GEO_V3_FACET rails 0-3). The only V1 surface
left is cockpit-server's osm_tiles.rs: 3 tiers at z=24, XYZ (no TMS
flip), 48-bit morton -- and it is a parallel implementation of math
osm-soa-bake::tms already owns, so the migration is mostly deletion.

Phase 4 records the operator-directed slab-hosting story: S3 as scratch
plus RAILWAY_VOL, following the existing lance-graph hydration-lifecycle
and MedCare-rs bake_s3 precedent rather than inventing one. Credentials
stay in the environment; /volume01 is Railway-side and absent locally,
so that leg is noted as deploy-only-verifiable.

No code changes -- scoping only, with two-sided falsifiers specified.
Two concrete results, both measured rather than inferred.

1. The V1/V3 divergence is now a number, not a reading of constants.
   cockpit-server is binary-only and its test binary cannot be linked in
   this environment, so the falsification ran where it can build: a
   throwaway probe that copies q2's tile_to_hhtl / morton_interleave /
   lonlat_to_tile verbatim and compares them against the real
   tms::point_to_tiers. Every tier differs at Berlin, Reykjavik and
   Sydney. The V3 column is recorded as the expected-value fixture the
   migration must reproduce.

   The falsifier test itself is written out in the plan but deliberately
   NOT committed: it fails against current V1 code (that is its job), and
   landing it together with an unverifiable implementation would ship a
   coordinate-key migration whose correctness was never observed. A wrong
   key silently mis-addresses every row.

2. The Berlin slab is baked and uploaded. 2,525,052 rows / 1.20 GiB,
   classid 0x0F011000 (GEO_DOMAIN | CLASSVIEW_V3_SUBSTRATE) -- the
   artifact asserting its own V3-ness, which means the slab was never V1;
   only q2's display key is. Stored under the same <repo>/bakes/<version>/
   + SHA256SUMS convention the existing bakes use, with checksums recorded
   so the hydrate path can verify rather than trust.
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7209cf30-a2ab-4b2a-ab57-933938faab74

📥 Commits

Reviewing files that changed from the base of the PR and between e67cc2f and 57b46f2.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • claude-notes/plans/2026-08-08-osm-soa-cockpit-wiring.md
  • crates/cockpit-server/Cargo.toml
  • crates/cockpit-server/src/main.rs
  • crates/cockpit-server/src/osm.rs
  • crates/cockpit-server/src/osm_features.rs

📝 Walkthrough

Walkthrough

The change adds an OSM feature API backed by a memory-mapped slab and connects it to an optional cockpit map overlay. It adds query tests and documents completed integration work plus planned V3 key migration and production slab hosting.

Changes

OSM SoA cockpit overlay

Layer / File(s) Summary
Integration plan and completed phases
claude-notes/plans/...
The plan records server integration, client overlay behavior, verification results, tile-key incompatibilities, and incomplete deployment work.
Slab query endpoint
crates/cockpit-server/Cargo.toml, crates/cockpit-server/src/main.rs, crates/cockpit-server/src/osm_features.rs
The server loads OSM_SLAB_PATH, queries RowSlab tile ranges, decodes feature coordinates and optional identities, caps results at 5,000, and returns 503, 500, or serialized tile data. Synthetic slab tests cover disjoint ranges, row recovery, and empty results.
Map feature overlay
crates/cockpit-server/src/osm.rs
The map adds an opt-in feature toggle, cached tile requests, loading and availability status, capped-result counts, point markers, world wrapping, and toggle handling.
V3 migration and slab hosting plan
claude-notes/plans/...
The plan defines V3 key migration and S3-to-Railway volume hydration. It records checksum data, deferred codebook-based ID recovery, and the uncommitted local slab artifact.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant OSMMap
  participant osm_features_handler
  participant RowSlab
  OSMMap->>osm_features_handler: Request visible tile features
  osm_features_handler->>RowSlab: Query raw OSM XYZ tile range
  RowSlab-->>osm_features_handler: Return matching slab rows
  osm_features_handler-->>OSMMap: Return capped features and counts
  OSMMap->>OSMMap: Render cached point markers
Loading

Suggested reviewers: claude

Poem

A rabbit hops where map tiles gleam,
Slab rows flow like a data stream.
Points appear, cached and bright,
Wrapped across the world in flight.
V3 plans wait beyond the gate.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cursor

cursor Bot commented Aug 10, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_71d71d89-e06c-4543-95e6-dce8c146a4bb)

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review August 10, 2026 22:11
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

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