From a08850a806bd44a1d5d645685127615972c29374 Mon Sep 17 00:00:00 2001 From: japabu Date: Sun, 4 Oct 2026 00:36:30 +0200 Subject: [PATCH 1/3] Every crate with one consumer moves under it Step 4 of issues/build/code-used-by-one-program-lives-in-that-program.md. The count reads `cargo metadata --no-deps` over every manifest `git ls-files '*Cargo.toml'` lists; a shipped program is its own consumer. - kernel/dma, kernel/gicv3, kernel/pci, kernel/ps2: the kernel's alone. They stay members of the host workspace, as kernel/loom and kernel/sim are. - toyos-blockring/transport: toyos-blockring's alone. - toyos-net-shard/testnet and toyos-net-shard/tcp: the shard and the testnet are each other's only consumer, the shard naming the testnet only as a dev-dependency. The step now says how such a pair counts (the orchestrator's reading, not an owner ruling): the dev-dependency moves under the other, and the pair counts as one crate, which makes the pair toyos-net-tcp's one consumer too. - userland/compositor/desktop, userland/netstack/mdns, userland/soundserver/mixer: each one program's alone. They leave the host workspace for the userland one, with `[lib] doctest = false` as the survey asks of a userland library (none has a doc-test). src/userlandhost.rs's survey now gates a nested crate's tests instead of listing them as escapes, so `--ci host` runs the three userland crates' tests with `cargo test --target `. src/clippy.rs gains a shape that lints the three against the host, since the host workspace's shapes no longer reach them; the other userland crates are not linted, as before. Every package keeps its name, so no `use` changes, and no lockfile but the root's changes: it drops the three that left its workspace. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WcU2Dsw6mDYtwYfzVHPzM8 --- Cargo.lock | 18 ------------- Cargo.toml | 17 ++++++------- .../desktop-session-put-26ms-of-silence.md | 2 +- .../audio/hda-ring-fix-unverified-on-metal.md | 2 +- ...ed-by-one-program-lives-in-that-program.md | 8 +++--- ...that-takes-a-freed-slot-is-queued-twice.md | 2 +- ...ransport-heads-orderings-have-no-oracle.md | 2 +- .../design-debt/what-is-owed-on-file-size.md | 6 ++--- ...yboard-will-not-report-its-scancode-set.md | 2 +- ...-boot-by-a-function-never-claimed-again.md | 2 +- kernel/Cargo.toml | 8 +++--- {toyos-dma => kernel/dma}/Cargo.toml | 0 {toyos-dma => kernel/dma}/src/lib.rs | 0 {toyos-gicv3 => kernel/gicv3}/Cargo.toml | 0 {toyos-gicv3 => kernel/gicv3}/src/lib.rs | 0 {toyos-gicv3 => kernel/gicv3}/tests/gicv3.rs | 0 {toyos-pci => kernel/pci}/Cargo.toml | 2 +- {toyos-pci => kernel/pci}/src/af.rs | 0 {toyos-pci => kernel/pci}/src/aperture.rs | 0 {toyos-pci => kernel/pci}/src/bar.rs | 0 {toyos-pci => kernel/pci}/src/bridge.rs | 0 {toyos-pci => kernel/pci}/src/caps.rs | 0 {toyos-pci => kernel/pci}/src/express.rs | 0 {toyos-pci => kernel/pci}/src/lib.rs | 0 {toyos-pci => kernel/pci}/src/msi.rs | 0 {toyos-pci => kernel/pci}/src/msix.rs | 0 {toyos-pci => kernel/pci}/src/placement.rs | 0 {toyos-pci => kernel/pci}/src/pm.rs | 0 {toyos-pci => kernel/pci}/src/probe.rs | 0 {toyos-pci => kernel/pci}/src/slot.rs | 0 {toyos-ps2 => kernel/ps2}/Cargo.toml | 0 {toyos-ps2 => kernel/ps2}/src/key.rs | 0 {toyos-ps2 => kernel/ps2}/src/lib.rs | 0 {toyos-ps2 => kernel/ps2}/src/mouse.rs | 0 {toyos-ps2 => kernel/ps2}/tests/decode.rs | 0 {toyos-ps2 => kernel/ps2}/tests/fuzz.rs | 0 src/clippy.rs | 23 ++++++++++++++--- src/userlandhost.rs | 25 +++++++------------ toyos-blockring/Cargo.toml | 2 +- .../transport}/Cargo.toml | 2 +- .../transport}/src/arena.rs | 0 .../transport}/src/inflight.rs | 0 .../transport}/src/lib.rs | 0 .../transport}/src/queue.rs | 0 .../transport}/tests/loom.rs | 0 toyos-desktop/Cargo.toml | 19 -------------- toyos-mdns/Cargo.toml | 16 ------------ toyos-net-shard/Cargo.toml | 4 +-- .../tcp}/Cargo.toml | 2 +- .../tcp}/src/cc.rs | 0 .../tcp}/src/conn.rs | 0 .../tcp}/src/counters.rs | 0 .../tcp}/src/lib.rs | 0 .../tcp}/src/open.rs | 0 .../tcp}/src/props.rs | 0 .../tcp}/src/ring.rs | 0 .../tcp}/src/rtt.rs | 0 .../tcp}/src/rx.rs | 0 .../tcp}/src/seq.rs | 0 .../tcp}/src/stack.rs | 0 .../tcp}/src/tx.rs | 0 .../tcp}/tests/acceptability.rs | 0 .../tcp}/tests/close.rs | 0 .../tcp}/tests/common/mod.rs | 0 .../tcp}/tests/common/net.rs | 0 .../tcp}/tests/congestion.rs | 0 .../tcp}/tests/egress.rs | 0 .../tcp}/tests/handshake.rs | 0 .../tcp}/tests/icmp.rs | 0 .../tcp}/tests/isn.rs | 0 .../tcp}/tests/listen.rs | 0 .../tcp}/tests/modern.rs | 0 .../tcp}/tests/net.rs | 0 .../tcp}/tests/options.rs | 0 .../tcp}/tests/port.rs | 0 .../tcp}/tests/receive.rs | 0 .../tcp}/tests/recovery.rs | 0 .../tcp}/tests/rtt.rs | 0 .../tcp}/tests/send.rs | 0 .../tcp}/tests/seq.rs | 0 .../tcp}/tests/timers.rs | 0 .../testnet}/Cargo.toml | 6 ++--- .../testnet}/src/lib.rs | 0 .../testnet}/src/pcap.rs | 0 .../testnet}/tests/testnet.rs | 0 userland/CLAUDE.md | 2 +- userland/Cargo.toml | 3 +++ userland/compositor/Cargo.toml | 2 +- userland/compositor/desktop/Cargo.toml | 19 ++++++++++++++ .../compositor/desktop}/src/budget.rs | 0 .../compositor/desktop}/src/damage.rs | 0 .../compositor/desktop}/src/hit.rs | 0 .../compositor/desktop}/src/input.rs | 0 .../compositor/desktop}/src/layout.rs | 0 .../compositor/desktop}/src/lib.rs | 0 .../compositor/desktop}/src/plan.rs | 0 .../compositor/desktop}/src/rect.rs | 0 .../compositor/desktop}/src/stack.rs | 0 .../compositor/desktop}/src/taskbar.rs | 0 .../compositor/desktop}/src/window.rs | 0 userland/netstack/Cargo.toml | 2 +- userland/netstack/mdns/Cargo.toml | 17 +++++++++++++ .../netstack/mdns}/src/lib.rs | 0 userland/soundserver/Cargo.toml | 2 +- .../soundserver/mixer}/Cargo.toml | 11 ++++---- .../mixer}/fixtures/mix-corpus.txt | 0 .../soundserver/mixer}/src/channel.rs | 0 .../soundserver/mixer}/src/corpus.rs | 0 .../soundserver/mixer}/src/dll.rs | 0 .../soundserver/mixer}/src/format.rs | 0 .../soundserver/mixer}/src/gain.rs | 0 .../soundserver/mixer}/src/lib.rs | 0 .../soundserver/mixer}/src/mix.rs | 0 .../soundserver/mixer}/src/shape.rs | 0 .../soundserver/mixer}/src/stats.rs | 0 userland/soundserver/src/main.rs | 6 ++--- 116 files changed, 115 insertions(+), 119 deletions(-) rename {toyos-dma => kernel/dma}/Cargo.toml (100%) rename {toyos-dma => kernel/dma}/src/lib.rs (100%) rename {toyos-gicv3 => kernel/gicv3}/Cargo.toml (100%) rename {toyos-gicv3 => kernel/gicv3}/src/lib.rs (100%) rename {toyos-gicv3 => kernel/gicv3}/tests/gicv3.rs (100%) rename {toyos-pci => kernel/pci}/Cargo.toml (95%) rename {toyos-pci => kernel/pci}/src/af.rs (100%) rename {toyos-pci => kernel/pci}/src/aperture.rs (100%) rename {toyos-pci => kernel/pci}/src/bar.rs (100%) rename {toyos-pci => kernel/pci}/src/bridge.rs (100%) rename {toyos-pci => kernel/pci}/src/caps.rs (100%) rename {toyos-pci => kernel/pci}/src/express.rs (100%) rename {toyos-pci => kernel/pci}/src/lib.rs (100%) rename {toyos-pci => kernel/pci}/src/msi.rs (100%) rename {toyos-pci => kernel/pci}/src/msix.rs (100%) rename {toyos-pci => kernel/pci}/src/placement.rs (100%) rename {toyos-pci => kernel/pci}/src/pm.rs (100%) rename {toyos-pci => kernel/pci}/src/probe.rs (100%) rename {toyos-pci => kernel/pci}/src/slot.rs (100%) rename {toyos-ps2 => kernel/ps2}/Cargo.toml (100%) rename {toyos-ps2 => kernel/ps2}/src/key.rs (100%) rename {toyos-ps2 => kernel/ps2}/src/lib.rs (100%) rename {toyos-ps2 => kernel/ps2}/src/mouse.rs (100%) rename {toyos-ps2 => kernel/ps2}/tests/decode.rs (100%) rename {toyos-ps2 => kernel/ps2}/tests/fuzz.rs (100%) rename {toyos-transport => toyos-blockring/transport}/Cargo.toml (96%) rename {toyos-transport => toyos-blockring/transport}/src/arena.rs (100%) rename {toyos-transport => toyos-blockring/transport}/src/inflight.rs (100%) rename {toyos-transport => toyos-blockring/transport}/src/lib.rs (100%) rename {toyos-transport => toyos-blockring/transport}/src/queue.rs (100%) rename {toyos-transport => toyos-blockring/transport}/tests/loom.rs (100%) delete mode 100644 toyos-desktop/Cargo.toml delete mode 100644 toyos-mdns/Cargo.toml rename {toyos-net-tcp => toyos-net-shard/tcp}/Cargo.toml (87%) rename {toyos-net-tcp => toyos-net-shard/tcp}/src/cc.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/src/conn.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/src/counters.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/src/lib.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/src/open.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/src/props.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/src/ring.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/src/rtt.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/src/rx.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/src/seq.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/src/stack.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/src/tx.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/acceptability.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/close.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/common/mod.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/common/net.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/congestion.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/egress.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/handshake.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/icmp.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/isn.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/listen.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/modern.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/net.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/options.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/port.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/receive.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/recovery.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/rtt.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/send.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/seq.rs (100%) rename {toyos-net-tcp => toyos-net-shard/tcp}/tests/timers.rs (100%) rename {toyos-net-testnet => toyos-net-shard/testnet}/Cargo.toml (78%) rename {toyos-net-testnet => toyos-net-shard/testnet}/src/lib.rs (100%) rename {toyos-net-testnet => toyos-net-shard/testnet}/src/pcap.rs (100%) rename {toyos-net-testnet => toyos-net-shard/testnet}/tests/testnet.rs (100%) create mode 100644 userland/compositor/desktop/Cargo.toml rename {toyos-desktop => userland/compositor/desktop}/src/budget.rs (100%) rename {toyos-desktop => userland/compositor/desktop}/src/damage.rs (100%) rename {toyos-desktop => userland/compositor/desktop}/src/hit.rs (100%) rename {toyos-desktop => userland/compositor/desktop}/src/input.rs (100%) rename {toyos-desktop => userland/compositor/desktop}/src/layout.rs (100%) rename {toyos-desktop => userland/compositor/desktop}/src/lib.rs (100%) rename {toyos-desktop => userland/compositor/desktop}/src/plan.rs (100%) rename {toyos-desktop => userland/compositor/desktop}/src/rect.rs (100%) rename {toyos-desktop => userland/compositor/desktop}/src/stack.rs (100%) rename {toyos-desktop => userland/compositor/desktop}/src/taskbar.rs (100%) rename {toyos-desktop => userland/compositor/desktop}/src/window.rs (100%) create mode 100644 userland/netstack/mdns/Cargo.toml rename {toyos-mdns => userland/netstack/mdns}/src/lib.rs (100%) rename {toyos-mixer => userland/soundserver/mixer}/Cargo.toml (54%) rename {toyos-mixer => userland/soundserver/mixer}/fixtures/mix-corpus.txt (100%) rename {toyos-mixer => userland/soundserver/mixer}/src/channel.rs (100%) rename {toyos-mixer => userland/soundserver/mixer}/src/corpus.rs (100%) rename {toyos-mixer => userland/soundserver/mixer}/src/dll.rs (100%) rename {toyos-mixer => userland/soundserver/mixer}/src/format.rs (100%) rename {toyos-mixer => userland/soundserver/mixer}/src/gain.rs (100%) rename {toyos-mixer => userland/soundserver/mixer}/src/lib.rs (100%) rename {toyos-mixer => userland/soundserver/mixer}/src/mix.rs (100%) rename {toyos-mixer => userland/soundserver/mixer}/src/shape.rs (100%) rename {toyos-mixer => userland/soundserver/mixer}/src/stats.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index a664d0ed2a6..b4e0cfe43fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1222,13 +1222,6 @@ dependencies = [ name = "toyos-cpuvuln" version = "0.1.0" -[[package]] -name = "toyos-desktop" -version = "0.1.0" -dependencies = [ - "toyos-abi", -] - [[package]] name = "toyos-dhcp" version = "0.1.0" @@ -1331,21 +1324,10 @@ dependencies = [ "toyos-abi", ] -[[package]] -name = "toyos-mdns" -version = "0.1.0" -dependencies = [ - "toyos-dns", -] - [[package]] name = "toyos-microcode" version = "0.1.0" -[[package]] -name = "toyos-mixer" -version = "0.1.0" - [[package]] name = "toyos-net-ip" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 17dbb338ff2..9c8e75f44c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,11 @@ [workspace] members = [ "bcachefs", + "kernel/dma", + "kernel/gicv3", "kernel/loom", + "kernel/pci", + "kernel/ps2", "kernel/sim", "tests/libc-arch", "toyos-abi", @@ -24,17 +28,15 @@ members = [ "toyos-blackbox", "toyos-blockhold", "toyos-blockring", + "toyos-blockring/transport", "toyos-bootmap", "toyos-cpuvuln", - "toyos-desktop", "toyos-dhcp", "toyos-dns", - "toyos-dma", "toyos-elf", "toyos-elide", "toyos-fat32", "toyos-fat32/check", - "toyos-gicv3", "toyos-gpt", "toyos-hda", "toyos-i219", @@ -43,24 +45,19 @@ members = [ "toyos-ld", "toyos-logstream", "toyos-manifest", - "toyos-mdns", "toyos-microcode", - "toyos-mixer", "toyos-net-ip", "toyos-net-shard", - "toyos-net-tcp", - "toyos-net-testnet", + "toyos-net-shard/tcp", + "toyos-net-shard/testnet", "toyos-net-udp", "toyos-net-wire", - "toyos-pci", - "toyos-ps2", "toyos-quiesce", "toyos-rootimage", "toyos-swap", "toyos-symbols", "toyos-tco", "toyos-tmpdir", - "toyos-transport", "toyos-untrusted", "toyos-update", "toyos-userbound", diff --git a/issues/audio/desktop-session-put-26ms-of-silence.md b/issues/audio/desktop-session-put-26ms-of-silence.md index f054d5545e7..271f6edd574 100644 --- a/issues/audio/desktop-session-put-26ms-of-silence.md +++ b/issues/audio/desktop-session-put-26ms-of-silence.md @@ -19,7 +19,7 @@ soundd: wakes=389 completions=690 submitted=690 underruns=1 drains=2 max_wake_la ``` Nine periods — 26 ms — submitted with a client streaming and no client audio -behind them (`MixStats::period` in `toyos-mixer/src/stats.rs`, which is where +behind them (`MixStats::period` in `userland/soundserver/mixer/src/stats.rs`, which is where that counter moved when the mixer's decisions became a pure crate). There is no capture to corroborate it: `--dump-audio` was not on. diff --git a/issues/audio/hda-ring-fix-unverified-on-metal.md b/issues/audio/hda-ring-fix-unverified-on-metal.md index 261405add8c..f271e7e8c5a 100644 --- a/issues/audio/hda-ring-fix-unverified-on-metal.md +++ b/issues/audio/hda-ring-fix-unverified-on-metal.md @@ -19,7 +19,7 @@ QEMU's `intel-hda` and the T14's controller are different devices, and the fix was measured on the first. What the next metal boot must show: `tone` playing to completion with soundd alive, `deferred=0`, and `underruns` nonzero only if the client stalls. Read `starve_max` on the same stats line -(`toyos-mixer/src/stats.rs`, printed by `userland/soundd/src/mix.rs`) beside +(`userland/soundserver/mixer/src/stats.rs`, printed by `userland/soundd/src/mix.rs`) beside `underruns`: it is the longest unbroken run of underrun periods, so near 1 with a large `underruns` is a client missing by a hair and 8–20 is a stall of one whole 21–53 ms ring. diff --git a/issues/build/code-used-by-one-program-lives-in-that-program.md b/issues/build/code-used-by-one-program-lives-in-that-program.md index 03f37595ae3..47e665cccca 100644 --- a/issues/build/code-used-by-one-program-lives-in-that-program.md +++ b/issues/build/code-used-by-one-program-lives-in-that-program.md @@ -32,9 +32,11 @@ change, before the speed work starts" (2026-10-03). packages that name it as a dependency of any kind, under any `cfg`, as `cargo metadata --no-deps` reads every manifest `git ls-files '*Cargo.toml'` lists, excluded packages and `tests/` included; a crate the images ship as a - program of its own counts as its own consumer. A move under a userland - program lands with `src/userlandhost.rs`'s survey gating a nested crate's - tests, which it lists as escapes today. + program of its own counts as its own consumer. Of two crates that are each + other's only consumer, the one the other names only as a dev-dependency + moves under it, and the count treats the pair as one crate. A move under a + userland program lands with `src/userlandhost.rs`'s survey gating a nested + crate's tests, which it lists as escapes today. Check: `--ci host` runs every test each package lists today, and `--clippy` lints them. diff --git a/issues/design-debt/a-tcp-connection-that-takes-a-freed-slot-is-queued-twice.md b/issues/design-debt/a-tcp-connection-that-takes-a-freed-slot-is-queued-twice.md index 6889e91c203..02f58a2ee81 100644 --- a/issues/design-debt/a-tcp-connection-that-takes-a-freed-slot-is-queued-twice.md +++ b/issues/design-debt/a-tcp-connection-that-takes-a-freed-slot-is-queued-twice.md @@ -6,7 +6,7 @@ opened: 2026-10-02 # A TCP connection that takes a freed slot is queued twice -`Tcp::free` (`toyos-net-tcp/src/stack.rs`) takes a freed connection's index out of `parked` and leaves it in `active`. `transmit` drops a stale index when it pops it and finds the slot empty, but a connection that takes the slot before then is queued by `settle` under the same index, so `active` holds it twice and it has two turns a round. A copy goes when its turn finds nothing due, and the next `settle` queues another while the first is still there, so the second turn lasts for as long as the connection stays busy. +`Tcp::free` (`toyos-net-shard/tcp/src/stack.rs`) takes a freed connection's index out of `parked` and leaves it in `active`. `transmit` drops a stale index when it pops it and finds the slot empty, but a connection that takes the slot before then is queued by `settle` under the same index, so `active` holds it twice and it has two turns a round. A copy goes when its turn finds nothing due, and the next `settle` queues another while the first is still there, so the second turn lasts for as long as the connection stays busy. Measured on `toyos-net-tcp`'s own harness (`tests/egress.rs`, `with_second`), with a scratch test that is not committed: diff --git a/issues/design-debt/the-transport-heads-orderings-have-no-oracle.md b/issues/design-debt/the-transport-heads-orderings-have-no-oracle.md index 29f06c94e32..2cc1b2a64c2 100644 --- a/issues/design-debt/the-transport-heads-orderings-have-no-oracle.md +++ b/issues/design-debt/the-transport-heads-orderings-have-no-oracle.md @@ -8,7 +8,7 @@ opened: 2026-09-27 A consumer stores its head `Release` after it has loaded the entries below it, and a producer loads the head `Acquire` before it writes over them -(`toyos-transport/src/queue.rs`, `Consumer::release` and `Producer::space`). +(`toyos-blockring/transport/src/queue.rs`, `Consumer::release` and `Producer::space`). No test reds if either is `Relaxed`: what the pair forbids is load buffering — a consumer's load of an entry reading the producer's later overwrite — which loom does not model, and every other test runs both ends on one thread. The diff --git a/issues/design-debt/what-is-owed-on-file-size.md b/issues/design-debt/what-is-owed-on-file-size.md index 306c88deed9..15f408388b9 100644 --- a/issues/design-debt/what-is-owed-on-file-size.md +++ b/issues/design-debt/what-is-owed-on-file-size.md @@ -14,14 +14,14 @@ what survives it is a different question. - `elf.rs` → `toyos-elf/` (host-tested, crafted-input corpus), `e2c6a06`; the mapping half stayed as `kernel/src/elf/`, `42b29c9`. -- `compositor/main.rs` → `toyos-desktop/` (pure), `763712b`; the effects shell +- `compositor/main.rs` → `userland/compositor/desktop/` (pure), `763712b`; the effects shell is `userland/compositor/` over five files with a 71-line `main.rs`, `72705d9`. - `xhci/mod.rs` → the port machine is `toyos-xhci/`, with a host simulator, `2e81ae8`. -- `soundd/main.rs` → `toyos-mixer/` (pure, `no_std`), 2026-08-20; the effects +- `soundd/main.rs` → `userland/soundserver/mixer/` (pure, `no_std`), 2026-08-20; the effects shell is `userland/soundd/` over eight files with a 261-line `main.rs`, from a 2,366-line one. What the note asked for is what it got: **the mixing is - sample-exact and proven so.** `toyos-mixer/fixtures/mix-corpus.txt` was + sample-exact and proven so.** `userland/soundserver/mixer/fixtures/mix-corpus.txt` was written by `soundd/src/main.rs` before a line of it moved, and `the_corpus_is_reproduced_bit_for_bit` holds the crate to it byte for byte. The transcript is compact because exhausted domains are digested rather than diff --git a/issues/hardware/t14-keyboard-will-not-report-its-scancode-set.md b/issues/hardware/t14-keyboard-will-not-report-its-scancode-set.md index efb175325bc..2acea2a6b92 100644 --- a/issues/hardware/t14-keyboard-will-not-report-its-scancode-set.md +++ b/issues/hardware/t14-keyboard-will-not-report-its-scancode-set.md @@ -46,7 +46,7 @@ What is open: - **One byte reached the kernel and produced no event, and the counters could not say which byte.** That is the open item, and half of it is the - instrument. Enumerated against the real tables (`toyos-ps2/src/key.rs`), + instrument. Enumerated against the real tables (`kernel/ps2/src/key.rs`), **84 of the 256 single byte values decode to nothing** under set 1: both prefixes (`0xE0`, `0xE1`), the two `Lost` codes, and every unmapped slot — `0x54`, `0x55`, `0x59`–`0x80` and their break forms. `handle_key` drops a diff --git a/issues/kernel/a-residue-slot-is-held-for-the-boot-by-a-function-never-claimed-again.md b/issues/kernel/a-residue-slot-is-held-for-the-boot-by-a-function-never-claimed-again.md index bc31c8539c4..5951f7a012d 100644 --- a/issues/kernel/a-residue-slot-is-held-for-the-boot-by-a-function-never-claimed-again.md +++ b/issues/kernel/a-residue-slot-is-held-for-the-boot-by-a-function-never-claimed-again.md @@ -7,7 +7,7 @@ opened: 2026-09-25 # A residue slot is held for the boot by a function never claimed again `pcidev::release` keeps a function it could not reset in its slot as -`Slot::Residue` (`toyos-pci/src/slot.rs`), with the device addresses its last +`Slot::Residue` (`kernel/pci/src/slot.rs`), with the device addresses its last holder's grants were at, so only that function's next claim is given the slot and its grants are placed at those addresses. Nothing ends that hold except that function's next claim. A function released without a reset and never diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml index f3d04a81dcb..7dea204185d 100644 --- a/kernel/Cargo.toml +++ b/kernel/Cargo.toml @@ -491,19 +491,19 @@ toyos-abi = { path = "../toyos-abi" } [target.'cfg(target_os = "none")'.dependencies] bcachefs = { path = "../bcachefs", default-features = false } toyos-acpi = { path = "../toyos-acpi" } -toyos-dma = { path = "../toyos-dma" } +toyos-dma = { path = "dma" } toyos-elide = { path = "../toyos-elide" } toyos-blackbox = { path = "../toyos-blackbox" } toyos-blockhold = { path = "../toyos-blockhold" } toyos-bootmap = { path = "../toyos-bootmap" } toyos-fat32 = { path = "../toyos-fat32" } toyos-elf = { path = "../toyos-elf" } -toyos-gicv3 = { path = "../toyos-gicv3" } +toyos-gicv3 = { path = "gicv3" } toyos-gpt = { path = "../toyos-gpt" } toyos-hda = { path = "../toyos-hda" } -toyos-pci = { path = "../toyos-pci" } +toyos-pci = { path = "pci" } toyos-tco = { path = "../toyos-tco" } -toyos-ps2 = { path = "../toyos-ps2" } +toyos-ps2 = { path = "ps2" } toyos-rootimage = { path = "../toyos-rootimage" } toyos-quiesce = { path = "../toyos-quiesce" } toyos-symbols = { path = "../toyos-symbols" } diff --git a/toyos-dma/Cargo.toml b/kernel/dma/Cargo.toml similarity index 100% rename from toyos-dma/Cargo.toml rename to kernel/dma/Cargo.toml diff --git a/toyos-dma/src/lib.rs b/kernel/dma/src/lib.rs similarity index 100% rename from toyos-dma/src/lib.rs rename to kernel/dma/src/lib.rs diff --git a/toyos-gicv3/Cargo.toml b/kernel/gicv3/Cargo.toml similarity index 100% rename from toyos-gicv3/Cargo.toml rename to kernel/gicv3/Cargo.toml diff --git a/toyos-gicv3/src/lib.rs b/kernel/gicv3/src/lib.rs similarity index 100% rename from toyos-gicv3/src/lib.rs rename to kernel/gicv3/src/lib.rs diff --git a/toyos-gicv3/tests/gicv3.rs b/kernel/gicv3/tests/gicv3.rs similarity index 100% rename from toyos-gicv3/tests/gicv3.rs rename to kernel/gicv3/tests/gicv3.rs diff --git a/toyos-pci/Cargo.toml b/kernel/pci/Cargo.toml similarity index 95% rename from toyos-pci/Cargo.toml rename to kernel/pci/Cargo.toml index 44a402a007a..1fbb354dadc 100644 --- a/toyos-pci/Cargo.toml +++ b/kernel/pci/Cargo.toml @@ -17,4 +17,4 @@ license = "MIT OR Apache-2.0" # The window type the bootloader hands the kernel, declared once in the ABI and # read here rather than mirrored: a second spelling of a base and a length is # two readers that can disagree about one machine's aperture. -toyos-abi = { path = "../toyos-abi" } +toyos-abi = { path = "../../toyos-abi" } diff --git a/toyos-pci/src/af.rs b/kernel/pci/src/af.rs similarity index 100% rename from toyos-pci/src/af.rs rename to kernel/pci/src/af.rs diff --git a/toyos-pci/src/aperture.rs b/kernel/pci/src/aperture.rs similarity index 100% rename from toyos-pci/src/aperture.rs rename to kernel/pci/src/aperture.rs diff --git a/toyos-pci/src/bar.rs b/kernel/pci/src/bar.rs similarity index 100% rename from toyos-pci/src/bar.rs rename to kernel/pci/src/bar.rs diff --git a/toyos-pci/src/bridge.rs b/kernel/pci/src/bridge.rs similarity index 100% rename from toyos-pci/src/bridge.rs rename to kernel/pci/src/bridge.rs diff --git a/toyos-pci/src/caps.rs b/kernel/pci/src/caps.rs similarity index 100% rename from toyos-pci/src/caps.rs rename to kernel/pci/src/caps.rs diff --git a/toyos-pci/src/express.rs b/kernel/pci/src/express.rs similarity index 100% rename from toyos-pci/src/express.rs rename to kernel/pci/src/express.rs diff --git a/toyos-pci/src/lib.rs b/kernel/pci/src/lib.rs similarity index 100% rename from toyos-pci/src/lib.rs rename to kernel/pci/src/lib.rs diff --git a/toyos-pci/src/msi.rs b/kernel/pci/src/msi.rs similarity index 100% rename from toyos-pci/src/msi.rs rename to kernel/pci/src/msi.rs diff --git a/toyos-pci/src/msix.rs b/kernel/pci/src/msix.rs similarity index 100% rename from toyos-pci/src/msix.rs rename to kernel/pci/src/msix.rs diff --git a/toyos-pci/src/placement.rs b/kernel/pci/src/placement.rs similarity index 100% rename from toyos-pci/src/placement.rs rename to kernel/pci/src/placement.rs diff --git a/toyos-pci/src/pm.rs b/kernel/pci/src/pm.rs similarity index 100% rename from toyos-pci/src/pm.rs rename to kernel/pci/src/pm.rs diff --git a/toyos-pci/src/probe.rs b/kernel/pci/src/probe.rs similarity index 100% rename from toyos-pci/src/probe.rs rename to kernel/pci/src/probe.rs diff --git a/toyos-pci/src/slot.rs b/kernel/pci/src/slot.rs similarity index 100% rename from toyos-pci/src/slot.rs rename to kernel/pci/src/slot.rs diff --git a/toyos-ps2/Cargo.toml b/kernel/ps2/Cargo.toml similarity index 100% rename from toyos-ps2/Cargo.toml rename to kernel/ps2/Cargo.toml diff --git a/toyos-ps2/src/key.rs b/kernel/ps2/src/key.rs similarity index 100% rename from toyos-ps2/src/key.rs rename to kernel/ps2/src/key.rs diff --git a/toyos-ps2/src/lib.rs b/kernel/ps2/src/lib.rs similarity index 100% rename from toyos-ps2/src/lib.rs rename to kernel/ps2/src/lib.rs diff --git a/toyos-ps2/src/mouse.rs b/kernel/ps2/src/mouse.rs similarity index 100% rename from toyos-ps2/src/mouse.rs rename to kernel/ps2/src/mouse.rs diff --git a/toyos-ps2/tests/decode.rs b/kernel/ps2/tests/decode.rs similarity index 100% rename from toyos-ps2/tests/decode.rs rename to kernel/ps2/tests/decode.rs diff --git a/toyos-ps2/tests/fuzz.rs b/kernel/ps2/tests/fuzz.rs similarity index 100% rename from toyos-ps2/tests/fuzz.rs rename to kernel/ps2/tests/fuzz.rs diff --git a/src/clippy.rs b/src/clippy.rs index 53621bcd273..24b15dab82f 100644 --- a/src/clippy.rs +++ b/src/clippy.rs @@ -4,9 +4,9 @@ //! host` runs the same list as one of its steps, so the local command and //! the merge gate cannot verify different sets. //! -//! Userland is not here: its targets are the fork's own, and the fork's -//! `toyos` toolchain ships no clippy. The kernel and the bootloader are linted -//! for every architecture. +//! Userland's programs are not here: their targets are the fork's own, and the +//! fork's `toyos` toolchain ships no clippy. The kernel and the bootloader are +//! linted for every architecture. use std::path::Path; use std::process::Command; @@ -188,6 +188,23 @@ const SHAPES: &[Shape] = &[ ], after: &["$ADOPTED", "-D", "warnings"], }, + // The pure crates under userland programs, against the host, as `--ci + // host` tests them. + Shape { + dir: "", + before: &[ + "--manifest-path", + "userland/Cargo.toml", + "-p", + "toyos-desktop", + "-p", + "toyos-mdns", + "-p", + "toyos-mixer", + "--all-targets", + ], + after: &["$ADOPTED", "-D", "warnings"], + }, // Its own target directory: cargo keeps one check of a unit, so a unit // linted under two sets of lints is checked again by each, every run, and // so is every crate depending on it. diff --git a/src/userlandhost.rs b/src/userlandhost.rs index fe5fed7e72a..9d74d61c5b1 100644 --- a/src/userlandhost.rs +++ b/src/userlandhost.rs @@ -40,10 +40,10 @@ //! and not tests, and the one tool that lists tests, the test binary, needs a //! host build most userland crates cannot make. So the reading is made to fail //! loudly: a test is gated only in the one shape a default `cargo test` in a -//! crate directly under `userland/` is known to run. That is an attribute naming -//! `test` or `test_case`, in a file under the crate's `src/` or `tests/`, in a -//! crate whose only `cfg` is `cfg(test)`, which ignores no test, and whose -//! manifest switches off no target's tests. +//! crate is known to run. That is an attribute naming `test` or `test_case`, in +//! a file under the `src/` or `tests/` of the crate nearest it, in a crate whose +//! only `cfg` is `cfg(test)`, which ignores no test, and whose manifest switches +//! off no target's tests. //! //! Doc-tests are not read: a library crate that leaves `doctest` on is refused, //! because the `toyos` toolchain builds no rustdoc. @@ -59,15 +59,15 @@ use crate::build::Features; /// What [`survey`] found under one `userland/` directory. #[derive(Debug, PartialEq, Eq)] pub struct Survey { - /// The crates `host` runs, by directory name, sorted. + /// The crates `host` runs, by directory under `userland/`, sorted. pub gated: Vec, /// Every test the gate would not run, each as `: why`, /// sorted. `host` is red while this is not empty. pub escapes: Vec, } -/// Every crate directly under `userland` that holds a test, and every test that -/// no `cargo test` in one of them runs. +/// Every crate under `userland` that holds a test, and every test that no +/// `cargo test` in one of them runs. pub fn survey(userland: &Path) -> Result { let mut files = Vec::new(); rs_files(userland, &mut files)?; @@ -101,11 +101,7 @@ pub fn survey(userland: &Path) -> Result { continue; } let inside = rel(owner, file); - if crate_name.contains('/') { - escapes.insert(format!( - "{at}: a test in the nested crate {crate_name}, which the gate does not discover" - )); - } else if !(inside.starts_with("src/") || inside.starts_with("tests/")) { + if !(inside.starts_with("src/") || inside.starts_with("tests/")) { escapes.insert(format!( "{at}: a test outside {crate_name}'s src/ and tests/, which cargo test does not run" )); @@ -501,7 +497,7 @@ mod tests { assert_eq!( found, Ok(Survey { - gated: vec!["gated".into(), "switched".into(), "testsonly".into()], + gated: vec!["gated".into(), "gated/sub".into(), "switched".into(), "testsonly".into()], escapes: vec![ "doctested/Cargo.toml: a library without [lib] doctest = false, whose \ doc-tests the gate does not read" @@ -513,9 +509,6 @@ mod tests { test does not run" .into(), "gated/src/slow.rs: an ignored test runs nowhere".into(), - "gated/sub/src/lib.rs: a test in the nested crate gated/sub, which the gate \ - does not discover" - .into(), "loose.rs: a test in no crate".into(), "switched/Cargo.toml: [lib] test = false leaves its tests unrun".into(), ], diff --git a/toyos-blockring/Cargo.toml b/toyos-blockring/Cargo.toml index 49d270469cf..1c118b269cb 100644 --- a/toyos-blockring/Cargo.toml +++ b/toyos-blockring/Cargo.toml @@ -40,7 +40,7 @@ mutate-no-reissue-after-loss = [] # it today. toyos-blockhold = { path = "../toyos-blockhold" } # The rings on the session page. -toyos-transport = { path = "../toyos-transport" } +toyos-transport = { path = "transport" } [lints.rust] warnings = "deny" diff --git a/toyos-transport/Cargo.toml b/toyos-blockring/transport/Cargo.toml similarity index 96% rename from toyos-transport/Cargo.toml rename to toyos-blockring/transport/Cargo.toml index 2b7ec21bd63..fa15e3c4710 100644 --- a/toyos-transport/Cargo.toml +++ b/toyos-blockring/transport/Cargo.toml @@ -30,7 +30,7 @@ no-clamp = [] end-keeps-inflight = [] [dependencies] -toyos-untrusted = { path = "../toyos-untrusted" } +toyos-untrusted = { path = "../../toyos-untrusted" } [dev-dependencies] loom = "0.7" diff --git a/toyos-transport/src/arena.rs b/toyos-blockring/transport/src/arena.rs similarity index 100% rename from toyos-transport/src/arena.rs rename to toyos-blockring/transport/src/arena.rs diff --git a/toyos-transport/src/inflight.rs b/toyos-blockring/transport/src/inflight.rs similarity index 100% rename from toyos-transport/src/inflight.rs rename to toyos-blockring/transport/src/inflight.rs diff --git a/toyos-transport/src/lib.rs b/toyos-blockring/transport/src/lib.rs similarity index 100% rename from toyos-transport/src/lib.rs rename to toyos-blockring/transport/src/lib.rs diff --git a/toyos-transport/src/queue.rs b/toyos-blockring/transport/src/queue.rs similarity index 100% rename from toyos-transport/src/queue.rs rename to toyos-blockring/transport/src/queue.rs diff --git a/toyos-transport/tests/loom.rs b/toyos-blockring/transport/tests/loom.rs similarity index 100% rename from toyos-transport/tests/loom.rs rename to toyos-blockring/transport/tests/loom.rs diff --git a/toyos-desktop/Cargo.toml b/toyos-desktop/Cargo.toml deleted file mode 100644 index 2caa27ee49a..00000000000 --- a/toyos-desktop/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -# A member of the host workspace (root `Cargo.toml`), like toyos-hda, -# toyos-keymap and toyos-ps2: its tests run on the host with no target-triple -# juggling, and the compositor depends on it by path. Everything the desktop -# *decides* — where a window is, what changed, what the pointer hit, who has the -# focus, what a key means — is a pure function of state, and a QEMU boot is a -# poor way to ask any of them. - -[package] -name = "toyos-desktop" -description = "Every decision the compositor makes, pure." -version = "0.1.0" -edition = "2021" -license = "MIT OR Apache-2.0" - -[dependencies] -toyos-abi = { path = "../toyos-abi" } - -[lints.rust] -warnings = "deny" diff --git a/toyos-mdns/Cargo.toml b/toyos-mdns/Cargo.toml deleted file mode 100644 index 43e733c7d27..00000000000 --- a/toyos-mdns/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -# A member of the host workspace (root `Cargo.toml`): netstack answers with it on -# the guest, and its tests run on the host. What lives here is the wire form of -# one machine answering for its own name — pure, so every byte of a reply is -# checked without a network. - -[package] -name = "toyos-mdns" -description = "Multicast DNS (RFC 6762) for one machine's own .local name." -version = "0.1.0" -edition = "2021" -license = "MIT OR Apache-2.0" - -[dependencies] -# The wire reader: a question's name is read by the same code, under the same -# rules, as a resolver's reply. -toyos-dns = { path = "../toyos-dns" } diff --git a/toyos-net-shard/Cargo.toml b/toyos-net-shard/Cargo.toml index 4d50f58910e..aec34203e8c 100644 --- a/toyos-net-shard/Cargo.toml +++ b/toyos-net-shard/Cargo.toml @@ -8,9 +8,9 @@ publish = false [dependencies] toyos-net-ip = { path = "../toyos-net-ip" } -toyos-net-tcp = { path = "../toyos-net-tcp" } +toyos-net-tcp = { path = "tcp" } toyos-net-udp = { path = "../toyos-net-udp" } toyos-net-wire = { path = "../toyos-net-wire" } [dev-dependencies] -toyos-net-testnet = { path = "../toyos-net-testnet" } +toyos-net-testnet = { path = "testnet" } diff --git a/toyos-net-tcp/Cargo.toml b/toyos-net-shard/tcp/Cargo.toml similarity index 87% rename from toyos-net-tcp/Cargo.toml rename to toyos-net-shard/tcp/Cargo.toml index def9c04ae32..68d326f4d04 100644 --- a/toyos-net-tcp/Cargo.toml +++ b/toyos-net-shard/tcp/Cargo.toml @@ -9,4 +9,4 @@ description = "ToyOS's TCP, pure: the caller hands in the time, the secrets, par publish = false [dependencies] -toyos-net-wire = { path = "../toyos-net-wire" } +toyos-net-wire = { path = "../../toyos-net-wire" } diff --git a/toyos-net-tcp/src/cc.rs b/toyos-net-shard/tcp/src/cc.rs similarity index 100% rename from toyos-net-tcp/src/cc.rs rename to toyos-net-shard/tcp/src/cc.rs diff --git a/toyos-net-tcp/src/conn.rs b/toyos-net-shard/tcp/src/conn.rs similarity index 100% rename from toyos-net-tcp/src/conn.rs rename to toyos-net-shard/tcp/src/conn.rs diff --git a/toyos-net-tcp/src/counters.rs b/toyos-net-shard/tcp/src/counters.rs similarity index 100% rename from toyos-net-tcp/src/counters.rs rename to toyos-net-shard/tcp/src/counters.rs diff --git a/toyos-net-tcp/src/lib.rs b/toyos-net-shard/tcp/src/lib.rs similarity index 100% rename from toyos-net-tcp/src/lib.rs rename to toyos-net-shard/tcp/src/lib.rs diff --git a/toyos-net-tcp/src/open.rs b/toyos-net-shard/tcp/src/open.rs similarity index 100% rename from toyos-net-tcp/src/open.rs rename to toyos-net-shard/tcp/src/open.rs diff --git a/toyos-net-tcp/src/props.rs b/toyos-net-shard/tcp/src/props.rs similarity index 100% rename from toyos-net-tcp/src/props.rs rename to toyos-net-shard/tcp/src/props.rs diff --git a/toyos-net-tcp/src/ring.rs b/toyos-net-shard/tcp/src/ring.rs similarity index 100% rename from toyos-net-tcp/src/ring.rs rename to toyos-net-shard/tcp/src/ring.rs diff --git a/toyos-net-tcp/src/rtt.rs b/toyos-net-shard/tcp/src/rtt.rs similarity index 100% rename from toyos-net-tcp/src/rtt.rs rename to toyos-net-shard/tcp/src/rtt.rs diff --git a/toyos-net-tcp/src/rx.rs b/toyos-net-shard/tcp/src/rx.rs similarity index 100% rename from toyos-net-tcp/src/rx.rs rename to toyos-net-shard/tcp/src/rx.rs diff --git a/toyos-net-tcp/src/seq.rs b/toyos-net-shard/tcp/src/seq.rs similarity index 100% rename from toyos-net-tcp/src/seq.rs rename to toyos-net-shard/tcp/src/seq.rs diff --git a/toyos-net-tcp/src/stack.rs b/toyos-net-shard/tcp/src/stack.rs similarity index 100% rename from toyos-net-tcp/src/stack.rs rename to toyos-net-shard/tcp/src/stack.rs diff --git a/toyos-net-tcp/src/tx.rs b/toyos-net-shard/tcp/src/tx.rs similarity index 100% rename from toyos-net-tcp/src/tx.rs rename to toyos-net-shard/tcp/src/tx.rs diff --git a/toyos-net-tcp/tests/acceptability.rs b/toyos-net-shard/tcp/tests/acceptability.rs similarity index 100% rename from toyos-net-tcp/tests/acceptability.rs rename to toyos-net-shard/tcp/tests/acceptability.rs diff --git a/toyos-net-tcp/tests/close.rs b/toyos-net-shard/tcp/tests/close.rs similarity index 100% rename from toyos-net-tcp/tests/close.rs rename to toyos-net-shard/tcp/tests/close.rs diff --git a/toyos-net-tcp/tests/common/mod.rs b/toyos-net-shard/tcp/tests/common/mod.rs similarity index 100% rename from toyos-net-tcp/tests/common/mod.rs rename to toyos-net-shard/tcp/tests/common/mod.rs diff --git a/toyos-net-tcp/tests/common/net.rs b/toyos-net-shard/tcp/tests/common/net.rs similarity index 100% rename from toyos-net-tcp/tests/common/net.rs rename to toyos-net-shard/tcp/tests/common/net.rs diff --git a/toyos-net-tcp/tests/congestion.rs b/toyos-net-shard/tcp/tests/congestion.rs similarity index 100% rename from toyos-net-tcp/tests/congestion.rs rename to toyos-net-shard/tcp/tests/congestion.rs diff --git a/toyos-net-tcp/tests/egress.rs b/toyos-net-shard/tcp/tests/egress.rs similarity index 100% rename from toyos-net-tcp/tests/egress.rs rename to toyos-net-shard/tcp/tests/egress.rs diff --git a/toyos-net-tcp/tests/handshake.rs b/toyos-net-shard/tcp/tests/handshake.rs similarity index 100% rename from toyos-net-tcp/tests/handshake.rs rename to toyos-net-shard/tcp/tests/handshake.rs diff --git a/toyos-net-tcp/tests/icmp.rs b/toyos-net-shard/tcp/tests/icmp.rs similarity index 100% rename from toyos-net-tcp/tests/icmp.rs rename to toyos-net-shard/tcp/tests/icmp.rs diff --git a/toyos-net-tcp/tests/isn.rs b/toyos-net-shard/tcp/tests/isn.rs similarity index 100% rename from toyos-net-tcp/tests/isn.rs rename to toyos-net-shard/tcp/tests/isn.rs diff --git a/toyos-net-tcp/tests/listen.rs b/toyos-net-shard/tcp/tests/listen.rs similarity index 100% rename from toyos-net-tcp/tests/listen.rs rename to toyos-net-shard/tcp/tests/listen.rs diff --git a/toyos-net-tcp/tests/modern.rs b/toyos-net-shard/tcp/tests/modern.rs similarity index 100% rename from toyos-net-tcp/tests/modern.rs rename to toyos-net-shard/tcp/tests/modern.rs diff --git a/toyos-net-tcp/tests/net.rs b/toyos-net-shard/tcp/tests/net.rs similarity index 100% rename from toyos-net-tcp/tests/net.rs rename to toyos-net-shard/tcp/tests/net.rs diff --git a/toyos-net-tcp/tests/options.rs b/toyos-net-shard/tcp/tests/options.rs similarity index 100% rename from toyos-net-tcp/tests/options.rs rename to toyos-net-shard/tcp/tests/options.rs diff --git a/toyos-net-tcp/tests/port.rs b/toyos-net-shard/tcp/tests/port.rs similarity index 100% rename from toyos-net-tcp/tests/port.rs rename to toyos-net-shard/tcp/tests/port.rs diff --git a/toyos-net-tcp/tests/receive.rs b/toyos-net-shard/tcp/tests/receive.rs similarity index 100% rename from toyos-net-tcp/tests/receive.rs rename to toyos-net-shard/tcp/tests/receive.rs diff --git a/toyos-net-tcp/tests/recovery.rs b/toyos-net-shard/tcp/tests/recovery.rs similarity index 100% rename from toyos-net-tcp/tests/recovery.rs rename to toyos-net-shard/tcp/tests/recovery.rs diff --git a/toyos-net-tcp/tests/rtt.rs b/toyos-net-shard/tcp/tests/rtt.rs similarity index 100% rename from toyos-net-tcp/tests/rtt.rs rename to toyos-net-shard/tcp/tests/rtt.rs diff --git a/toyos-net-tcp/tests/send.rs b/toyos-net-shard/tcp/tests/send.rs similarity index 100% rename from toyos-net-tcp/tests/send.rs rename to toyos-net-shard/tcp/tests/send.rs diff --git a/toyos-net-tcp/tests/seq.rs b/toyos-net-shard/tcp/tests/seq.rs similarity index 100% rename from toyos-net-tcp/tests/seq.rs rename to toyos-net-shard/tcp/tests/seq.rs diff --git a/toyos-net-tcp/tests/timers.rs b/toyos-net-shard/tcp/tests/timers.rs similarity index 100% rename from toyos-net-tcp/tests/timers.rs rename to toyos-net-shard/tcp/tests/timers.rs diff --git a/toyos-net-testnet/Cargo.toml b/toyos-net-shard/testnet/Cargo.toml similarity index 78% rename from toyos-net-testnet/Cargo.toml rename to toyos-net-shard/testnet/Cargo.toml index 1e171aacaf8..fb31ef758ee 100644 --- a/toyos-net-testnet/Cargo.toml +++ b/toyos-net-shard/testnet/Cargo.toml @@ -7,9 +7,9 @@ description = "A fake Ethernet for toyos-net-shard's host tests: N shards on one publish = false [dependencies] -toyos-net-shard = { path = "../toyos-net-shard" } -toyos-net-tcp = { path = "../toyos-net-tcp" } -toyos-net-wire = { path = "../toyos-net-wire" } +toyos-net-shard = { path = ".." } +toyos-net-tcp = { path = "../tcp" } +toyos-net-wire = { path = "../../toyos-net-wire" } [dev-dependencies] # The capture's independent oracle (architecture §5.3 (f)): a published pcap reader and a published diff --git a/toyos-net-testnet/src/lib.rs b/toyos-net-shard/testnet/src/lib.rs similarity index 100% rename from toyos-net-testnet/src/lib.rs rename to toyos-net-shard/testnet/src/lib.rs diff --git a/toyos-net-testnet/src/pcap.rs b/toyos-net-shard/testnet/src/pcap.rs similarity index 100% rename from toyos-net-testnet/src/pcap.rs rename to toyos-net-shard/testnet/src/pcap.rs diff --git a/toyos-net-testnet/tests/testnet.rs b/toyos-net-shard/testnet/tests/testnet.rs similarity index 100% rename from toyos-net-testnet/tests/testnet.rs rename to toyos-net-shard/testnet/tests/testnet.rs diff --git a/userland/CLAUDE.md b/userland/CLAUDE.md index 11b183cd38a..f3001f7c030 100644 --- a/userland/CLAUDE.md +++ b/userland/CLAUDE.md @@ -1,6 +1,6 @@ # Userland -The module header at the site owns its subject — surfaces, translators and the channel in `toyos/`'s surface modules, soundserver whole under `userland/soundserver/`, what a process holds and how it got it at `kernel/src/object/` and `/system/bin/supervisor`. The compositor's decisions are `toyos-desktop/`, pure and host-tested; `userland/compositor/` is devices, handles, shared memory and the panel. +The module header at the site owns its subject — surfaces, translators and the channel in `toyos/`'s surface modules, soundserver whole under `userland/soundserver/`, what a process holds and how it got it at `kernel/src/object/` and `/system/bin/supervisor`. The compositor's decisions are `userland/compositor/desktop/`, pure and host-tested; `userland/compositor/` is devices, handles, shared memory and the panel. **A server never blocks on a client** — the doctrine no single site owns. Accept and the first frame are two events; a frame is buffered until whole before anything acts on it; a write is one `try_send` whose refusal drops the peer by name; a blocking read or write of a pipe the client owns is the same bug. The supervisor, the compositor, netstack, soundserver and every surface host use `ipc::FrameRx`. diff --git a/userland/Cargo.toml b/userland/Cargo.toml index 0a9f893aee5..260fa329b7f 100644 --- a/userland/Cargo.toml +++ b/userland/Cargo.toml @@ -3,6 +3,7 @@ resolver = "2" members = [ "calc", "compositor", + "compositor/desktop", "console", "diskserver", "doom", @@ -17,12 +18,14 @@ members = [ "logkeeper", "metalprobe", "netstack", + "netstack/mdns", "paint", "pkg", "proctest", "shell", "snake", "soundserver", + "soundserver/mixer", "sprite", "sshserver", "supervisor", diff --git a/userland/compositor/Cargo.toml b/userland/compositor/Cargo.toml index f8ff69cf360..1860841e17f 100644 --- a/userland/compositor/Cargo.toml +++ b/userland/compositor/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" sprite = { path = "../sprite" } toyos = { path = "../../toyos" } toyos-abi = { path = "../../toyos-abi" } -toyos-desktop = { path = "../../toyos-desktop" } +toyos-desktop = { path = "desktop" } toyos-inspect = { path = "../../toyos-inspect" } toyos-font = { path = "../toyos-font" } toyos-manifest = { path = "../../toyos-manifest" } diff --git a/userland/compositor/desktop/Cargo.toml b/userland/compositor/desktop/Cargo.toml new file mode 100644 index 00000000000..b7e2dba5d4c --- /dev/null +++ b/userland/compositor/desktop/Cargo.toml @@ -0,0 +1,19 @@ +# Everything the desktop *decides* — where a window is, what changed, what the pointer hit, who has the +# focus, what a key means — is a pure function of state, and a QEMU boot is a +# poor way to ask any of them. + +[package] +name = "toyos-desktop" +description = "Every decision the compositor makes, pure." +version = "0.1.0" +edition = "2021" +license = "MIT OR Apache-2.0" + +[lib] +doctest = false + +[dependencies] +toyos-abi = { path = "../../../toyos-abi" } + +[lints.rust] +warnings = "deny" diff --git a/toyos-desktop/src/budget.rs b/userland/compositor/desktop/src/budget.rs similarity index 100% rename from toyos-desktop/src/budget.rs rename to userland/compositor/desktop/src/budget.rs diff --git a/toyos-desktop/src/damage.rs b/userland/compositor/desktop/src/damage.rs similarity index 100% rename from toyos-desktop/src/damage.rs rename to userland/compositor/desktop/src/damage.rs diff --git a/toyos-desktop/src/hit.rs b/userland/compositor/desktop/src/hit.rs similarity index 100% rename from toyos-desktop/src/hit.rs rename to userland/compositor/desktop/src/hit.rs diff --git a/toyos-desktop/src/input.rs b/userland/compositor/desktop/src/input.rs similarity index 100% rename from toyos-desktop/src/input.rs rename to userland/compositor/desktop/src/input.rs diff --git a/toyos-desktop/src/layout.rs b/userland/compositor/desktop/src/layout.rs similarity index 100% rename from toyos-desktop/src/layout.rs rename to userland/compositor/desktop/src/layout.rs diff --git a/toyos-desktop/src/lib.rs b/userland/compositor/desktop/src/lib.rs similarity index 100% rename from toyos-desktop/src/lib.rs rename to userland/compositor/desktop/src/lib.rs diff --git a/toyos-desktop/src/plan.rs b/userland/compositor/desktop/src/plan.rs similarity index 100% rename from toyos-desktop/src/plan.rs rename to userland/compositor/desktop/src/plan.rs diff --git a/toyos-desktop/src/rect.rs b/userland/compositor/desktop/src/rect.rs similarity index 100% rename from toyos-desktop/src/rect.rs rename to userland/compositor/desktop/src/rect.rs diff --git a/toyos-desktop/src/stack.rs b/userland/compositor/desktop/src/stack.rs similarity index 100% rename from toyos-desktop/src/stack.rs rename to userland/compositor/desktop/src/stack.rs diff --git a/toyos-desktop/src/taskbar.rs b/userland/compositor/desktop/src/taskbar.rs similarity index 100% rename from toyos-desktop/src/taskbar.rs rename to userland/compositor/desktop/src/taskbar.rs diff --git a/toyos-desktop/src/window.rs b/userland/compositor/desktop/src/window.rs similarity index 100% rename from toyos-desktop/src/window.rs rename to userland/compositor/desktop/src/window.rs diff --git a/userland/netstack/Cargo.toml b/userland/netstack/Cargo.toml index 26735c158b8..04c8770a26d 100644 --- a/userland/netstack/Cargo.toml +++ b/userland/netstack/Cargo.toml @@ -8,7 +8,7 @@ toyos-abi = { path = "../../toyos-abi" } toyos = { path = "../../toyos" } toyos-i219 = { path = "../../toyos-i219" } toyos-tco = { path = "../../toyos-tco" } -toyos-mdns = { path = "../../toyos-mdns" } +toyos-mdns = { path = "mdns" } toyos-dns = { path = "../../toyos-dns" } toyos-inspect = { path = "../../toyos-inspect" } diff --git a/userland/netstack/mdns/Cargo.toml b/userland/netstack/mdns/Cargo.toml new file mode 100644 index 00000000000..695a05b1039 --- /dev/null +++ b/userland/netstack/mdns/Cargo.toml @@ -0,0 +1,17 @@ +# What lives here is the wire form of one machine answering for its own name — +# pure, so every byte of a reply is checked without a network. + +[package] +name = "toyos-mdns" +description = "Multicast DNS (RFC 6762) for one machine's own .local name." +version = "0.1.0" +edition = "2021" +license = "MIT OR Apache-2.0" + +[lib] +doctest = false + +[dependencies] +# The wire reader: a question's name is read by the same code, under the same +# rules, as a resolver's reply. +toyos-dns = { path = "../../../toyos-dns" } diff --git a/toyos-mdns/src/lib.rs b/userland/netstack/mdns/src/lib.rs similarity index 100% rename from toyos-mdns/src/lib.rs rename to userland/netstack/mdns/src/lib.rs diff --git a/userland/soundserver/Cargo.toml b/userland/soundserver/Cargo.toml index d4663aef1e9..5d2a71fcbe4 100644 --- a/userland/soundserver/Cargo.toml +++ b/userland/soundserver/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" toyos-abi = { path = "../../toyos-abi" } toyos = { path = "../../toyos" } toyos-hda = { path = "../../toyos-hda" } -toyos-mixer = { path = "../../toyos-mixer" } +toyos-mixer = { path = "mixer" } toyos-inspect = { path = "../../toyos-inspect" } rubato = "0.16" diff --git a/toyos-mixer/Cargo.toml b/userland/soundserver/mixer/Cargo.toml similarity index 54% rename from toyos-mixer/Cargo.toml rename to userland/soundserver/mixer/Cargo.toml index 0f4295cb47a..696611fef78 100644 --- a/toyos-mixer/Cargo.toml +++ b/userland/soundserver/mixer/Cargo.toml @@ -1,8 +1,6 @@ -# A member of the host workspace (root `Cargo.toml`), like toyos-desktop and -# toyos-hda: its tests run on the host with no target-triple juggling, and -# soundserver depends on it by path. What lives here is every decision soundserver makes -# about *samples* — decode, channel conversion, gain, the sum on the shared bus, -# dither and quantize — and the arithmetic those rest on. +# What lives here is every decision soundserver makes about *samples* — decode, +# channel conversion, gain, the sum on the shared bus, dither and quantize — and +# the arithmetic those rest on. # # No dependencies, deliberately. `toyos-abi` is not one either: nothing here # names a syscall, a handle or a shared-memory layout — a period arrives as a @@ -15,5 +13,8 @@ version = "0.1.0" edition = "2021" license = "MIT OR Apache-2.0" +[lib] +doctest = false + [lints.rust] warnings = "deny" diff --git a/toyos-mixer/fixtures/mix-corpus.txt b/userland/soundserver/mixer/fixtures/mix-corpus.txt similarity index 100% rename from toyos-mixer/fixtures/mix-corpus.txt rename to userland/soundserver/mixer/fixtures/mix-corpus.txt diff --git a/toyos-mixer/src/channel.rs b/userland/soundserver/mixer/src/channel.rs similarity index 100% rename from toyos-mixer/src/channel.rs rename to userland/soundserver/mixer/src/channel.rs diff --git a/toyos-mixer/src/corpus.rs b/userland/soundserver/mixer/src/corpus.rs similarity index 100% rename from toyos-mixer/src/corpus.rs rename to userland/soundserver/mixer/src/corpus.rs diff --git a/toyos-mixer/src/dll.rs b/userland/soundserver/mixer/src/dll.rs similarity index 100% rename from toyos-mixer/src/dll.rs rename to userland/soundserver/mixer/src/dll.rs diff --git a/toyos-mixer/src/format.rs b/userland/soundserver/mixer/src/format.rs similarity index 100% rename from toyos-mixer/src/format.rs rename to userland/soundserver/mixer/src/format.rs diff --git a/toyos-mixer/src/gain.rs b/userland/soundserver/mixer/src/gain.rs similarity index 100% rename from toyos-mixer/src/gain.rs rename to userland/soundserver/mixer/src/gain.rs diff --git a/toyos-mixer/src/lib.rs b/userland/soundserver/mixer/src/lib.rs similarity index 100% rename from toyos-mixer/src/lib.rs rename to userland/soundserver/mixer/src/lib.rs diff --git a/toyos-mixer/src/mix.rs b/userland/soundserver/mixer/src/mix.rs similarity index 100% rename from toyos-mixer/src/mix.rs rename to userland/soundserver/mixer/src/mix.rs diff --git a/toyos-mixer/src/shape.rs b/userland/soundserver/mixer/src/shape.rs similarity index 100% rename from toyos-mixer/src/shape.rs rename to userland/soundserver/mixer/src/shape.rs diff --git a/toyos-mixer/src/stats.rs b/userland/soundserver/mixer/src/stats.rs similarity index 100% rename from toyos-mixer/src/stats.rs rename to userland/soundserver/mixer/src/stats.rs diff --git a/userland/soundserver/src/main.rs b/userland/soundserver/src/main.rs index 77fa90e654f..b7bbed339ac 100644 --- a/userland/soundserver/src/main.rs +++ b/userland/soundserver/src/main.rs @@ -1,15 +1,15 @@ //! The audio server: what it claims, what it spawns, and nothing else. //! -//! **Every decision soundserver makes about a sample lives in `toyos-mixer/`** — +//! **Every decision soundserver makes about a sample lives in `mixer/`** — //! the i16/f32 conversions, mono and stereo, the gain and its ramp, the sum on //! the shared bus, the dither and the quantizer, the device shapes a period can //! be rendered into, the delay-locked loop, and the counters the gate reads. -//! They are pure, they are host-tested, and `toyos-mixer/fixtures/mix-corpus.txt` +//! They are pure, they are host-tested, and `mixer/fixtures/mix-corpus.txt` //! holds the answer this program used to compute inline, byte for byte. What is //! left here is the effects: devices, handles, shared memory, timers, threads //! and the log. //! -//! The split is `userland/compositor/`'s, against `toyos-desktop/`. Everything +//! The split is `userland/compositor/`'s, against its `desktop/`. Everything //! under `src/` is one half of soundserver's own machinery: //! //! | | | From e169ca7a476adabc8dd38b07f080ab905ecee5ba Mon Sep 17 00:00:00 2001 From: japabu Date: Sun, 4 Oct 2026 00:54:44 +0200 Subject: [PATCH 2/3] issues: the track "Code used by one program lives in that program" closes Its last step, step 4, landed in the previous commit, and its exit is met. No directory the file names as moved or merged exists: step 4 names none, and steps 1, 2, 3 and 5 left with their own pull requests. Step 4's count, `cargo metadata --no-deps` over every manifest `git ls-files '*Cargo.toml'` lists, run at that commit, finds 14 packages with one consumer: - 10 sit under their consumer: kernel/{dma,gicv3,pci,ps2}, toyos-blockring/transport, toyos-net-shard/testnet, userland/{compositor/desktop,netstack/mdns,soundserver/mixer}, and tests/toyos-rust-tests/tls-multi-crate/dep. - toyos-net-shard is the testnet's, the pair the step counts as one. - diskserver, inspect and terminal are programs the images ship, each its own consumer. The rule it carried has its home already: `.claude/agents/reviewer.md`'s Fit line states the layout, as the track itself said. No file cites the slug. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WcU2Dsw6mDYtwYfzVHPzM8 --- ...ed-by-one-program-lives-in-that-program.md | 44 ------------------- 1 file changed, 44 deletions(-) delete mode 100644 issues/build/code-used-by-one-program-lives-in-that-program.md diff --git a/issues/build/code-used-by-one-program-lives-in-that-program.md b/issues/build/code-used-by-one-program-lives-in-that-program.md deleted file mode 100644 index 47e665cccca..00000000000 --- a/issues/build/code-used-by-one-program-lives-in-that-program.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -status: open -kind: track -opened: 2026-09-29 ---- - -# Code used by one program lives in that program - -A crate exists because two programs share it. What only the kernel uses is the -kernel package's, what only one userland program uses is that program's, and -shared crates with one subject are one crate (owner, 2026-09-29). No gate holds -the layout: `.claude/agents/reviewer.md`'s Fit line states it. - -An input boundary is a crate of its own, whoever uses it: the no-panic -track (`issues/kernel/a-panic-is-never-an-accident.md`) forbids its tier 1 per -crate, and a crate that holds a tier-2 stop cannot forbid the set. A crate is -one when its own source decodes a word from outside its trust, or bounds it by -its form: hardware registers, firmware tables, disk bytes, network bytes, or -what another program sent, a syscall's arguments included. A lookup of a key a -program named is neither. No step here merges one; each stays a crate under -the no-panic track. - -Every step lands green on `--ci host` and `--build-only`. Test counts are what -`cargo test -p -- --list` lists today. Step 4 lands before the -latency work (`issues/kernel/toyos-beats-linuxs-latency-on-the-t14.md`): asked -whether all five steps land in the window right after #592, the owner chose -"All five steps — The whole consolidation right after #592 lands, one step per -change, before the speed work starts" (2026-10-03). - -4. **A crate one package uses goes under it, a crate of its own.** A crate of - this tree with exactly one consumer moves under it. Its consumers are the - packages that name it as a dependency of any kind, under any `cfg`, as - `cargo metadata --no-deps` reads every manifest `git ls-files '*Cargo.toml'` - lists, excluded packages and `tests/` included; a crate the images ship as a - program of its own counts as its own consumer. Of two crates that are each - other's only consumer, the one the other names only as a dev-dependency - moves under it, and the count treats the pair as one crate. A move under a - userland program lands with `src/userlandhost.rs`'s survey gating a nested - crate's tests, which it lists as escapes today. - Check: `--ci host` runs every test each package lists today, and `--clippy` - lints them. - -**Exit:** no directory this file names as moved or merged still exists, and -step 4's count finds no crate outside its one consumer. From dec6bef217c95f09b0ecc670843bb8f7a3d726aa Mon Sep 17 00:00:00 2001 From: japabu Date: Sun, 4 Oct 2026 01:20:48 +0200 Subject: [PATCH 3/3] Answer review round 1: the nested userland crates' clippy runs come from the survey src/clippy.rs listed toyos-desktop, toyos-mdns and toyos-mixer by hand, a second declaration beside userland/Cargo.toml's members and the survey: a fourth crate moved under a program would have been tested but never linted. The runs are now derived when clippy runs, one `--manifest-path userland//Cargo.toml --all-targets` for each nested crate src/userlandhost.rs's survey gates, as ci.rs derives the tests. The moved crates' manifest headers that restated their descriptions go, and so do the soundserver header lines that were corrected rather than deleted. issues/build/userland-programs-are-never-linted.md says what is linted now, and the file-size issue's history names the paths its commits wrote. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WcU2Dsw6mDYtwYfzVHPzM8 --- .../userland-programs-are-never-linted.md | 8 +- .../design-debt/what-is-owed-on-file-size.md | 8 +- src/ci.rs | 2 +- src/clippy.rs | 97 ++++++++++--------- userland/compositor/desktop/Cargo.toml | 4 - userland/netstack/mdns/Cargo.toml | 3 - userland/soundserver/mixer/Cargo.toml | 4 - userland/soundserver/src/main.rs | 12 +-- 8 files changed, 64 insertions(+), 74 deletions(-) diff --git a/issues/build/userland-programs-are-never-linted.md b/issues/build/userland-programs-are-never-linted.md index 848e71af2b4..e9e68adddfa 100644 --- a/issues/build/userland-programs-are-never-linted.md +++ b/issues/build/userland-programs-are-never-linted.md @@ -6,9 +6,11 @@ opened: 2026-09-29 # No userland program is linted, though the gated ones build for the host -`src/clippy.rs` lints no userland crate because the `toyos` toolchain ships no -clippy. The crates `src/userlandhost.rs` gates already build for the host with -the stable toolchain, and stable's clippy lints them there. They are not clean: +`src/clippy.rs` lints each crate nested under a userland program that +`src/userlandhost.rs`'s survey gates, against the host, and no userland program. +The `toyos` toolchain ships no clippy, but the programs the survey gates already +build for the host with the stable toolchain, and stable's clippy lints them +there. They are not clean: `cargo clippy --manifest-path userland//Cargo.toml --target aarch64-apple-darwin --all-targets -- -D warnings` exits 101 with 8 findings in soundd and 10 in netd. The compositor stops on 1 finding in its dependency diff --git a/issues/design-debt/what-is-owed-on-file-size.md b/issues/design-debt/what-is-owed-on-file-size.md index 15f408388b9..c4dfc1547be 100644 --- a/issues/design-debt/what-is-owed-on-file-size.md +++ b/issues/design-debt/what-is-owed-on-file-size.md @@ -14,14 +14,16 @@ what survives it is a different question. - `elf.rs` → `toyos-elf/` (host-tested, crafted-input corpus), `e2c6a06`; the mapping half stayed as `kernel/src/elf/`, `42b29c9`. -- `compositor/main.rs` → `userland/compositor/desktop/` (pure), `763712b`; the effects shell +- `compositor/main.rs` → `toyos-desktop/` (pure, since moved to + `userland/compositor/desktop/`), `763712b`; the effects shell is `userland/compositor/` over five files with a 71-line `main.rs`, `72705d9`. - `xhci/mod.rs` → the port machine is `toyos-xhci/`, with a host simulator, `2e81ae8`. -- `soundd/main.rs` → `userland/soundserver/mixer/` (pure, `no_std`), 2026-08-20; the effects +- `soundd/main.rs` → `toyos-mixer/` (pure, `no_std`; since moved to + `userland/soundserver/mixer/`), 2026-08-20; the effects shell is `userland/soundd/` over eight files with a 261-line `main.rs`, from a 2,366-line one. What the note asked for is what it got: **the mixing is - sample-exact and proven so.** `userland/soundserver/mixer/fixtures/mix-corpus.txt` was + sample-exact and proven so.** `toyos-mixer/fixtures/mix-corpus.txt` was written by `soundd/src/main.rs` before a line of it moved, and `the_corpus_is_reproduced_bit_for_bit` holds the crate to it byte for byte. The transcript is compact because exhausted domains are digested rather than diff --git a/src/ci.rs b/src/ci.rs index 4d87bb822d0..d25e1412c23 100644 --- a/src/ci.rs +++ b/src/ci.rs @@ -571,7 +571,7 @@ fn host(root: &Path) -> Vec { Ok("installed".into()) })); steps.push(step("clippy, warnings denied", || { - let failed = crate::clippy::run(root); + let (failed, _) = crate::clippy::run(root)?; if failed.is_empty() { Ok("clean".into()) } else { diff --git a/src/clippy.rs b/src/clippy.rs index 24b15dab82f..65acca983e8 100644 --- a/src/clippy.rs +++ b/src/clippy.rs @@ -1,12 +1,9 @@ -//! Default clippy with warnings denied, over the three trees this host lints. +//! Default clippy with warnings denied. //! -//! `cargo run -- --clippy` runs [`SHAPES`] alone; `cargo run -- --ci -//! host` runs the same list as one of its steps, so the local command and -//! the merge gate cannot verify different sets. -//! -//! Userland's programs are not here: their targets are the fork's own, and the -//! fork's `toyos` toolchain ships no clippy. The kernel and the bootloader are -//! linted for every architecture. +//! `cargo run -- --clippy` runs [`SHAPES`] and [`NESTED`] alone; `cargo run -- +//! --ci host` runs the same list as one of its steps, so the local command and +//! the merge gate cannot verify different sets. The kernel and the bootloader +//! are linted for every architecture. use std::path::Path; use std::process::Command; @@ -28,8 +25,9 @@ const ADOPTED: &[&str] = &[ /// One `cargo clippy`. `dir` is relative to the repository root and empty for /// the root itself — `.cargo/config.toml` is found from the working directory, /// so the kernel and bootloader run from their own; a `$ADOPTED` token splices -/// [`ADOPTED`] there, a `$CONTROLS` token [`control_features`], and a -/// `$KERNEL_CONTROLS` token those of them whose package is `kernel`. +/// [`ADOPTED`] there, a `$CONTROLS` token [`control_features`], a +/// `$KERNEL_CONTROLS` token those of them whose package is `kernel`, and a +/// `$MANIFEST` token the manifest the run names. struct Shape { dir: &'static str, before: &'static [&'static str], @@ -188,23 +186,6 @@ const SHAPES: &[Shape] = &[ ], after: &["$ADOPTED", "-D", "warnings"], }, - // The pure crates under userland programs, against the host, as `--ci - // host` tests them. - Shape { - dir: "", - before: &[ - "--manifest-path", - "userland/Cargo.toml", - "-p", - "toyos-desktop", - "-p", - "toyos-mdns", - "-p", - "toyos-mixer", - "--all-targets", - ], - after: &["$ADOPTED", "-D", "warnings"], - }, // Its own target directory: cargo keeps one check of a unit, so a unit // linted under two sets of lints is checked again by each, every run, and // so is every crate depending on it. @@ -215,16 +196,36 @@ const SHAPES: &[Shape] = &[ }, ]; +/// Run once per crate nested under a userland program that the survey gates, +/// against the host as `--ci host` tests it. +const NESTED: Shape = Shape { + dir: "", + before: &["--manifest-path", "$MANIFEST", "--all-targets"], + after: &["$ADOPTED", "-D", "warnings"], +}; + +/// Every run: each of [`SHAPES`], then [`NESTED`] with the manifest of each +/// nested crate `src/userlandhost.rs`'s survey gates. +fn runs(root: &Path) -> Result)>, String> { + let survey = crate::userlandhost::survey(&root.join("userland"))?; + let nested = survey.gated.into_iter().filter(|c| c.contains('/')); + let nested = nested.map(|c| (&NESTED, Some(format!("userland/{c}/Cargo.toml")))); + Ok(SHAPES.iter().map(|s| (s, None)).chain(nested).collect()) +} + /// The bare targets the kernel and bootloader shapes lint against, which /// `rustup target add` installs: every architecture's. pub const BARE_TARGETS: [&str; 4] = [Arch::X86_64.kernel(), Arch::X86_64.loader(), Arch::Aarch64.kernel(), Arch::Aarch64.loader()]; impl Shape { - /// The command as a reader writes it, its tokens unexpanded. - fn line(&self) -> String { + /// The command as a reader writes it, its tokens but `$MANIFEST` unexpanded. + fn line(&self, manifest: Option<&str>) -> String { let mut parts = vec!["cargo clippy".to_string()]; - parts.extend(self.before.iter().map(|s| (*s).to_string())); + parts.extend(self.before.iter().map(|s| match *s { + "$MANIFEST" => manifest.expect("a `$MANIFEST` shape runs with a manifest").to_string(), + arg => arg.to_string(), + })); parts.push("--".to_string()); parts.extend(self.after.iter().map(|s| (*s).to_string())); parts.join(" ") @@ -232,12 +233,13 @@ impl Shape { /// The arguments to `cargo clippy`, every token spliced in — what actually /// runs. - fn args(&self) -> Vec { + fn args(&self, manifest: Option<&str>) -> Vec { let kernel = format!("{}/", crate::ci::KERNEL); let mut args: Vec = self .before .iter() .map(|s| match *s { + "$MANIFEST" => manifest.expect("a `$MANIFEST` shape runs with a manifest").to_string(), "$CONTROLS" => control_features().join(","), "$KERNEL_CONTROLS" => { let ours = control_features().into_iter().filter(|f| f.starts_with(&kernel)); @@ -262,15 +264,17 @@ impl Shape { } /// Run every shape, keeping going across them, and name the ones that found -/// warnings or failed to run. -pub fn run(root: &Path) -> Vec { +/// warnings or failed to run, out of how many ran. +pub fn run(root: &Path) -> Result<(Vec, usize), String> { + let runs = runs(root)?; let mut failed = Vec::new(); - for shape in SHAPES { + for (shape, manifest) in &runs { + let manifest = manifest.as_deref(); let scope = if shape.dir.is_empty() { "workspace root" } else { shape.dir }; - eprintln!("=== clippy: {scope} — {}", shape.line()); + eprintln!("=== clippy: {scope} — {}", shape.line(manifest)); let status = Command::new("cargo") .arg("clippy") - .args(shape.args()) + .args(shape.args(manifest)) // The loader will not compile without the key it embeds; a // throwaway one, since nothing linted here is signed. .env(crate::signing::KEY_ENV, crate::signing::key().public_hex()) @@ -279,24 +283,27 @@ pub fn run(root: &Path) -> Vec { .status() .unwrap_or_else(|e| panic!("running cargo clippy in {scope}: {e}")); if !status.success() { - failed.push(shape.line()); + failed.push(shape.line(manifest)); } } - failed + Ok((failed, runs.len())) } /// `cargo run -- --clippy`: exit non-zero if any shape reports a finding, so the /// whole set is one green/red answer. pub fn dispatch(root: &Path) { - let failed = run(root); + let (failed, ran) = run(root).unwrap_or_else(|why| { + eprintln!("clippy: {why}"); + std::process::exit(1) + }); if !failed.is_empty() { - eprintln!("clippy: {} of {} invocation(s) found warnings:", failed.len(), SHAPES.len()); + eprintln!("clippy: {} of {ran} invocation(s) found warnings:", failed.len()); for line in &failed { eprintln!(" {line}"); } std::process::exit(1); } - eprintln!("clippy: {} invocations clean", SHAPES.len()); + eprintln!("clippy: {ran} invocations clean"); } #[cfg(test)] @@ -307,10 +314,10 @@ mod tests { #[test] fn the_adopted_set_expands_into_the_shapes_that_name_it() { let workspace = &SHAPES[0]; - assert!(workspace.args().windows(2).any(|w| w == ["-W", "clippy::redundant_clone"])); + assert!(workspace.args(None).windows(2).any(|w| w == ["-W", "clippy::redundant_clone"])); let abi = SHAPES.last().unwrap(); - assert!(!abi.args().iter().any(|a| a == "clippy::redundant_clone")); - assert!(abi.args().iter().any(|a| a == "clippy::undocumented_unsafe_blocks")); - assert!(!abi.args().iter().any(|a| a == "$ADOPTED")); + assert!(!abi.args(None).iter().any(|a| a == "clippy::redundant_clone")); + assert!(abi.args(None).iter().any(|a| a == "clippy::undocumented_unsafe_blocks")); + assert!(!abi.args(None).iter().any(|a| a == "$ADOPTED")); } } diff --git a/userland/compositor/desktop/Cargo.toml b/userland/compositor/desktop/Cargo.toml index b7e2dba5d4c..d585100d3ee 100644 --- a/userland/compositor/desktop/Cargo.toml +++ b/userland/compositor/desktop/Cargo.toml @@ -1,7 +1,3 @@ -# Everything the desktop *decides* — where a window is, what changed, what the pointer hit, who has the -# focus, what a key means — is a pure function of state, and a QEMU boot is a -# poor way to ask any of them. - [package] name = "toyos-desktop" description = "Every decision the compositor makes, pure." diff --git a/userland/netstack/mdns/Cargo.toml b/userland/netstack/mdns/Cargo.toml index 695a05b1039..d0fe3777b83 100644 --- a/userland/netstack/mdns/Cargo.toml +++ b/userland/netstack/mdns/Cargo.toml @@ -1,6 +1,3 @@ -# What lives here is the wire form of one machine answering for its own name — -# pure, so every byte of a reply is checked without a network. - [package] name = "toyos-mdns" description = "Multicast DNS (RFC 6762) for one machine's own .local name." diff --git a/userland/soundserver/mixer/Cargo.toml b/userland/soundserver/mixer/Cargo.toml index 696611fef78..5c295fe316a 100644 --- a/userland/soundserver/mixer/Cargo.toml +++ b/userland/soundserver/mixer/Cargo.toml @@ -1,7 +1,3 @@ -# What lives here is every decision soundserver makes about *samples* — decode, -# channel conversion, gain, the sum on the shared bus, dither and quantize — and -# the arithmetic those rest on. -# # No dependencies, deliberately. `toyos-abi` is not one either: nothing here # names a syscall, a handle or a shared-memory layout — a period arrives as a # `&[u8]` and leaves as a `&mut [i16]`, and both belong to the caller. diff --git a/userland/soundserver/src/main.rs b/userland/soundserver/src/main.rs index b7bbed339ac..d73ebebdbc3 100644 --- a/userland/soundserver/src/main.rs +++ b/userland/soundserver/src/main.rs @@ -1,16 +1,6 @@ //! The audio server: what it claims, what it spawns, and nothing else. //! -//! **Every decision soundserver makes about a sample lives in `mixer/`** — -//! the i16/f32 conversions, mono and stereo, the gain and its ramp, the sum on -//! the shared bus, the dither and the quantizer, the device shapes a period can -//! be rendered into, the delay-locked loop, and the counters the gate reads. -//! They are pure, they are host-tested, and `mixer/fixtures/mix-corpus.txt` -//! holds the answer this program used to compute inline, byte for byte. What is -//! left here is the effects: devices, handles, shared memory, timers, threads -//! and the log. -//! -//! The split is `userland/compositor/`'s, against its `desktop/`. Everything -//! under `src/` is one half of soundserver's own machinery: +//! Everything under `src/` is soundserver's own machinery: //! //! | | | //! |---|---|