Skip to content
suit Artifact [89a6024736]
Login

Artifact [89a6024736]

Artifact 89a60247361fbb64806db9626ecdd7c6a833a89ee04a669610227fcace2453f4:


# Evidence

Measured on 2026-11-12 on an Apple silicon Mac, against the libfossil
build in `~/libfossil` (debug, check-in 3d8f959f).

## Extracting a version gives an exact tree

A wardrobe of 602 files, including one executable script and one symlink,
with one file deleted in the second check-in.

- Extracted in 392 ms.
- The executable bit and the symlink were kept.
- The deleted file was absent.
- The skills tree was identical to the source.

## A local edit survives an upstream update

Replayed with a skill file: an upstream branch, a local edit on trunk that
rewrites one line, then two upstream updates.

| Upstream change | Result |
|---|---|
| A different line | Merged. Both the local edit and the upstream change are in the file. |
| The same line | Reported as a conflict, with three-way markers. The local edit is not overwritten. |

## What one run costs

400 runs each, at load average 65.

| What ran | Median | 95th percentile |
|---|---|---|
| Starting any process (`/usr/bin/true`) | 6.4 ms | 19.5 ms |
| 33 KB C23 binary: read a stamp, compare, exit | 6.8 ms | 11.2 ms |
| 3 MB binary with libfossil linked in | 7.8 ms | 13.1 ms |
| Plain SQLite query on the repository | 12.0 ms | 19.8 ms |
| Load libfossil, open the repository, resolve trunk | 15.7 ms | 24.2 ms |

Starting a process is the cost. A large binary adds about 1 ms. Opening
the repository adds 5 to 9 ms, so the no-change run never opens it.

## From ctx, which is built the same way

- Capture a real payload from a harness before writing a parser for it.
- Time under load. Two regressions were invisible on a quiet machine.
- Log a start and an end line for every run, so a run killed at its
  deadline leaves a trace.
- Never write into a folder from something an agent is waiting on.

## Phase 1 bench

Measured on 2026-11-12 by `make check-budget`: 600 rounds of three programs
(order rotated each round), a stamp over 100 files, load average 22 to 30 on
a 14-core machine. The budget is judged on the median of per-round
differences, suit over empty.

| Run | Program | Median | p95 | Max | Peak resident (median) |
|---|---|---|---|---|---|
| Quiet | `/usr/bin/true` (info only) | 3.168 ms | 12.601 ms | 25.369 ms | 1232 KiB |
| Quiet | empty | 3.825 ms | 14.008 ms | 23.375 ms | 1408 KiB |
| Quiet | `suit run` | 4.926 ms | 16.049 ms | 25.539 ms | 1440 KiB |
| Loaded (`loadgen 30 8`) | `/usr/bin/true` (info only) | 4.195 ms | 9.456 ms | 23.113 ms | 1232 KiB |
| Loaded (`loadgen 30 8`) | empty | 5.372 ms | 10.481 ms | 24.658 ms | 1408 KiB |
| Loaded (`loadgen 30 8`) | `suit run` | 6.214 ms | 11.579 ms | 36.684 ms | 1440 KiB |

| Run | Suit over empty, per-round median | Suit over `/usr/bin/true` | Resident over empty |
|---|---|---|---|
| Quiet | 0.917 ms | 1.502 ms | +32 KiB |
| Loaded | 0.935 ms | 1.811 ms | +32 KiB |

Both pass the 1 ms and 1 MiB budgets. Earlier runs the same day measured
0.65 to 0.76 ms over empty, so run-to-run spread is about 0.3 ms.

Two causes, measured separately on the same machine:

- Binding about 50 libc symbols at launch costs about 0.28 ms (5 to 6 us
  each) against an empty program. `suit` binds 47.
- Statting 100 files costs about 0.3 ms more than statting one. Paths in the
  same folder are now statted through one open handle on that folder.

Also: a byte-for-byte copy of `/usr/bin/true` starts 0.4 to 1.0 ms slower
than the original, and an empty built program 0.6 to 1.5 ms slower, which is
why the baseline is an empty built program.

## Phase 2

