408. One home for fn check(ok: bool), which nine programs now write out by hand
Promoted from the proposal one-home-for-the-trap-on-false-helper, filed
2026-09-14 by milestone 291 (thirty-one programs wearing one name)'s lane. That lane added seven of
the nine copies and said so rather than
leaving it to be re-derived. (Number provisional until the merge queue lands it.)
The decision is
§188 (what the lifted fn check(ok: bool) is called, now that nine programs write it out by hand), written up
2026-09-19 by milestone 435's slice-c lane because this gate named no section. The obvious home is
crates/user_rt, and a public function name there is an architect's (AGENTS.md, "calef names the
crates, the programs, and the shared modules", extended to public function and method names on
2026-08-23).
Only the name is open, and that is a narrowing this block did not have.
§94 (what may live in a userspace
library) already decided the lift. It asks what
the language forces to be per-binary and lifts everything else. Its own tell is this case
exactly, "a per-binary item whose body is copied verbatim into every binary. If the body is
identical everywhere, it is not per-binary; only its declaration is." It was written about 58
copied panic handlers; nine copied checks is the same shape at a seventh the scale.
Premise re-checked 2026-09-19, still true, with two corrections.
Built 2026-10-15 (UTC), lane milestone/408-one-home-for-the-trap-on-false-helper
require is now the one home, on crates/user_mode_runtime, and the copies call it. The
premise moved again before the work started: the same grep then found ten copies, not nine.
notification_binder had arrived since the 2026-09-19 check, fs_test_client.rs had become the
fs_test_client/ directory whose channel.rs carries the copy that crash, proof and
throughput share, and memory_region_depleter was already out. Two spellings said no: eight
copies called trap() (hello through a local fail() wrapper) and folded straight over, and the
two panic copies (block_driver, channel) went to require like the rest. One path now says no
for both spellings.
block_driver's copy had no callers at all: the virtio code its comment said it supplied
crate::check for became its own crate in 291 and names no such path, so deletion was the fold.
crates/loaded_image_check keeps its closure. It is not this shape: its failure path is a
parameter (verify(fail: fn() -> !)) that keeps the crate host-buildable, and its own module doc
records a refusal of depending on user_mode_runtime.
Name: provisional. require, on §188's recommendation: the kernel's trust::require is the same
shape one privilege level up. check refused on design/naming.md's generic-word rule, insist
and must for the reasons §188 records. calef ratifies from the unratified worklist; the name
does not block the merge.
Follow-on
- Decision.
design/decisions/0188-one-home-for-the-trap-on-false-helper.mdnames what the lifted helper is called. The lane shippedrequireas a provisional name on that section's recommendation, with what was considered in the item'sName:marker atcrates/user_mode_runtime/src/process.rs; it ratifies from the unratified worklist and the section itself is the maintainer's to flip at merge.grep -rn 'fn check(ok: bool)'finds nine copies, the same count, and not the same nine:fixtures/src/memory_region_depleter.rsno longer carries one andfixtures/src/hello.rsdoes.components/src/block_driver.rsstill reaches the trap throughpanic!()rather thanuser_mode_runtime::trap(), so the two spellings of "say no" this file names have not converged. And the crate calledcrates/user_rtbelow iscrates/user_mode_runtimesince milestone 285 (user_meant a person in three hundred places). That changes where the function would go and nothing about the decision the gate names.
The duplicate
Every one of these is the same three lines, and they all mean this program's only way to say no is to die where the mistake was, because a failed check must be indistinguishable from a broken program:
fn check(ok: bool) {
if !ok {
user_rt::trap()
}
}
Nine copies as of milestone 291. components/src/block_driver.rs (which panics instead, reaching
the same trap through panic_handler!), fixtures/src/fs_test_client.rs, and the seven fixtures
291 created (console_test_client, memory_region_depleter, page_frame_producer, call_server,
frame_revoker, rendezvous_minter, rendezvous_peer). crates/loaded_image_check has a tenth,
private, for its own use.
This is not a #[path] module and script/lint check 5 will never see it, because nobody
shared a file. Each copy was typed again. That is the cheaper failure of the two and it is still a
failure, since the nine can drift on what "say no" means. Two of them already do: a panic and a
trap are not the same path, though they arrive at the same instruction.
Why it is a proposal and not a change
291 chose the duplicate deliberately. The alternative was adding a public function to
user_rt in a lane already touching two archive tables and the filesystem's directory geometry, and
user_rt is the crate every program in the tree links. The existing two copies were
the tree's established pattern; following it kept the change reviewable. The argument for fixing it
is that "fewer places to be wrong" is AGENTS.md's own definition of elegance, and nine is past the
point where a pattern is a convention.
The name is the whole decision. check is one of the generic words AGENTS.md names as a failure
mode: half the tree checks something. require is the kernel's own word for the same shape
(trust::require halts on a mismatch). insist and must were considered and are worse for
opposite reasons. The first is unusual enough to need explaining, the second reads as a modal verb
at the call site. A public name on user_rt is also the most-read function name this tree could
add. That is a reason to spend a decision on it rather than to take one.
Index row
Nine programs each write out the same three-line fn check(ok: bool) over
user_mode_runtime::trap(), typed again rather than shared, so script/lint check 5 never sees
them. Seven arrived with milestone 291's split of hello into programs. Two of the nine already
disagree about what saying no means, since components/src/block_driver.rs panics where the rest
trap. The obvious home is crates/user_mode_runtime, which every program in the tree links, and
that makes this the most-read function name the tree could add. check is one of the generic words
design/naming.md calls a failure mode, require is the kernel's own word for the same shape. The
name is the whole decision, which is why this is gated on calef rather than on a lane.