Artifact 89ceca207d33fec0c5645e4358741b1e2579680e3af516e5516ee64d065c0a3c:
- File
docs/store.md
— part of check-in
[cbd57cce10]
at
2026-11-12 22:50:34
on branch trunk
— A store interrupted mid-update can be repaired, and symlinks are refused
An update now writes a journal before it changes anything and removes it only when the update, or the put-back after a failure, has finished. If the journal is still there, every store command refuses and names the fix. suit store repair restores each file to the version the store was leaving. Tested with a double failure and by killing suit in the middle of a slowed 100-file update: repair restored every byte.
libfossil's checkout writes symlinks as regular files, so suit refuses them outright: store open and update refuse a version that holds one, and commit refuses to check one in. Each names the path.
The fuzz corpus libFuzzer grew is minimized and checked in (300 inputs for the config parser, 83 for the stamp reader), so every push replays it under the sanitizers and Fil-C.
The budget test takes the best of three runs. It measured 0.43 to 0.59 ms quiet and 0.72 to 0.88 ms at a load average of 130 to 170.
243 unit checks, 220 shell cases, 146 store cases. 100% coverage in all ten source files. (user: dmestas, size: 2399) [annotate] [blame] [check-ins using]
The store
A wardrobe's store is a working copy of it in $SUIT_HOME/store/NAME/, backed
by the repository $SUIT_HOME/wardrobes/NAME.fossil. Every file suit writes in
it is written beside the file, synced, and renamed over it, so a reader sees the
old bytes or the new ones.
| Command | Does | Exit codes |
|---|---|---|
suit store open NAME |
Creates the working copy at trunk's tip, or opens the existing one. Safe to repeat. | 0, 1 error, 2 bad name, 15 journal, 16 symlink |
suit store status NAME |
One line per local change: edited PATH, added PATH, deleted PATH. Nothing when clean. Changes nothing. |
0, 1, 15 |
suit commit NAME -m TEXT |
Checks in every local change as the current user. No check-in when clean. | 0, 1, 15, 16 |
suit store update NAME |
Brings the working copy to trunk's tip. | 0, 1, 12 local changes, 13 conflict, 15, 16 |
suit store repair NAME |
Puts the files back after an interrupted update. | 0, 1, 12 |
suit back NAME |
Undoes the last update. | 0, 1, 14 nothing to go back to, 15 |
update lists local changes (exit 12) or conflict PATH lines (exit 13) and
changes nothing in either case; the caller commits first.
The journal and repair
Before an update changes a file it writes $SUIT_HOME/NAME.journal: the version
it is leaving and the version it is going to. It removes the journal when the
update, or the put-back after a failed update, has finished. A journal that is
still there means the update did not finish, because the put-back failed too or
suit was killed. Every command but repair then refuses with exit 15 and says
to run suit store repair NAME.
repair restores every managed file to the version the journal says the update
was leaving. With no journal it restores to the version the working copy
records, and refuses with exit 12, listing the files, when that would throw
local edits away. A second repair has nothing to do. A file the interrupted
update added, which the old version does not have, stays as an untracked file.
Symlinks
Symlinks are not supported, because libfossil's checkout writes a link as a regular file holding its target (docs/evidence.md, "Phase 2"). So, with exit 16 and a message naming each path:
openandupdaterefuse a wardrobe version that holds a symlink, before changing anything.commitrefuses to check in while the store holds a symlink.