Artifact 7f25f90c30e9be30b936acfb19c0fd9cb7846bc19757197ee29050bf84b02682:
- File
test/make_fixture.sh
— part of check-in
[2f274ce15b]
at
2026-11-12 22:28:09
on branch trunk
— Phase 2: the store, a working copy that is never half written
The store is a working copy of a wardrobe, kept through libfossil's C API with suit's own file writer: every file is written beside itself and renamed, so a reader sees the old file or the new one.
suit store open, status and update, suit commit and suit back. An update refuses when there are local changes, runs as a dry run first, and changes nothing if any file would conflict.
Proven here: the store is byte-identical to fossil's own checkout of a 600-file wardrobe at each version; a reader hashing files during a slowed update saw only old or new contents; an update that fails at any call leaves the old bytes and no temporary file. 100% of functions, lines, regions and branches in all ten source files.
Vendored, unedited: libfossil trunk f2983dcd78, SQLite 3.55.0, zlib 1.3.1. The release binary links only the system library.
Speed: with everything linked, suit costs 0.82 ms over an empty program quiet and up to 1.38 ms under load, which is over budget. The timer's entry point is now suit-run, a 35 KB program built from the no-change path alone, at 0.40 ms quiet and about 0.5 ms loaded. It runs suit only when something changed. The budget test is on suit-run.
Known limits, recorded in docs/decisions.md: libfossil's checkout writes symlinks as regular files, so wardrobes may not hold them; suit back undoes an update and not a check-in; and a store left half updated by a double failure has no repair command yet.
Not yet run: Fil-C and the Linux build of this phase. (user: dmestas, size: 1180) [annotate] [blame] [check-ins using]
#!/bin/sh # Rebuilds test/fixtures/wardrobe.fossil with stock fossil: two check-ins on # trunk made by user "fixture". The fixture is checked in, so the store tests # run on machines without fossil; this script only exists to remake it. set -eu out=$(cd "$(dirname "${1:-test/fixtures/wardrobe.fossil}")" && pwd)/$(basename "${1:-test/fixtures/wardrobe.fossil}") work=$(mktemp -d "${TMPDIR:-/tmp}/suit-fixture.XXXXXX") trap 'rm -rf "$work"' EXIT INT TERM rm -f "$out" fossil new --admin-user fixture "$out" >/dev/null mkdir "$work/co" && cd "$work/co" fossil open "$out" >/dev/null mkdir -p skills/alpha skills/beta agents printf 'alpha v1\n' > skills/alpha/SKILL.md printf 'beta v1\n' > skills/beta/SKILL.md printf 'reviewer v1\n' > agents/reviewer.md printf '#!/bin/sh\necho hello\n' > run.sh chmod +x run.sh fossil add . >/dev/null fossil commit --user fixture -m "first" >/dev/null sleep 1 printf 'alpha v2\n' > skills/alpha/SKILL.md printf 'gamma v2\n' > skills/gamma.md printf '#!/bin/sh\necho hello again\n' > run.sh rm skills/beta/SKILL.md fossil add skills/gamma.md >/dev/null fossil rm skills/beta/SKILL.md >/dev/null fossil commit --user fixture -m "second" >/dev/null