1099. machine_statistics_contract: what an outside maintainer would fix before it leaves
(The number is provisional; the recording lane assigns it.)
Raised by a read-only review of crates/machine_statistics_contract as a stranger to this tree
would meet it. The review read the crate's two tracked files, every caller in the tree, the naming
rules, the crate template and the sibling contract crates, and ran the standalone check and a local
dry run of the move. It changes nothing; it lists what the next lanes change.
The review package is notes/crate-reviews/machine-statistics-contract.md,
with its row in notes/crate-reviews.md. The review reopened no earlier ruling. The crate name,
the identity constants VERSION and INTERFACE_ID (milestone 956 (the linked interfaces carry
checkable versions)) and the fixed address stand. The fixed address follows the rule that an address
is _VIRTUAL_ADDRESS in every location. Every public name now carries a Name: block that reads
ratified.
Reuse: the template partsfoundry/crate-workflows and its helpers, script/crate-move --dry-run,
script/crate-standalone, helpers/name_release.py, Kani, Miri, cargo-llvm-cov, and
block_roster_contract's verification module and falsifications/ directory as the pattern.
No new tool.
Finding status
- P0-1, names and the ratification table: Done, #3801. The 2026-11-19 (UTC) ruling ratified the table. The names ship, and every public name carries a ratified block.
- P0-2, manifest, license files and README: Done, #3801.
address_space_layoutis a pinned git dependency already; the move changescurrent_cpu_contractto one and addsrepository. - P0-3, citations of this tree: Done, #3566.
- P1-4, saturating totals: Done, #3566.
- P1-5,
counterlifetime and read-only contract: Done, #3566. - P1-6, line count owned by this crate: Done, #3582.
- P1-7, three Kani harnesses: Done, #3566.
- P1-8, host tests over an aligned frame: Done, #3566. Miri over the same tests ran on the package branch; the package records the result.
- P1-9, header and line namespaces: Done, #3801. The header indices live in
word::headerand the per-cpu offsets inword::line. - P1-10,
online_cpustype and the word core: Done, #3566 and #3801.online_cpusstaysusize, and the prose says "cpu". - P1-11, documentation defects: Done, #3566.
- P2-12, dry run against the standalone check: Done, #3839.
The dry run reports the manifest findings with the standalone check's own function, inlines the
inherited keys before it builds, and reports the scaffold's citations and
nifelines after the crate's own, under their own step names. - P2-13, end-to-end test note: Done, #3801. The README says the test lives with the kernel.
- P2-14, unconditional
no_std: Done, #3566. - P2-15,
Snapshotsize: Done, #3566. - Decision 1, identity with the line count inside it: Done, #3582, ruled 2026-11-14 (UTC), option A.
Open decisions
Ratified: the names of item 1's table (ruled)
Ruled 2026-11-19 (UTC), option A. The table stands as the maintainer set it: PAGE_CONTENT_BYTES,
PAGE_VIRTUAL_ADDRESS, the parameters page_va and va as virtual_address, PAGE_WORDS,
word::LINE_WORDS and atomic_word for counter. Snapshot stays, and the lane rewords the module sentence. Every other name stays as written, and no alias carries an old spelling. The names ship, and each public name's Name: block reads ratified 2026-11-19 (UTC).
Clear the review package and approve the repository (ruled)
Ruled 2026-11-20 (UTC), option A: the package is cleared and the clearance creates the repository,
nifeos/machine_statistics_contract, with publish = false. No tag and no publish.
Background. A crate leaves this tree for its own nifeos repository only when the architect
clears its review package; that clearance is the approval to create the repository. A package
lists every public item with its signature for the architect's reading.
The package shows the
names as they ship. The kernel, the spawn service and three programs share
the contract, so it meets the bar for leaving.
Recommendation: A. The package shows the names as they ship, so one reading covers the clearance.
- A. Clear the package; the clearance creates the repository.
- B. Clear on this outside review alone, without a package.
- C. Keep the crate in nife for now and revisit when a second repository needs it.
Door: one-way. Creating a public repository and moving the crate there are outward steps that other pins then follow.
Prior art. Rust moved libc and compiler-builtins out of rust-lang/rust into their own
repositories once their interfaces had settled, each with its own review. Fuchsia's SDK moves a
library into the published SDK only after an API review. nife differs in asking for the review
before the first publish rather than before an SDK release. Concrete example:
the architect cleared block_roster_contract on 2026-11-09 (UTC), and it moved to its own
repository.
Blocks: the move.
Goal
A stranger who finds machine_statistics_contract in its own repository can tell in one screen what the page is and who writes it. The stranger can build and test it from the README alone. The stranger can read its one unsafe reader with a safety contract that matches the signature. The stranger can trust that every accessor is a total function over any page that carries the magic. The repository's gates are green on the day the crate arrives for the crate's own reasons. Nife's own build keeps working the day it leaves.
How the review checked
The tools run, the sources read and what was not run are in the appendix.
Prior art
The comparison with nearby work is in the appendix.
The items
Effort: S is half a day for a lane, M is a day or two, L is longer. Doors are one-way or two-way as
milestone 1073 (counter_frequency_contract)
defines them.
P0: blocks the move or the first green run
-
Thirty-four public names have no
Name:block, and the standalone check refuses the crate at step 0. Finding:python3 helpers/name_release.py --draft machine_statistics_contractprints one ratified row (the crate), two provisional rows (VERSION,INTERFACE_ID) and thirty-one rows reading "no block".script/crate-standalonefails first on this. The move commit strips every block, so each name must readratifiedbefore it. The review's flags for that table are in "Decisions for the architect". Evidence:script/crate-standaloneoutput, "34 name(s) in the crate not ratified";crates/machine_statistics_contract/src/lib.rsthroughout. Change: one pull request whose body carries the draft table, with the pre-ruled renames applied (PAGE_CONTENT_BYTES,PAGE_VIRTUAL_ADDRESS), the parameterspage_vaandvarenamedvirtual_address(the spelled-out rule covers parameters), and the review's flags beside the names they concern. Items 9 and 10 add names; the same pull request carries them so the table is ratified once. Door: two-way before the first tag; the maintainer decides the names, provisionally, under "The ratification table of item 1", and the ratification is the architect's by rule. Effort: S for the lane. -
The manifest and the files a stranger needs. Finding:
license.workspace = trueand[lints] workspace = truecome from the workspace; there is norust-version,description,readme,keywordsorcategories; no README,LICENSE-MITorLICENSE-APACHE; and thepublish = falsecomment citescrates/publish-allowlist.txt, a file the new repository will not hold. The dry run's build fails atcargo generate-lockfileon the inheritedlicense. The two dependencies are path dependencies oncurrent_cpu_contractandaddress_space_layout, which leave at step 3 of milestone 1017 (the contract crates leave in this order). This crate is at step 6, so the order already holds. The move manifest pins both byrevon theirnifeosrepositories, which the standing approval for own-crate dependencies covers. Evidence:crates/machine_statistics_contract/Cargo.tomllines 5, 6, 13 to 18;script/crate-standaloneoutput, nine manifest and file failures; the dry run'sbuildline. Change: write the manifest inblock_roster_contract's shape (rust-version = "1.88", the literal license, the literal lint tables, a one-sentencedescription,readme,keywordsandcategories). Add the two license texts. Write the README from the scaffold'sREADME-crate.md(sections: summary,EXAMPLES,What is proven,Building and testing,BUGS,Minimum Rust version,License). Replace thepublishcomment with one sentence a stranger can act on, in the shape thegenerational_tablereview settled; the line itself stays under the publishing hold. Door: two-way. Effort: S. -
The source cites this tree in places a stranger cannot follow. Finding: the module documentation and the doc comments name milestone 126 (the
procpspackage, nowprocess-tools: who else is running, and who is allowed to ask) and milestone 956. They also name milestone 326 (nobody has been assigned to turn a mutation score upward), decision 225, "AGENTS.md rule 7",notes/machine-statistics.md, pull requests 1360 and 2852, two lane names and the architect. Alsosrc/lib.rsline 16 says "nife does not page out". The manifest comment does the same.script/crate-standalonecounts two section citation lines, six milestone citation lines, three architect's-name lines and three path lines; the externalization lint counts onenifehit. TheName:block on the module is the only one the move strips; theRatifiedsentence onPAGE_VA(line 76) and the ruling sentence onVERSION(line 35) are prose, not blocks, and survive the rewrite. Evidence:crates/machine_statistics_contract/src/lib.rslines 1 to 2, 7, 9, 16, 19 to 21, 33 to 39, 44 to 47, 69 to 76, 94 to 98, 351, 365 to 369;Cargo.tomllines 8 to 11. Change: rewrite each sentence in the contract's own terms. The module documentation says what the page is, who writes it and why the words are not consistent, and that a writer and a reader agree by linking this crate. The BUGS section states only what the contract cannot express (item 11 has the list). The design note's reasoning that a stranger needs (why relaxed, why one writer per word, why no sequence counter) moves into the crate's documentation in its own words; the rest stays in nife. Door: two-way. Effort: S.
P2: later
The P2 items are in the appendix.
P1: before the tag
The P1 items are in the appendix.
Follow-on
- Milestone 1017. The move, at step 6, after
current_cpu_contractleaves;address_space_layouthas its own repository and this crate pins it byrev. With every finding Done, the milestone counts as built; the architect cleared the review package and approvednifeos/machine_statistics_contract.
Decisions for the architect
Decision 1 below is the one one-way door, and it carries its ruling. The table of item 1 follows it with the review's flags and the names ratified on 2026-11-19 (UTC). Everything else above is two-way and the maintainer decides it.
Decision 1: Freeze the contract's identity before it leaves, with the line count inside it
Ruling of 2026-11-14 (UTC), option A. The rule in force: the identity stays as built. MAGIC is
MACHSTA1, VERSION is 1, INTERFACE_ID is 4, and PAGE_VIRTUAL_ADDRESS is the fixed pair page. The page
holds one header line of eight words plus one eight-word line per processor, 576 bytes, and header
words 6 and 7 stay reserved and read zero. The processor-line count belongs to this crate as its
own constant, PROCESSOR_LINES, and replaces the re-export of
current_cpu_contract::CPU_ID_BOUND. A compile-time assertion keeps it equal to that bound, so a
change to the bound fails this crate's build until this page's magic and version move too.
The background, the recommendation as reviewed, prior art, a concrete example and the alternative are in the appendix.
The ratification table of item 1, with the review's flags
The architect ratifies thirty-four names in one pass. Where the review has something a stranger might misread, it says so here; the lane carries these beside the rows.
PAGE_BYTESandPAGE_VA: pre-ruled renames toPAGE_CONTENT_BYTESandPAGE_VIRTUAL_ADDRESS; the parameterspage_vaandvafollow asvirtual_address.Snapshot: the module documentation says the words "are not a consistent snapshot of each other" and the type carries the nameSnapshot. The review recommends keeping the name, because the type is one copy taken once, and rewording the sentence to say a reader loads the words one at a time and are not consistent with each other.WORDSandLINE: generic words under the naming rules;PAGE_WORDSandLINE_WORDSsay what they count (item 9).word::ONLINEthroughword::RUNNABLE: offsets, not indices, and the module does not say so in the name (item 9).counter: returns the atomic word for a writer;word_atoratomic_wordwould say that it is the word and not a count.Cpu,cpus,online_cpus: consistent with the vocabulary rule; the prose around them says "core" (item 10).build_header,from_words,read,total_bytes,free_bytes,busy_ticks,idle_ticks,context_switches,interrupts,runnable,MAGIC,VERSION,INTERFACE_ID,FRAME_BYTES,TICK_HERTZ,TOTAL_FRAMES,FREE_FRAMES,BUSY_TICKS,IDLE_TICKS,CONTEXT_SWITCHES,INTERRUPTS,RUNNABLE,cpu: units spelled out, std spellings where std has one, no flag.
Ratified 2026-11-19 (UTC). The names the table carries into item 1's pull request are these.
PAGE_CONTENT_BYTES and PAGE_VIRTUAL_ADDRESS, with the parameters page_va and va as
virtual_address. PAGE_WORDS and word::LINE_WORDS. Snapshot stays, and a lane rewords the module
sentence. counter becomes atomic_word. The rest stay as written. There is no alias of the
old spellings.
Done when
The checks are in the appendix. The finding status above says, item by item, what has landed and what each open item still needs.
BUGS
cargo +1.88 clippy --all-targets -- -D warningsis red inaddress_space_layout(an unusedLOW_HALF_SPLIT_SHIFTS), which this crate links. In the crate's own repository a git dependency is not linted, so this does not block here; it isaddress_space_layout's finding, for that crate's review. The same build prints a future-incompatibility notice foraddress_space_layout, which the review did not chase.- Items 5 and 14 came from reading, not from a build for a narrow target or with the unconditional attribute.
- The mutation census was not re-run; the carried row reads 33 mutants, none missed. Item 4's saturating fold adds mutants the next census will judge.
- The review did not run nife's QEMU system tests; the review read the kernel's writer and did not exercise it.
Index row
An outside review of machine_statistics_contract before it leaves this tree. Three items block the move: thirty-four names without a Name: block, a manifest and file set the standalone check refuses, and citations of this tree throughout the source. Eight land before the first tag. Three concern the code: totals that overflow on a page the reader accepted, a 'static reference under a weaker contract, and a layout whose line count another crate owns. Three concern the proofs and tests: no Kani harness, two unsafe functions no host test reaches, and one namespace for indices and offsets. The last two are a type-width inconsistency and six documentation defects. Four follow later. The one one-way door, freezing the identity set with the line count inside it, has its ruling of 2026-11-14 (UTC).
The 2026-11-19 (UTC) ruling ratified the names, and the 2026-11-20 (UTC) ruling cleared the review package.