Repository navigation
Use integer keys for content-hash lookups and store Git SHAs and decision UUIDs as bytes - #98
Conversation
selfie-bot
left a comment
There was a problem hiding this comment.
Upgrading the CLI breaks every existing local store, and nothing tells a user how to recover. openProject in cli/src/project.ts calls initStoreSchema on every command, so an old $SELFIE_HOME/<slug>/store.db (default ~/.config/selfie) fails every selfie command with SQLite's no such column: sha_bytes. The reset steps in OPERATIONS.md cover only the project D1 databases. Their last step, "push the batches and decisions you want to publish again", depends on those same local stores, and a new CLI can no longer open them. Either the store or the CLI could catch this failure and show a message that names the reset, which is the same five tables dropped locally. OPERATIONS.md should also say whether the republish has to happen from the old CLI before upgrading. Details inline.
SQLite storage
Measurements
Local SQLite with 100,000 distinct image hashes used 8.07 MB after compaction, down from 16.10 MB. Inserts took 247 ms versus 448 ms. Bulk checks for 100,000 existing images took 33 ms versus 36 ms. These are median SQL timings over five runs per layout with prepared inputs. A separate 200,000-decision fixture used 11.20 MB with binary UUIDs versus 15.32 MB with text UUIDs. The store and render rationale files give the workloads and the commit-key measurements.
Rollout and verification
OPERATIONS.md lists the project tables to reset before deploying to an existing store. The reset discards project history and metadata. Re-pushing can reuse existing blob bytes.
Store, UI, renderer, CLI, and site suites passed locally. Coverage includes overlapping writers, positive and zero-prefix collisions, lost responses, render writes, bulk lookups, and binary ID round trips. The site suite used a separate localhost port. Hosted D1 credentials were unavailable.