cockpit-server: serve tile shapes from Lance instead of the eager singleton - #139
Conversation
…er singleton Wires the Lance datasets built by the boot-time conversion (previous commit) into the two highest-volume request handlers, removing the permanent Vec/String residency on the hot path. osm_chains_books_lance.rs: RequestChains/RequestBooks (request-scoped, dropped at the end of each request) + gather_chains/gather_books (one batched Lance take_rows per table, cached Dataset handles via tokio::sync::OnceCell — metadata only, not row data). 2 new tests proving a gather returns exactly the requested ordinals and nothing else (a leaked non-requested ordinal would pass a weaker assertion). osm_features.rs: - sample_tile_rows: the tile-row sampling factored out of query_tile_shapes, so the async gather phase and the sync resolve phase share one sampling implementation (never two that can drift, per this file's own documented lesson about osm_tiles' old V1/V3 key split). - ChainsHandle/BooksHandle: enums dispatching between the Lance-gathered source and the eager resident singleton (fallback only). Plain enums rather than traits, since both arms already share the same inherent method shape. - tile_sources: the async gather-then-serve orchestration, called by osm_tile_geometry_bin_handler and osm_tile_geometry_handler before the existing sync query_tile_shapes/query_tile_geometry. Deliberately deferred (documented in the plan file, not silently dropped): query_feature/query_geometry (single-row endpoints) and osm_health_handler (needs a cheap header-only digest check that doesn't exist yet) still use the eager singletons. The tile handlers are the highest-volume path — every map pan/zoom hits one of them. Verified: cargo check -p cockpit-server --tests (clean), cargo nextest run -p cockpit-server --bin q2-cockpit osm_features (20/20) and osm_chains_books_lance (7/7). Full workspace verification deferred per this session's disk constraints (see plan file).
|
Important Review available on request
Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 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. Comment |
Bugbot couldn't run - usage limit reachedBugbot 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_211dcbc9-2f3c-4a0a-bd43-404500ce97a2) |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
Follow-up to #138 (merged): wires the Lance datasets built by the boot-time conversion into the two highest-volume request handlers, removing the permanent
Vec/Stringresidency on the actual tile-serving hot path.osm_chains_books_lance.rs:RequestChains/RequestBooks(request-scoped, dropped at the end of each request) +gather_chains/gather_books(one batched Lancetake_rowsper table, cachedDatasethandles viatokio::sync::OnceCell— metadata only, not row data). 2 new tests proving a gather returns exactly the requested ordinals and nothing else.osm_features.rs:sample_tile_rows— the tile-row sampling factored out ofquery_tile_shapes, so the async gather phase and the sync resolve phase share one sampling implementation (this file's own module doc names the exact failure mode of two implementations of one projection drifting —osm_tiles' old V1/V3 key split).ChainsHandle/BooksHandle— plain enums dispatching between the Lance-gathered source and the eager resident singleton (fallback only, when the Lance dataset isn't available).tile_sources— the async gather-then-serve orchestration, called byosm_tile_geometry_bin_handlerandosm_tile_geometry_handlerbefore the existing syncquery_tile_shapes/query_tile_geometry.Deliberately deferred (not silently dropped)
Three call sites still use the eager
open_chains()/open_books()singletons directly:query_feature/osm_feature_handlerandquery_geometry/osm_geometry_handler— single-row lookups; migrating needs a two-phase split (read row identity → gather → resolve), lower priority since they fire on a click, not every pan.osm_health_handler— itsstyling_verdictneeds digest validation (distinguishing "codebook present but pinned to a different slab" from "valid"), which needs the same checkopen_books()'sread_booksdoes internally. No cheap header-only reader exists yet to check just the digest. This is a genuine residual trigger.Full details in
claude-notes/plans/2026-08-16-chains-books-lancedb-blob.md.Test plan
cargo check -p cockpit-server --tests— clean.cargo nextest run -p cockpit-server --bin q2-cockpit osm_features— 20/20 passing.cargo nextest run -p cockpit-server --bin q2-cockpit osm_chains_books_lance— 7/7 passing.cargo fmt --check -p cockpit-server— flags pre-existing, crate-wide formatting drift unrelated to this change (spans ~20 files never touched this session); not chased here.cargo build --workspace/cargo nextest run --workspace/cargo xtask verify) not run — deferred given this session's disk constraints (see plan file).Generated by Claude Code