osm cockpit: name the codebook failure that draws a grey map - #127
Conversation
A missing or unreadable `.books` sidecar is invisible from outside. Without
it `open_books()` yields None, `query_tile_shapes` takes its
`.unwrap_or(ShapeClass::Other)` arm, and every shape on the tile classes as
`Other` — `fill:'none'` plus a thin grey stroke. The server still answers
200 with a full tile of correct geometry, so no status code, no error, and
no log line distinguishes it from a working map. Diagnosing it from the
outside meant guessing between four causes that look identical on screen.
`GET /api/osm/health` reports them apart: slab path/rows/digest, and for
each sidecar the FILE state and the LOADED state separately. Those two
disagree in exactly the interesting case — the file is present but was
refused — which is the difference between "ship the missing file" and
"re-bake the region". `styling_verdict` names the next action rather than
the state, because "books: false" alone does not say which job to do.
Measured against production while writing this. The live berlin bake
returns 6,508 shapes on z14/8802/5373, 100% `other`, on BOTH the binary and
JSON tile endpoints — the class byte is decided once, server-side, so the
renderer is not implicated. `/api/osm/feature/1740603` shows the shape of
it: `entity_type: 3842` (osm_way), real ordinal, real geometry, but
`tags:{}` and `osm_key:null` — only the books-derived fields are empty.
The deployed artifact reads `OSMCBK\0\x02`; this build's MAGIC is
`OSMCBK\0\x03` (bumped by openstreetmap-website-rs 3142a8d, "label codebook
+ junction rows", 2026-08-12) so it is refused at the magic check before
the digest check runs. The slab digests in fact AGREE (8ec93a6ee63e89d2 in
both books and chains), so this is an outdated FORMAT, not a foreign bake —
a distinction this endpoint's four arms are built to make. The fix is a
re-bake with the current baker; no code change restores it.
Verified: `cargo check -p cockpit-server` passes (exit 0, no new warnings).
The two added tests (`styling_verdict_separates_all_four_states`,
`sidecars_resolve_from_the_slab_stem_not_the_lance_dir`) cover pure
functions with no I/O but were NOT executed — a test build needs disk this
container does not currently have.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NMeiLmtDKhomJNSo2ecbJw
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe OSM feature module now resolves sidecar files consistently, logs missing-file errors, and exposes ChangesOSM health diagnostics
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant osm_health_handler
participant SidecarFiles
Client->>osm_health_handler: GET /api/osm/health
osm_health_handler->>SidecarFiles: Read slab, books, and chains state
SidecarFiles-->>osm_health_handler: Return loading and styling state
osm_health_handler-->>Client: Return JSON health response
Possibly related PRs
Suggested reviewers: Poem
✨ Finishing Touches📝 Generate docstrings
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_779165ca-472a-4910-aafb-9cd999386b79) |
What
Adds
GET /api/osm/health— one read that says why the map looks the way it does: slab path/rows/digest, and for each sidecar the file state and the loaded state, reported separately.Two pure helpers (
sidecar_path,styling_verdict) + the handler + two tests. No change to any render or query path.Why
A missing or unreadable
.bookssidecar is invisible from outside. Without itopen_books()yieldsNone,query_tile_shapestakes its.unwrap_or(ShapeClass::Other)arm, and every shape classes asOther—fill:'none'plus a thin grey stroke. The server still answers 200 with a full tile of correct geometry, so no status code, no error, and no log line distinguishes it from a working map.Four different causes produce that identical screen: unset env, absent file, foreign bake (digest mismatch), outdated format. Telling them apart previously meant a git bisect.
The file/loaded split matters because those two disagree in exactly the interesting case — present but refused — which is the difference between "ship the missing file" and "re-bake the region".
styling_verdictnames the next action rather than the state, sincebooks: falsealone doesn't say which job to do.Measured against production while writing this
z14/8802/5373returns 6,508 shapes, 100%other— on both the binary and JSON tile endpoints. The class byte is decided once, server-side inquery_tile_shapes, so the renderer is not implicated (this was the first hypothesis, and it was wrong)./api/osm/feature/1740603→entity_type: 3842(osm_way), real ordinal, real geometry, buttags:{}andosm_key:null. Only the books-derived fields are empty; the row and.chainsare intact.OSMCBK\0\x02; this build'sMAGICisOSMCBK\0\x03(bumped inopenstreetmap-website-rs@3142a8d, "label codebook + junction rows", 2026-08-12). It is refused at the magic check, before the digest check runs.8ec93a6ee63e89d2in both books and chains headers), so this is an outdated format, not a foreign bake — precisely the distinction these four arms exist to make.Fix for the live deploy is a re-bake with the current baker; no code change restores it. This PR makes the next occurrence cost one HTTP call instead of a bisect.
Verification
cargo check -p cockpit-server— passes, exit 0, no new warnings.styling_verdict_separates_all_four_states,sidecars_resolve_from_the_slab_stem_not_the_lance_dir) cover pure functions with no I/O, but a test build needs more disk than this container currently has. Flagging rather than implying they passed.cockpit-server; no workspace build, noxtask verify.Draft until the tests are actually executed.
Generated by Claude Code
Summary by CodeRabbit
New Features
Bug Fixes