Measured on 2026-11-12 on the same Apple silicon Mac, load average 40 to 80
from other work. Release builds (`-O2 -flto`, stripped), a stamp over 100
files, 600 rounds each, per-round median of the difference to an empty
program built the same way, as in "Phase 1 bench".

The question: does the no-change run stay within 1 ms once SQLite, libfossil
and zlib are linked in?

| Program | Size | Symbols bound at launch | Quiet | Under `loadgen 30 8` |
|---|---|---|---|---|
| (a) `suit`, everything linked | 1,843,480 bytes | 129 | 0.82 and 0.83 ms | 0.98, 1.08, 1.11 and 1.38 ms |
| (b) `suit-run`, the no-change path only | 34,760 bytes | 23 | 0.40 and 0.42 ms | 0.52, 0.55 and 0.72 ms |

The one binary is over the budget under load, so the budget test runs on
`suit-run` and `suit run` is what `suit-run` starts when something differs.
Both programs link only `libSystem` (`otool -L`): SQLite, libfossil and zlib
are compiled in.

The store, on `test/fixtures/wardrobe.fossil` and, where stock fossil is
installed, on a 600-file wardrobe made with it:

- Byte for byte, with executable bits, the store equals `fossil open`'s
  checkout at the first version, after an update to the second, and after
  `suit back`.
- A reader hashing 150 files while an update rewrote them, each rename
  delayed by 20 ms, saw 61 old and 89 new contents and none half written.
- An update that fails on any of open, write, fsync, close or rename leaves
  every file at its old bytes and no temporary file.
- A check-in made by suit shows in `fossil timeline`, `fossil cat` reads its
  files, and `fossil test-integrity` passes.

What libfossil could not do:

- Symlinks. `fsl_repo_ckout()` writes every file with one `fsl__cfs_write()`
  call (`libfossil.c` 40022 to 40033, in `fsl_repo_extract_f_ckout`) and never
  asks whether the entry is a link, so a symlink in a wardrobe comes out as a
  regular file holding the target path. The change scan then reports it as
  edited, for ever. The link hook (`xSymlinkCreate`) is used only by rename,
  stash and undo (lines 42789, 42953 and 43970). `fsl_ckout_manage()` also
  skips symlinks (`fsl_dircrawl_f_add`, 39150 to 39170), so a new link is
  never checked in. So suit refuses them, explicitly and with tests
  (docs/store.md): `open` and `update` refuse a version that has one and
  `commit` refuses to check one in.
- Putting files back after a failed update is suit's own: an update that
  fails and whose put-back fails leaves a journal, and `suit store repair`
  restores the files (docs/store.md).
