Artifact 8ef74ca9e72d57636a4876e40170b37bc99410bde9366555b20381cfc878c27a:
- File
docs/store.md
— part of check-in
[6516a0e4da]
at
2026-11-13 12:54:25
on branch trunk
— Phase 7a: a lint guards every check-in, and edits made in place are checked in
suit lint and suit commit refuse a change that holds a token-shaped value, tool-attribution text, a symlink, or a skill folder with no header. A suit.lint file in the wardrobe can exempt a path or forbid an extra phrase. The lint never changes a file.
suit tend is the hourly entry point. For now it checks in edits made in the store, after the lint. A change that deletes more than five files and more than a fifth of the wardrobe is held until it is confirmed. Anything that needs a person is written to an attention file, which suit status shows under 'needs you'.
A symlink refusal now comes from the lint and exits 3, where it exited 16 before.
Also fixed, found by the forge's runner: a file suit rewrote came back with default permissions, keeping only its executable bit. On the runner a project's local exclude file went from rw-rw---- to rw-r----- across apply and off. A rewritten file now keeps exactly the permissions it had. Tests rewrite files of four different modes under two different defaults, so the development machine catches it too. Three tests that restored a folder to a fixed mode now put back only the bits they took away.
1204 unit checks, 227 shell cases, 323 store cases, 612 placement cases and 378 project cases, under clang, under gcc 16, with no user name set, and under a strict umask. 100% coverage in all 21 source files. No suite has fewer cases than at the last check-in. (user: dmestas, size: 7816) [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 lint NAME` | Runs the lint on the local changes. Changes nothing. | 0 clean, 1, 3 problems, 15 | | `suit commit NAME -m TEXT [--confirm-deletions]` | Runs the lint, then checks in every local change as the current user. No check-in when clean. | 0, 1, 3 problems, 4 held, 15 | | `suit tend NAME` | What a timer calls once an hour: checks in, or leaves what needs you in the attention file. | 0, 1, 3 problems, 4 held, 15 | | `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: - `open` and `update` refuse a wardrobe version that holds a symlink, before changing anything. - The lint reports every symlink in the store (`PATH: symlink, not supported`), so `commit` and `tend` check nothing in while one exists. ## The lint The lint reads the files that would be checked in: the new and edited files of the working copy, never the deleted ones. It reports each problem as `PATH:LINE: what` on stderr, or `PATH: what` when it concerns a whole file, and it never changes a file. `suit lint`, `suit commit` and `suit tend` run it; a commit or a tend with a problem checks nothing in (exit 3). 1. Token-shaped values. A line holding any of: `-----BEGIN` followed on the same line by `PRIVATE KEY-----`; `AKIA` and 16 capital letters or digits; `ghp_`, `gho_`, `ghs_` or `github_pat_` and at least 20 letters, digits or `_`; `sk-` and at least 20 letters, digits, `-` or `_`; `xoxb-`, `xoxp-` or `xoxa-` and at least 10 such characters; or a word holding `token`, `secret`, `password`, `passwd`, `api_key`, `apikey` or `api-key` (any letter case), then spaces and quotes, `=` or `:`, spaces and quotes, and at least 24 letters, digits, `+`, `/`, `=`, `-` or `_` with no space. A value that starts with `$`, `<` or `{{`, or is one character repeated, is a reference and is allowed. 2. Attribution text. A line holding `co-authored-by:`, `generated with`, `generated by ai`, `claude-session:`, `written by ai` or `assisted by ai`, in any letter case. 3. Symlinks. 4. A skill folder (`skills/NAME/...`) with no `SKILL.md` (`skills/NAME: no SKILL.md`), or a `SKILL.md` whose first line is not `---` (`skills/NAME/SKILL.md:1: no header`). Folders removed whole are not looked at. 5. A file larger than 4 MiB is refused by name and not scanned; a line longer than 64 KiB is refused. A file with a NUL byte in its first 8 KiB is binary, and rules 1 and 2 skip it. `suit.lint`, at the wardrobe's top, adjusts rules 1 and 2. Each line is `allow PATH` (that file is exempt) or `forbid TEXT` (an extra literal, any letter case, up to 200 bytes). Paths are relative to the top, with no `.`, `..` or empty part. There are no blank lines or comments; a line that is neither is a problem reported as `suit.lint:LINE: ...`. `suit.lint` is not scanned for its own forbidden text. ## suit tend `suit tend NAME` is what a timer calls once an hour. With no local changes it does nothing and writes nothing. With changes it runs the lint. If that is clean it checks the changes in with the message `Edits on MACHINE: N files` (`this machine` when the machine has no name). If not, it checks nothing in, prints the report and exits 3. A check-in that deletes more than 5 files and more than a fifth of the files the wardrobe tracks is held: `tend` and plain `commit` check nothing in, say `held NAME: N of M files deleted` and exit 4. M counts the files of the version the working copy is at. `suit commit NAME -m TEXT --confirm-deletions` checks such a change in on purpose. ## The attention file `$SUIT_HOME/attention` holds what needs you. An item is a header line, then the lines that belong to it indented by two spaces: `lint NAME` with one problem per line under it, or `held NAME: N of M files deleted`. `tend` writes it beside, syncs it and renames it, replaces the item of the same kind and name, and keeps other wardrobes' items. When a later `tend` checks in, or finds nothing to do, it removes that wardrobe's items, and removes the file when it is empty. `suit status` prints the lines under `needs you:`. ## The machine's name `$SUIT_HOME/machine` holds the name of this machine: one line of 1 to 64 bytes, letters, digits, `-`, `_` and `.`. A machine with no such file has no name. A file that is not a name is an error that names the file. | Command | Does | Exit codes | |---|---|---| | `suit machine` | Prints the name. | 0, 1 no name set or unreadable file | | `suit machine NAME` | Writes the name beside, syncs it and renames it over the file. | 0, 1, 2 not a name | A `[wear user machine=NAME]` section applies when NAME is this machine's name, and is ignored otherwise, and when the machine has no name. `suit status` says which sections did not apply and why. `suit run` notices a change of name, because the stamp watches the file. ## Joined instructions A harness has one instruction file in the User scope. When the unlimited wear and the one limited to this machine both supply `instructions` for it, suit joins them: it writes `$SUIT_HOME/joined/HARNESS`, which holds the unlimited file, a blank line and the machine-limited file, each exactly as in the store, and the harness's instruction path links to that file. With one supplier the link goes straight to the store's file. The joined file is written beside, synced and renamed, and is rewritten when either source's content differs from what it holds. It is in the ledger as `file PATH`, so `suit off` removes it, and `suit apply` removes it when the machine limit stops applying. Each source can be 512 KiB. This is the one case where an edit in the store is not seen through the harness's path at once: the joined file is a copy, so it changes when suit next applies, which `suit run` does as soon as the stamp sees the edit.