Skip to content
suit Check-in [1165d70f02]
Login

Check-in [1165d70f02]

Overview
Comment:Phase 8b: the hook dispatcher runs what is linked into an event's slot

A harness is told once to call suit-run hook EVENT. After that, which programs run for the event is decided by what suit has linked into slots/hook/EVENT: one program, or a folder of programs run one after another in byte order of name. An outfit names them with slot hook/EVENT = PATH or slot hook/EVENT/NAME = PATH. Asking for both forms of the same event is an error at plan time that names both outfits.

The dispatcher lives in suit-run, the small program, because some harnesses run a hook on every tool call. With no slot for the event it exits 0 at once, having read nothing. Otherwise standard input is read once into an unlinked temporary file, at most 16 MiB, and every program gets the same bytes from the start. A program that exits 2 stops the rest and the dispatcher exits 2. Otherwise all run and the result is the first non-zero status; a signal counts as 128 plus its number, and a program that cannot be run as 126. The dispatcher has no timeout of its own and prints nothing on success.

suit hook EVENT calls the same code. suit hooks lists what would run and changes nothing.

The speed budget has a second measurement: suit-run hook with no slot, 0.15 to 0.29 ms over an empty program against the 1 ms limit. The no-change run is unchanged and still passes. Stripped suit-run grew from 35064 to 35512 bytes.

1355 unit checks, 598 shell cases (was 479), 669 store cases, 756 placement cases (was 745) and 378 project cases, under clang, under gcc 16, with no user name set, and under a strict umask, in one run of make gate (35 minutes). 100% coverage in all 25 source files. No suite has fewer cases than at the last check-in.

Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1165d70f0240550b1b08dc8f8a599a62130e712015af4ec4074137eac6b57549
User & Date: dmestas on 2026-11-15 16:50:31.989
Other Links: manifest | tags
Context
2026-11-15
17:53
Hook programs get the event's input read-only

The dispatcher gave every program the spooled input through the one descriptor it wrote with, so a program that wrote to its standard input could change the bytes the next program read. The spool is now opened a second time, read-only, before it is unlinked; the copy is written through the first descriptor, which is then closed, and the programs inherit the read-only one. If the second open fails the message is cannot reopen the temporary file, the exit status is 1, no program runs, and no temporary file is left.

8 new shell cases: a program that tries to write to its input fails and the next program still reads the original bytes, and the new failure in the home folder and in the temporary folder.

1355 unit checks, 606 shell cases (was 598), 669 store cases, 756 placement cases and 378 project cases, under clang, under gcc 16, with no user name set, and under a strict umask, in one run of make gate (35 minutes). 100% coverage in all 25 source files. The speed budget still passes. No suite has fewer cases than at the last check-in. check-in: d03820d0a9 user: dmestas tags: trunk

16:50
Phase 8b: the hook dispatcher runs what is linked into an event's slot

A harness is told once to call suit-run hook EVENT. After that, which programs run for the event is decided by what suit has linked into slots/hook/EVENT: one program, or a folder of programs run one after another in byte order of name. An outfit names them with slot hook/EVENT = PATH or slot hook/EVENT/NAME = PATH. Asking for both forms of the same event is an error at plan time that names both outfits.

The dispatcher lives in suit-run, the small program, because some harnesses run a hook on every tool call. With no slot for the event it exits 0 at once, having read nothing. Otherwise standard input is read once into an unlinked temporary file, at most 16 MiB, and every program gets the same bytes from the start. A program that exits 2 stops the rest and the dispatcher exits 2. Otherwise all run and the result is the first non-zero status; a signal counts as 128 plus its number, and a program that cannot be run as 126. The dispatcher has no timeout of its own and prints nothing on success.

suit hook EVENT calls the same code. suit hooks lists what would run and changes nothing.

The speed budget has a second measurement: suit-run hook with no slot, 0.15 to 0.29 ms over an empty program against the 1 ms limit. The no-change run is unchanged and still passes. Stripped suit-run grew from 35064 to 35512 bytes.

1355 unit checks, 598 shell cases (was 479), 669 store cases, 756 placement cases (was 745) and 378 project cases, under clang, under gcc 16, with no user name set, and under a strict umask, in one run of make gate (35 minutes). 100% coverage in all 25 source files. No suite has fewer cases than at the last check-in. check-in: 1165d70f02 user: dmestas tags: trunk

2026-11-14
13:15
Phase 8a: needs are checked, listed, and shown until they are done

A need is a step a harness must do for itself, such as registering a slot in its own settings. suit never edits those settings; it says what is needed and can tell when it has been done.

The done test has two forms and nothing else: PATH exists, and PATH contains "TEXT". suit needs lists every need as done, not done or cannot tell, and changes nothing. suit need HARNESS NAME prints the prompt's exact bytes so it can be handed to the harness.

After each apply the attention file holds one item for each need not done and none for those that are. Other kinds of item are left alone and keep their order, and nothing is written when nothing changed. If that update fails, apply writes no stamp, so the next run tries again. A bad need stops apply before it places anything. suit off removes the items.

suit-run is untouched and the speed budget still passes.

An eighth fuzz target covers the done-test parser.

1355 unit checks, 479 shell cases, 669 store cases, 745 placement cases and 378 project cases, under clang, under gcc 16, with no user name set, and under a strict umask, in one run of make gate (34 minutes). 100% coverage in all 24 source files. No suite has fewer cases than at the last check-in. check-in: 3598f9d78d user: dmestas tags: trunk

Changes
Added docs/hooks.md version [9a72f6b1f6].
Added src/hook.c version [18f80bcaca].
Added src/hook.h version [23f3a4ec43].