- Undoing a check-in. `fsl_undo()` covers update, merge, revert and stash;
  after a commit it answers `FSL_RC_CONFLICT` (`undo.h`: "Undo refuses if the
  checkout is no longer on the version the operation left it on (e.g. after a
  commit)"). `suit back` undoes the last update only.
- A dry run leaves the version it went to in the context after the database
  is rolled back, and a real update in the same context then undoes the wrong
  thing. `suit store update` runs the dry run in one libfossil context and the
  update in a fresh one.
- The change scan trusts size and mtime, so an edit made in the same second
  as the file was written, to the same length, is missed. Suit scans with
  `FSL_VFILE_CKSIG_HASH`.


## Phase 4a

The machine's name, the machine limit, and joined instructions. `make all`
passes: unit 420 checks, `run.sh` 227 cases, `store.sh` 146, `place.sh` 612
(163 new, covering `suit machine`, the limit, the winner, joined files and the
failures of each), all with no failure; coverage is 100% of functions, lines,
regions and branches in 16 files. The ledger parser has seven new fuzz seeds for
the `file` record.

The no-change budget is unchanged at 1.000 ms over an empty program and 1024 KiB
resident. The stamp now watches 129 paths (the machine file is one). Per-round
medians over empty: 0.457, 0.456 and 0.467 ms quiet; 0.664, 0.747 and 0.786 ms
under load; resident 0.0 KiB in every round.

One consequence for reading the code: the machine file is read in `prepare`
before the ledger, so the fault-injection call numbers for the ledger's `open`
moved up by one in `test/place.sh`.

## Phase 4b-1

Finding projects, with no placement yet. Measured on the development
machine.

- 993 unit checks, 227 shell cases, 146 store cases, 612 placement cases
  and 118 project cases, all passing under ASan and UBSan.
- 100% of functions, lines, regions and branches in all 18 source files.
- A remote address written as `https://User:[email protected]:8443/x/y.git/`
  gives the key `example.com/x/y`, and the word "secret" appears nowhere in
  suit's output or files.
- A zit project gets no key from a scan; one is set by hand.
- A key set by hand is applied by the next scan, not at once.

## Phase 4b-2

The Project personal scope: your own assets linked inside each project that
has the key, hidden from git by that project's own exclude file. Measured on
the development machine.

- 1006 unit checks, 227 shell cases, 146 store cases, 612 placement cases and
  310 project cases, all passing under ASan and UBSan.
- 100% of functions, lines, regions and branches in all 19 source files.
- A fault sweep fails the Nth call of `open`, `write`, `rename`, `mkdir`,
  `fsync` and `unlink` in an apply, in an apply that changes things and in an
  off, and after each one `suit off` puts the projects, the scratch home and
  the joined files back exactly as they were, with no entry left in the
  ledger.
- A linked worktree and its main repository share one block in the main
  repository's exclude file, found through `commondir` and tidied of `..`, so
  the same file is never named two ways.
- The no-change budget still passes with three more files watched (roots,
  projects, projects.set): about 0.43 ms against a limit of 1 ms.

## Phase 4c

`suit why NAME`: every place that supplies an asset, and which one is in
effect, for the current folder. It reads and changes nothing.

- `why` asks resolve, so it cannot disagree with `apply`: resolve records each
  place that supplies the name, and after it settles a destination each place
  is marked placed, joined or dropped by comparing its source with the one
  that won. Sections that did not apply are recorded the same way.
- `suit status` now says a machine-limited `[wear personal ...]` section that
  did not apply, as it already did for `[wear user ...]`.
- The current folder is read through a new fault wrapper, `getcwd`.

- 1011 unit checks, 227 shell cases, 146 store cases, 612 placement cases and
  376 project cases, all passing under ASan and UBSan.
- 100% of functions, lines, regions and branches in all 19 source files.

## Phase 7a

- The lint (`suit lint`, and the first step of `suit commit` and `suit tend`)
  reads the new and edited files of the working copy and reports
  `PATH:LINE: what`: token-shaped values, attribution text, symlinks, skill
  folders without a `SKILL.md` or its `---` header, files over 4 MiB and lines
  over 64 KiB. `suit.lint` allows a file or forbids a literal. Exit 3.
- `suit tend` checks in with `Edits on MACHINE: N files` when the lint is
  clean, and otherwise leaves `lint NAME` and its problems in
  `$SUIT_HOME/attention` and exits 3. A check-in that deletes more than 5 files
  and more than a fifth of the tracked ones is held (exit 4) unless
  `suit commit ... --confirm-deletions`. `suit status` prints the file under
  `needs you:`.
- The lint runs in a transaction that is rolled back, so a refused check-in
  leaves the repository and every file of the working copy byte for byte as
  they were. The checkout database `.fslckout` is rewritten by any scan, with
  the same rows, and is not part of that claim (`suit store status` does the
  same).
- A file replaced by a symlink is reported once, through the lint. The symlink
  refusal of `commit` is now exit 3 and `PATH: symlink, not supported`, not
  exit 16.
- A tracked file already unmanaged by a failed check-in still counts as a
  deletion for the hold.

## Phase 7b-1

Remote, login and `suit sync` without TLS. Two machines and a `file://` remote
in a scratch folder reach each other's working copies byte for byte through two
syncs; edits to different files merge; edits to the same lines, an edit against
a deletion and a binary edited on both sides stop with exit 13, every
working-copy file byte-identical and the local check-ins pushed. Where `fossil`
is installed, a loopback `fossil server` covers `http://`, a login and a wrong
password (exit 19). The suite found three bugs on the way: a secret with a
trailing word was truncated by the parser, a merge of a deletion lost the other
side's edit, and a merge changing no file failed after writing the journal.

## Phase 7c-1

`suit clone` over `file://` gives a store byte-identical to the first machine's,
and an edit made on the clone reaches the first machine through a tend and a
sync. Against a loopback `fossil server` made private, a clone without the login
or with a wrong one exits 19 and leaves nothing; with the login it succeeds and
the secret appears only in the credentials file. Failing each system call in
turn leaves either a whole clone or nothing. `suit tend` with no name over zero,
one and three wardrobes, the middle one failing its lint, tends the others and
exits with the highest code. The failing-sync line appears at the third failure,
grows, and is removed by the next sync that reaches the remote.

## Phase 7c-2

`suit install` writes the two launchd property lists on macOS and the four
systemd units on Linux (both proven by tests that choose the platform), calls
the loader with exactly the expected arguments, says `already installed` and
writes nothing when run again, rewrites and reloads a file edited by hand, and
never touches a file of someone else's in the folder. A loader that fails on
load gives exit 3 with the files left in place; on unload it is reported and the
files still go. Failing each of mkdir, open, read, write, fsync, rename, stat,
spawn, wait4 and unlink in turn leaves the old state or a reported partial one
that the next install finishes. `suit status --line` gives `suit ok`,
`suit: N need you` or `suit: not installed`, with attention winning. All tests
ran in a scratch home with a fake loader; the real LaunchAgents folder was not
touched.

## Install again retries a failed load

With a fake loader that exits 7, `suit install` exits 3 and leaves one item in
the attention file; `suit status --line` says `suit: 1 need you`. A second install
with the loader still failing keeps exactly one item and exits 3; with a working
loader it loads, removes the item and the empty file, and exits 0. Another item in
the file is untouched, uninstall removes the item, and the loader that cannot be
started is told apart in the item. Failing each read, write, rename and unlink on
the way gives the reported exit, and a failed item write still exits 3. All ran in
a scratch home with a fake loader.

## Phase 8a

Needs. `suit needs` lists each need as done, not done or cannot tell, with
exit 0, 1 and 2 as in [needs.md](needs.md); `suit need HARNESS NAME` prints the
prompt's bytes; `suit apply` (and so `suit run`) keeps one attention item per
need not done, after the links are placed. `suit-run` is unchanged.

- The `done` text is read by a strict parser with two forms (`src/need.c`,
  fuzzed by `test/fuzz_need.c`: 17.2 million runs in 30 seconds, no crash).
  A file is read whole, up to 4 MiB, in one buffer, so a text that crosses any
  block boundary is found.
- The attention file's need items are made to match by one pass
  (`attention_sync`): items already right stay where they are, others are
  dropped or added at the end, other kinds are not touched, and nothing is
  written when the file would not change (the inode is the same after a second
  apply).
- 1355 unit checks, 479 run.sh cases, 669 store cases, 745 placement cases and
  378 project cases, all passing under ASan and UBSan, plain, with USER and
  LOGNAME unset and under umask 027.
- 100% of functions, lines, regions and branches in all 24 source files.
- `make analyze` clean; `make check-budget` passes (`suit-run` is untouched).

## Phase 8b

The hook dispatcher: `suit-run hook EVENT` (see [hooks.md](hooks.md)).

- With no slot, `suit-run hook NOSUCHEVENT` is 0.15 to 0.29 ms over the empty
  program in `make check-budget`, limit 1 ms; the no-change run is 0.47 to
  0.83 ms, as before. Standard input is not read on that path.
- `suit-run` is 35,512 bytes stripped, up from 35,064.
- Nested slot names (`slot hook/EVENT/NAME`) needed no change in placement; they
  are placed and removed by apply and off, and a program and a folder for one
  event is an error naming both outfits.
- 1355 unit checks, 598 run.sh cases, 669 store cases, 756 placement cases and
  378 project cases, all passing under ASan and UBSan, plain, with USER and
  LOGNAME unset and under umask 027.
- 100% of functions, lines, regions and branches in all 25 source files;
  `make analyze` clean.

## Stacking: placing from every wardrobe

Placing took one fixed wardrobe, `mine`; it now takes every wardrobe under the
store (decisions.md, 2026-11-15; conf-format.md, "More than one wardrobe").

- The merge is `conf_merge` in `src/conf.c`; finding the wardrobes and loading
  them is `src/wardrobes.c`. Every section knows its wardrobe, so resolve takes
  each asset and path from that wardrobe's store.
- The ledger format did not change: it already holds each link's full source
  path, which names the wardrobe. `suit off` removes what two wardrobes placed
  and leaves the scratch home as it found it.
- The no-change run watches each wardrobe and `$SUIT_HOME/store`. With two
  wardrobes (50 files in each, the stamp watching 136 paths) `make
  check-budget` measured 0.83 to 0.85 ms over the empty program, limit 1 ms; 100
  files in each measured 1.19 to 1.24 ms,
  because the compare stats every path, so the fixture was kept to the size the
  one-wardrobe fixture had. A wardrobe added, removed, or given a `suit.conf`
  after an apply is a change; two wardrobes unchanged are a no-change run.


## Phase 8c-1

Upstreams taken from a folder: `suit upstream NAME take|diff|accept` and
`suit upstreams` ([upstreams.md](upstreams.md)). The code is `src/upstream.c`
(the folder reader and the commands) and, behind five functions in `store.h`,
the check-in, the merge and the listing in `src/store.c`.

- Proof, replayed in `test/store.sh` in a scratch home: take v1 and accept; edit
  one line of a taken file on trunk and commit; take v2, which changes another
  line of that file, and accept: both changes are in the file. Take v3, which
  rewrites the edited line: `accept` lists `conflict PATH`, exits 13, trunk's
  files are byte-identical, no marker is written, and the attention file holds
  `upstream up: 1 files conflict`. `--mine` and `--theirs` each settle it.
- A check-in on the branch without the working copy: the repository is opened
  with no checkout, and the check-in is a deck built with libfossil's own calls
  (`fsl_deck_init`, `fsl_deck_F_set_content`, `fsl_deck_branch_set`, a cancelled
  `sym-trunk` tag, `fsl_deck_save`), parent trunk's first check-in for the first
  take and the branch's tip after. Stock fossil lists the branch with only the
  upstream's files, passes `fossil test-integrity`, and its first check-in's
  parent is the fixture's empty one. The working copy, its edits and its
  untracked files are byte-identical after a take.
- The branch is pushed and pulled like trunk: a take on one machine is seen by
  `suit upstreams` on another after `suit sync` and after `suit clone`; an
  upstream's branch is not mistaken for a fork of trunk, and a real fork is still
  merged when an upstream's branch is the newest leaf.
- Taking 4096 files (the limit) takes 0.27 s in the release build, `diff` 0.06 s
  and `accept` 2.4 s (a synced file write each); `suit upstreams` 5 ms.
- Found while testing: libfossil's dry run reports a file the upstream deleted
  and trunk changed as a removal, so the conflict found by comparing the
  ancestor's files replaces that line; a merge that fails part way leaves the
  files it added behind (`put_back` does not remove them), so `accept` removes
  them and the folders it made after a failure; a revert un-queues them.
- `suit back` after an accept exits 14, `cannot go back`: the undo record of the
  merge ends when the merge is checked in (`fsl_undo` needs the checkout to be
  at the version the merge left it on), as after any check-in. Item 8 of the
  brief, going back to `waiting for review`, needs a library change and is not
  built. Every accept now writes `upstreams/NAME` into its check-in, so a merge that
  changes no file checks in and `--mine` on the only conflict ends `current`;
  libfossil omitted the merge parent for that check-in, which is why the file, and
  not ancestry, decides.
- No fuzz target for the folder reader: the existing targets feed bytes to the
  parsers linked without the store, and the reader walks a disk, so a target
  would have to build a tree from the input first. The config format's seed
  (`everything.conf`) now holds `into`.
- 1473 unit checks, 620 run.sh cases, 968 store cases, 846 placement cases and
  378 project cases, all passing under ASan and UBSan, plain, with USER and
  LOGNAME unset and under umask 027. Every failing system call during a take,
  an accept (clean, settled and conflicting), a no-op accept and a listing
  leaves the repository, the working copy and the attention file as they were
  or as the command leaves them, never in between (6 to 29 failures for each).
- 100% of functions, lines, regions and branches in all 26 source files;
  `make analyze` clean; `src/upstream.c` and `src/store.c` compile clean under
  gcc-16 at -O2 with the project's warnings as errors (the full gcc build is the
  gate's).
- An upstream's attention item survives `suit tend` of a wardrobe of the same
  name, and an update that brings an accept from another machine removes the
  stale item; tested with two machines, in the store cases.

## Undo of an accept

- `suit upstream NAME undo` is proven in scratch homes: take v1, accept, take
  v2, accept, undo gives trunk's files byte for byte as after the first accept
  and the record naming v1's tip and pin; a second undo gives the state before
  any accept and no record file; a third says nothing to undo. An accept that
  added, changed and removed files and changed a mode is undone, with the mode
  back; so are accepts settled with `--mine` and with `--theirs`. A file
  changed after the accept is a conflict (exit 13) and nothing changes; an
  edit to a file the accept did not touch survives. Two wardrobes, and two
  machines through `suit sync`, agree after an undo.
- Left to choose the base, the library cannot merge an undone update again: it
  refuses with "Cowardly refusing to perform no-op merge". Superseded by the
  next section.
- Every failing system call during an undo leaves the repository, the working
  copy and the attention file as they were, or as the command leaves them (33
  failures).
- 1112 store cases, all passing under ASan and UBSan.

## The merge base of an upstream

- `accept` and `diff` merge against the check-in the record names
  (`baselineRid`). Proven in scratch homes: take v1, accept, take v2, accept,
  undo, accept gives trunk's files byte for byte as after the second accept,
  the record naming v2's tip, `current`, and a check-in with two parents; one
  accept, undone, accepted again gives the files of that accept; a newer take
  after an undo brings all its changes since v1 and keeps an edit of yours to
  another line; `diff` after an undo lists the undone changes.
- After `--mine`, a take that changes other lines merges cleanly and keeps your
  lines; one that changes the settled lines again conflicts. After `--theirs`
  both merge. Two machines agree after an undo on one and an accept on either.
- `baselineRid` is the pivot of a normal merge: libfossil uses it in place of
  the common ancestor it would find, refuses it only with a cherry-pick, and
  still records the tip as the merge parent. The conflict an earlier quick try
  saw was not reproduced; the dry run, the merge and suit's own check for files
  one side deleted all use the same base.
- A take's check for a file of your own looks at the check-in trunk's record
  names too, so a newer take is not refused over a file an undo brought back.
- 1153 store cases, all passing under ASan and UBSan; coverage 100%.

## Usage counts

Part one: the reader, the tally, `suit usage scan`, `suit usage` and the scan
in `suit tend` ([usage.md](usage.md)). Measured on the 14-core development Mac
on 2026-11-16, release build unless said.

- **A first scan of a generated tree** (`test/make_usage_tree.sh`: 200 files of
  about 1 MiB, 205,600 KiB in all, two lines of about 512 KiB in each that look
  like an embedded image, and a skill, an agent and a command): 0.34 to 0.55 s
  wall over three runs, with the files in the page cache, 200 files read, 403
  invocations added (the three commands repeat by time, kind and name), 6.7 MiB
  peak resident. The same on the sanitizer build: 0.73 s.
- **A second scan with nothing new:** 0.00 s on the release build (0.09 s on the
  sanitizer build), 0 files read. No file but the tally's own and the config is
  opened: with the first five opens of a scan (the config, the lock, the
  projects, the events and the offsets) made to fail only the sixth, the second
  scan succeeds, and a first scan fails with `cannot open`
  (`scan-second-makes-only-five-opens` in `test/usage.sh`). With every session
  file's mode set to 000 it still reports 0 files read.
- **Memory** does not depend on the length of a line: 5 MiB lines in the unit
  tests are read in 64 KiB chunks and a string is kept to its first 512 bytes.
  The peak resident was 6.7 MiB for the generated tree above and 10.3 MiB for the
  real tree below, which holds lines of many megabytes.
- **The real tree, read-only,** with a scratch `SUIT_HOME` and the Claude Code
  rules of [harnesses.md](harnesses.md): 2547 files read (3555 files, 12.7 GiB
  in the tree; the first scan reads those modified in the last 45 days), 3756
  invocations added (2866 agent, 460 skill, 430 command), 131 distinct names, 998
  records skipped, 60 s wall (38 s user), 10.3 MiB peak resident. A second scan 0.08 s,
  2 files read (the sessions still being written). The tally is 369 KB of events
  and 690 KB of offsets. The skipped records are `api-request-blob` records:
  they hold a copy of earlier blocks and no time.
- **The rules against an independent count:** for a sample of 120 of those
  files a script that parses each line with a JSON library and applies the same
  rules by hand got 46 invocations added and 11 skipped, as the scan did.
- **Tests:** unit 2855 checks (1473 before), `usage.sh` 236 cases, run.sh 620,
  store.sh 1153, place.sh 846, project.sh 378, all passing under ASan and UBSan.
  Coverage 100% of functions, lines, regions and branches in every file of `src/`.
  The usage sweep fails 15 kinds of system call in turn, a few hundred runs, and
  after each the files are the old ones or the new ones and a repeated scan ends
  where an unbroken one does.

## The curation page

`suit curate` ([curate.md](curate.md)), measured on the dev build.

- **Page size.** The template is 30.5 KB. The page for the test fixture (two
  wardrobes, 26 assets, 40 events: `test/curate.sh`) is 38070 bytes. A page for 500
  generated skills, each with a description of about 230 bytes and 400 uses over 7
  projects, is 252930 bytes (about 0.5 KB an asset), under the 1 MiB the brief set;
  `test/curate.sh` fails above it. 4096 assets, the bound, with no
  description and no uses, make a page of 805569 bytes.
- **No network.** The test greps the fixture page for `http`, `@import`, `fetch(`,
  `XMLHttpRequest` and `localStorage`, for an attribute value that starts with `//`,
  and for inline handlers (outside the data, which has no raw `<`): none. The page
  was also opened in a real browser from a local file in the light and dark themes
  at 1280 and 390 pixels wide, and the keys, the choice buttons and the details were
  tried.
- **Escaping.** The fixture holds a description with `</script>` and
  `<img ... onerror=...>`, quotes, U+2028 and U+2029, bytes that are not UTF-8 and
  2000 bytes; the data holds none of `<`, `>`, `&` raw, one `</script>` ends the
  page, and the long description is cut to 300 bytes. The reader of the front matter
  ran 300000 mutations of its eleven seeds (`test/fuzz_curate.c`) with no finding.
- **Page script.** `test/curate_page.js` runs the generated script under node
  against a stub of the document: 121 checks, none failed. Node ran here; a machine
  without it prints a line that starts with `skip `.
- **Atomic write.** With each of ten system calls made to fail in turn (open, read,
  write, fsync, fchmod, close, rename, stat, lstat, listdir), an older page is whole
  after every failed run and no temporary file is left; short reads and interrupted
  reads give the same page.
- **Tests:** unit 2993 checks (2855 before), `curate.sh` 288 cases, run.sh 620,
  store.sh 1153, place.sh 846, project.sh 378, usage.sh 236, all passing under ASan
  and UBSan and with gcc 16. Coverage 100% of functions, lines, regions and branches
  in every file of `src/`.

## Applying the choices

`suit curate apply` ([curate.md](curate.md)), measured on the dev build.

- **Tests:** `curate_apply.sh` 368 cases (new), unit 3662 checks (2993 before), curate.sh
  288, run.sh 625, store.sh 1153, place.sh 985, project.sh 378, usage.sh 236. The
  choices parser ran 300000 mutations of its twelve seeds (`test/fuzz_choices.c`) with
  no finding. Coverage 100% of functions, lines, regions and branches in every file.
- **Faults.** With each of twelve system calls failed in turn, plan-only runs change
  no file, and runs with `--yes` leave each working copy with the config as it was or
  as the apply made it, the lock released and no temporary file; a failed second
  check-in leaves the first in place and the second wardrobe's file as it was.
- **Cost.** A run on two wardrobes of ten assets takes about 0.1 s under ASan, most of
  it starting the process and opening each repository; it is not on a timer's path.

## The stamp watches what apply acts on

decisions.md, 2026-11-17. `make check-budget` on a new fixture: two wardrobes,
300 skills of 5 files each (one with a subfolder), 40 agents, 20 commands, a
joined instructions file for each wardrobe's harness, a slot and a file each,
placed by a real `suit apply` into a scratch home. Release builds, three runs
of 600 rounds each, quiet and under `loadgen 100 8`.

| | Paths watched | Quiet, over empty | Loaded, over empty | Load average (1 min) |
|---|---|---|---|---|
| Before (every file of the stores) | 1890 | 7.14 to 7.59 ms, over | 12.56 to 13.39 ms, over | 15.3 quiet, 18.1 loaded |
| After (what apply acts on) | 24 | 0.26 to 0.28 ms | 0.46 to 0.48 ms | 9.1 quiet, 9.2 loaded |

The limit is 1 ms. The hook dispatcher's figures did not change (0.13 to 0.31
ms). Before, the compare cost about 4 us a path, which sets the bound of 128
watched paths. The two runs had different loads, but the before figures are 7
to 13 times the limit, so the load difference does not decide the result.


## https (2026-11-17)

libfossil moved to the private build 2f20f44ba4 first, on its own: `make
check` passed unchanged (unit 3669 checks, run.sh 625, store.sh 1153, place.sh
985, project.sh 378, usage.sh 236, curate.sh 288, curate_apply.sh 376 cases, 0
failed), the same counts as on trunk f2983dcd78.

Then https, `test/https.sh`, 170 cases against servers on 127.0.0.1 only
(stock fossil 2.28 serving TLS, and `test/badsrv.c`): clone, pull, push, a
pull into a second clone, a no-change sync, tend and tend for every wardrobe,
a push larger than the TLS buffer, each checked against the server with stock
fossil (tip and `test-integrity`); `SSL_CERT_FILE`, the system's bundle, no
bundle at all, a remote's own CA file used in place of the bundle; host name
mismatch, untrusted CA, expired (by the clock and by a backdated
certificate), a plain HTTP server, RSA key exchange only, CBC only, TLS 1.3
only (alert 70, named), bytes that are not TLS (all exit 18); wrong password
and anonymous push (19); a server that drops mid-reply, a reply shorter than
its length, a close-delimited reply without close_notify, a redirect (named,
not followed), HTTP 500, a closed port, a silent server (gone in 2 s with the
limit at 2 s), the 10-minute deadline (set to 2 s), a name lookup that never
answers (the child is killed after the 2-s limit) (all 17); a close-delimited
reply with close_notify and a chunked reply (0); each network call failing
in turn, with the repository whole after every failure and a failed clone
leaving nothing. Plus 119 unit checks of the bundle reader and the wrappers,
and a fuzz target for the bundle reader.

| Run | Result |
|---|---|
| `make quick SUITE=https` | 170 cases, 0 failed, three ways |
| `make quick` run, unit; store and place one way at a time | 625; 3788; 1153; 985, 0 failed, three ways each |
| `make cover` | 100% of functions, lines, regions and branches in 34 files |
| `make analyze` | no report |
| `make check CC=gcc-16`, `make check` (fresh `build/dev`) | 0 failed in every suite (https.sh 170) |
| `make fuzz`, three times | no crash; anchors 340 to 730 thousand runs in 30 s |
| `make release`, `make check-budget` | pass; suit-run 0.443 ms over empty |

Sizes, stripped release on macOS arm64: `suit` 2,291,288 bytes before (trunk
libfossil, no TLS), 2,490,024 after (+199 KB, BearSSL and the stream
channel). `suit-run` 35,496 bytes before and after, importing the same
symbols: it is built with `SUIT_NO_NET`, which leaves the network wrappers out.

A read-only anonymous `suit clone` of `https://zeitforge.app/r/dmestas/suit`
into a scratch `SUIT_HOME`, with the dev (sanitizer) build and the system's
`/etc/ssl/cert.pem`: 8.4 s, exit 0, `fossil test-integrity` 7764 blobs, 0
errors. Whether the replies were close-delimited could not be seen without
instrumenting the channel; the trial found Cloudflare sends them, and such a
reply is accepted only after a close_notify.

Not run here: Fil-C (Linux only; the forge runs it), and the forge itself.
Whether its runner has openssl and nc is not known from here; without them
`test/https.sh` prints `skip https-servers` and runs only its first 21 cases.