Skip to content

fix(locallibrary): finish a store or copy whose making was cut off - #441

Merged
botandbang merged 3 commits into
mainfrom
bnb/store-half-made
Nov 4, 2026
Merged

botandbang merged 3 commits into
mainfrom
bnb/store-half-made

Conversation

@botandbang

Copy link
Copy Markdown
Contributor

If making a store was cut off after objects/ and snapshots/ were made but before store.json was written, every later Store::open_or_init refused the folder as not a locallibrary store. The check it runs under the lock accepted only the files locallibrary keeps beside a store, not what a make leaves behind. store copy had the same problem with a destination cut off at the same point.

Added

  • Store::left_by_making, which accepts an entry left by a cut-off make: objects/ or snapshots/ while they're still empty real directories, or a temp file.
  • A unit test for the reported case, and a Hegel property that draws which leftovers a cut-off make left plus an optional foreign file (in the root, or inside objects/ or snapshots/). It checks the store is made exactly when nothing foreign is there, and that opening it again gives the same store.
  • Cases in the offsite copy property for a cut-off copy destination (finished with the source's id) and for one with a file inside objects/ (still refused).
  • A changelog fragment.

Changed

  • Under the lock, open_or_init accepts those leftovers and finishes the store. A folder holding anything locallibrary didn't write, including a file inside objects/ or snapshots/, is still refused. Before the lock it accepts what it did before.
  • offsite::copy carries on into a destination holding only such leftovers instead of refusing it.
  • The doc comments on open_or_init and holds_only_ours say what each accepts now.

Removed

  • The temp-file check inlined in holds_only_ours; left_by_making covers it.

Under the lock, open_or_init refused the empty objects/ and snapshots/ and the temp file an
interrupted make leaves, so the folder was never a store. offsite::copy refused a destination cut
off at the same point. Both now finish what was started and still refuse anything else.
@botandbang
botandbang requested a review from bnb as a code owner November 4, 2026 21:29
@github-actions github-actions Bot added documentation Improvements or additions to documentation locallibrary locallibrary and the loclib-* crates locallibrary: core The core crate, the data model and rekordbox's formats tests Tests, fixtures and test harnesses labels Nov 4, 2026
bnb
bnb previously approved these changes Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Rust coverage

From run 337. Both are held to the thresholds in .cargo/config.toml.

Tests Lines Functions Regions
All 97.45% (87717/90009) 96.52% (14220/14732) 95.7% (193556/202262)
Hegel property tests alone 95.3% (85777/90009) 94.03% (13852/14732) 93.36% (188830/202262)

@botandbang
botandbang added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit de788ea Nov 4, 2026
32 checks passed
@botandbang
botandbang deleted the bnb/store-half-made branch November 4, 2026 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation locallibrary: core The core crate, the data model and rekordbox's formats locallibrary locallibrary and the loclib-* crates tests Tests, fixtures and test harnesses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants