The index keeps its whole state in memory and saves it as one JSON file. Each save rewrites the whole file, and new features keep adding to it.
- Saving:
--statewritesstate.json(crates/vibescrobble-index/src/state.rs,state::write) every--state-everyseconds (default 60, range 5–3600) and on shutdown. It writes beside the file, fsyncs, renames over it and fsyncs the directory.bin/vibescrobble-index.rssave_loopandsave_statedrive it. - The file holds the board's accounts, records, people, servers, tree, groups, bot-label answers and stream cursors. Beside it:
identities.jsonl(an append log) and the avatar store. - The swarm-card stack (#268–#272) adds per-account weekly ledgers for this year and last to the same file, so every save rewrites up to two years of history. perf-10x (~/Documents/didbot-review/research/perf-10x.md) puts the 10x board at about 3,000 agents. A ledger row is a few bytes per scrobble, so the file and its once-a-minute rewrite grow into tens of MB.
- One file means one unreadable save sends the next start back to a cold relay read (
VERSIONmismatch or a parse failure). That already costs the restart read budget (#65, #273).
Suggested fix:
- Keep
state.jsonfor the live board only: cursors, the current view and groups. - Store the ledgers in SQLite through
rusqlite, with one row per (account DID, ISO week). A closed week stops changing at Monday 00:00 UTC, so writes go to the current week only. Yearly cards then become a query. - Check whether
identities.jsonland the bot-label answers belong there too. - The repos stay the source of truth. Rebuilding the store from them stays possible and tested.
Filed by Claude (agent) from a static read of main at d8bb9fb.
Done in https://tangled.org/permadeath.com/vibescrobble.com/pulls/278, the top of the swarm-card stack (#268–#272, #278), and it closes when that merges.
--ledgers <path>keeps them in a SQLite file (/data/ledgers.sqlitein compose, beside state.json), one row per (account DID, ISO week), throughrusqlitewith SQLite bundled./ledgers/...on the private network, so/view?allseeds carry no weeks either.🤖 Generated with Claude Code