Skip to content

cockpit-server: close the last 3 eager-singleton triggers for chains/books - #140

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/q2-osm-chains-books-lancedb
Aug 17, 2026
Merged

cockpit-server: close the last 3 eager-singleton triggers for chains/books#140
AdaWorldAPI merged 1 commit into
mainfrom
claude/q2-osm-chains-books-lancedb

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Summary

Follow-up to #139 (merged): query_feature/osm_feature_handler, query_geometry/osm_geometry_handler, and osm_health_handler were the three call sites still hitting open_chains()/open_books() directly. All three now gather from Lance with eager-singleton fallback, same contract as the tile handlers.

  • feature_ordinals(bytes, idx) reads a row once to collect its identity ordinal + tag key/value ordinals (single-row sibling of tile_sources's many-row version). single_gather_chains/single_gather_books are the shared gather helpers, factored out of tile_sources so all four handlers share one gather implementation per side instead of four.
  • osm_health_handler needed a genuinely new piece: it can't just gather — it needs to answer "is this sidecar valid for the CURRENT slab" (the same digest check open_books()/open_chains() perform internally) without loading either. Companion sibling-repo PR (AdaWorldAPI/openstreetmap-website-rs#31) adds two header-only readers — osm_soa_bake::codebook::read_books_header (~40 bytes) and osm_soa_bake::chains::read_chains_header (24 bytes) — each proven by a truncated-buffer falsifier to genuinely stop at the header. books_header_valid_for_slab/chains_header_valid_for_slab wire these into the health endpoint. The JSON response's "loaded" key name is unchanged for monitoring compatibility; it now means "header valid for the current slab" rather than "resident in memory" (documented inline).

Every request path that could reach open_chains()/open_books() now reads from Lance or a header-only check first. No remaining trigger in the request path for the permanent multi-GB residency this plan targeted.

Test plan

  • books_and_chains_header_validity_agrees_with_the_real_slab_digest — the first test in osm_features.rs to set OSM_SLAB_PATH and exercise the real slab_digest() OnceLock end-to-end (safe under nextest's one-process-per-test model), proving both the digest-match and digest-mismatch cases against a real computed digest, not just that a header parses.
  • cargo check -p cockpit-server --tests — clean.
  • cargo nextest run -p cockpit-server --bin q2-cockpit osm_features — 21/21 passing (was 20; the one new test is the digest end-to-end proof above).
  • cargo nextest run -p cockpit-server --bin q2-cockpit osm_chains_books_lance — 7/7 passing, unaffected.
  • Full workspace verification not run — deferred given this session's disk constraints, consistent with cockpit-server: convert .chains/.books sidecars to Lance datasets at boot #138/cockpit-server: serve tile shapes from Lance instead of the eager singleton #139.
  • Not yet exercised against a real running deployment.

See claude-notes/plans/2026-08-16-chains-books-lancedb-blob.md for the full history.


Generated by Claude Code

…hains/books

Follow-up to the tile-shapes Lance rewrite: query_feature/osm_feature_handler,
query_geometry/osm_geometry_handler, and osm_health_handler were the three
call sites still hitting open_chains()/open_books() directly. All three now
gather from Lance with eager-singleton fallback, same contract as the tile
handlers.

feature_ordinals(bytes, idx) reads a row once to collect its identity ordinal
+ tag key/value ordinals (single-row sibling of tile_sources's many-row
version). single_gather_chains/single_gather_books are the shared gather
helpers, factored out of tile_sources so all four handlers share one gather
implementation per side instead of four.

osm_health_handler needed a genuinely new piece: it can't just gather (it
needs to answer "is this sidecar valid for the CURRENT slab", the same
digest check open_books()/open_chains() perform internally, without loading
either). Companion sibling-repo commit (openstreetmap-website-rs) adds two
header-only readers - osm_soa_bake::codebook::read_books_header (~40 bytes)
and osm_soa_bake::chains::read_chains_header (24 bytes) - each proven by a
truncated-buffer falsifier to genuinely stop at the header rather than just
returning the right answer on a complete file. books_header_valid_for_slab/
chains_header_valid_for_slab wire these into the health endpoint.

Every request path that could reach open_chains()/open_books() now reads
from Lance or a header-only check first. No remaining trigger in the
request path for the permanent multi-GB residency this plan targeted.

Test: books_and_chains_header_validity_agrees_with_the_real_slab_digest -
first test in osm_features.rs to set OSM_SLAB_PATH and exercise the real
slab_digest() OnceLock end-to-end (safe under nextest's one-process-per-test
model), proving both the digest-match and digest-mismatch cases against a
real computed digest.

Verified: cargo check -p cockpit-server --tests (clean), cargo nextest run
-p cockpit-server --bin q2-cockpit osm_features (21/21, was 20) and
osm_chains_books_lance (7/7, unaffected).
@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.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Important

Review available on request

  • 🔍 Trigger review

Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment @coderabbitai review to review the latest changes. For a full review, comment @coderabbitai full review.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d387a926-df20-4f9f-857c-3aaae316f9bb


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 17, 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_61bf222e-e080-45ee-bea3-9c916ea61060)

@AdaWorldAPI
AdaWorldAPI merged commit ece4153 into main Aug 17, 2026
5 checks passed
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