Skip to content

osm lance: remove a stale dataset before reconversion, never overwrite in place - #125

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/q2-osm-map-reencoding-56p5e2
Aug 12, 2026
Merged

AdaWorldAPI merged 1 commit into
mainfrom
claude/q2-osm-map-reencoding-56p5e2

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Aug 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes the gap #124 left open. WriteMode::Overwrite only writes a new manifest version — Lance keeps the previous version's fragment files on disk. So on the first boot of the #124 build, reconverting the pre-fix three-fragment Berlin dataset in place would leave data/ holding four .lance files, and locate_row_column's sole-data-file precondition would fall back to the raw .soa forever: the map renders, but Lance serving silently never engages, with 1.3 GB of dead fragments squatting on volume01.

  • ensure_lance_local now removes a stale dataset whole (remove_stale_dataset) before write_lance runs. The dataset is a derived cache of the slab — version history has no value; the slab is the recovery path.
  • Fail-closed: if the removal fails, nothing is written into the half-cleared directory (exactly how a 4-file data/ would happen) and the .soa keeps serving unchanged.
  • Bonus: peak disk during reconversion drops from .soa + old + new (~3.9 GB) to .soa + new (~2.6 GB).

With this, the first boot of the fixed build goes: stale detected (3 fragments) → old dataset removed → single-fragment rewrite → row column verified verbatim … (sole fragment, aligned start, head + tail anchors) → tiles served zero-copy lazily from the Lance data file, same boot.

Test plan

  • remove_stale_dataset_clears_old_fragments_entirely — lays out the pre-fix three-fragment shape plus Lance bookkeeping dirs, asserts the directory is gone
  • cargo test -p cockpit-server --bin q2-cockpit osm_lance — 11/11 passing
  • cargo check -p cockpit-server — clean

Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Stale datasets are now fully removed before reconversion.
    • Conversion safely aborts if stale data cannot be removed, preserving access to raw data.
    • Fixed cleanup of outdated fragments and bookkeeping directories.

…e in place

Closes the gap the fragment-split fix (#124) left open: WriteMode::Overwrite
only writes a new manifest VERSION — Lance keeps the previous version's
fragment files on disk. Reconverting the pre-fix three-fragment Berlin
dataset in place would therefore leave data/ holding FOUR .lance files, and
locate_row_column's sole-data-file precondition would fall back to the raw
.soa forever — the map would render, but Lance serving would silently never
engage, with 1.3 GB of dead fragments squatting on volume01.

The dataset is a derived cache of the slab; version history has no value
and the slab itself is the recovery path. So a stale dataset is now removed
whole (remove_stale_dataset) before write_lance runs, fail-closed: if the
removal fails, nothing is written into the half-cleared directory (exactly
how a 4-file data/ would happen) and the .soa keeps serving unchanged.
Bonus: peak disk during reconversion drops from .soa + old + new (~3.9 GB)
to .soa + new (~2.6 GB).

Falsifier: remove_stale_dataset_clears_old_fragments_entirely lays out the
pre-fix three-fragment shape plus Lance bookkeeping dirs and asserts the
directory is GONE. Tests: osm_lance 11/11 passing; cargo check clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NMeiLmtDKhomJNSo2ecbJw
@coderabbitai

coderabbitai Bot commented Aug 12, 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: 5b30cffd-df35-41ff-838a-cdf25c4950c8

📥 Commits

Reviewing files that changed from the base of the PR and between c8e675a and bc18752.

📒 Files selected for processing (1)
  • crates/cockpit-server/src/osm_lance.rs

📝 Walkthrough

Walkthrough

Cold conversion now removes stale Lance datasets before reconversion. Removal failures stop conversion and preserve raw .soa serving. A regression test verifies removal of fragments and bookkeeping directories.

Changes

Lance dataset cleanup

Layer / File(s) Summary
Stale dataset removal during conversion
crates/cockpit-server/src/osm_lance.rs
Cold conversion recursively removes stale datasets before writing. Removal failures preserve the raw .soa fallback. Documentation describes the destination contract, and a regression test verifies complete directory removal.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: claude

Poem

A rabbit found old fragments near,
And swept the stale Lance paths clear.
If cleanup failed, the raw path stayed,
While fresh datasets were safely made.
“Hop!” said Bun, “the test is bright!”

✨ 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 12, 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_f148aaf4-7fde-4ef0-bf34-a8f78911611a)

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review August 12, 2026 17:34
@AdaWorldAPI
AdaWorldAPI merged commit a5be2a2 into main Aug 12, 2026
5 checks passed
@cursor

cursor Bot commented Aug 12, 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_a9ae37de-a098-4d55-8151-b589a16bf6c0)

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