1106. program_argument_contract: what an outside maintainer would fix before it leaves
Raised by a read-only review of crates/program_argument_contract as a stranger to this tree would
meet it, in a fresh shallow clone of nifeos/nife at the head of main and a clone of
partsfoundry/crate-workflows at the head of its main. It changes nothing; it lists what the next
lanes change before the crate moves to a repository of its own (milestone 1017 (the contract crates
leave in this order), step 5).
The crate has no review package in notes/crate-reviews/ and no row in notes/crate-reviews.md.
The settled baseline this review takes instead has three parts. The first is the layout proposal, milestone 672 (the argument page's layout). The second is the interface table of milestone 956 (the linked interfaces carry checkable versions), which gives the crate INTERFACE_ID 18. The third is milestone 1017's order, step 5. Milestone 672 is NOT-STARTED. The crate's name is ratified in its own Name: block and is not reopened. Every
other public name in the crate is provisional by the crate's own manifest, and this block proposes
the ones the template's gates refuse.
Reuse: the template partsfoundry/crate-workflows and its scaffold, its name helpers
(spelled_out.py, standalone.py, unsafe_scan.py), Kani, cargo-mutants, and the sibling page
contracts (environment_contract, counter_frequency_contract) as the shapes to match. No new
tool.
Goal
A stranger who finds program_argument_contract in its own repository can tell in one screen what
the page is for. It is one read-only 4 KiB page that carries a program's argv as length-prefixed
bytes, written by whoever spawns the program and read by its runtime. The stranger can build, test and
prove it from the README alone, on the host and for the three bare-metal targets. Every gate the
template requires is green for the crate's own reasons, and nothing in the crate names a path, a
section number, a milestone or a person in another repository.
Finding status
- P0-1, the manifest does not stand alone: Done, #3808.
The move added
repository. - P0-2, the repository files: Done. The README and both license texts came from the crate (#3808), and the move added the scaffold's other files. The stranger run is the maintainer's.
- P0-3, text that reaches into nife: Done, #3808. The
crate's text has no section, milestone or path, and no architect's name or quotation. The move
strips the
Name:blocks. - P0-4, seven names the spelled-out gate refuses: Done,
#3808, ratified 2026-11-21 (UTC; see "Three public
names" below). The crate and the
stdoverlay carry the new names. The overlay'sargs()is the standard library's own name and stays. - P1-5,
CAPACITYcarries no unit: Done, #3808. Ratified 2026-11-21 (UTC). - P1-6, no proof: Done, #3567 and #3978. The round-trip harness fixes the lengths at three and two bytes, which keeps the page inside the solver's memory.
- P1-7, the
unsafereader has no test: Done, #3567. - P1-8, the mutation exemption and the coverage figure: Done at the move,
#4007. The new repository's
.github/mutants-exemptslists the one survivor, an equivalent<against<=in the header check. The tests reach every line and 98 percent of regions. - P1-9, the all-or-nothing claim: Done, #3567.
- P2-10, the address truncates on narrow targets: Done,
#3978 (maintainer, provisional, 2026-11-22 UTC). The
# Safetysection offrom_virtual_addressrequires the address to fit the target'susize, the review's second alternative; a panic would add a failure path to an unchecked reader. - P2-11,
EMPTYunused and its literal duplicated: Done, #3567. - P2-12, the builder takes a fixed array: Done, #3808.
PageBuilder::newtakes&mut [u8]and refuses any length butPAGE_BYTESwithWrongPageLength. - P2-13, the layout arithmetic copied in
grant_plan: Done, #3808.grant_plansums withrecord_bytes.impl IntoIteratorstays out: thestdport copies this file and would demand stability attributes. - P2-14, the data bounds the record walk: Done, #3567.
- P2-15, the one-file constraint: Done, #3567.
- Ruling, the layout leaves as built, with a numbered magic: Done,
#3579 and
#3982 (ruled 2026-11-22 UTC):
PROGARG2,VERSION2. - Ruling, three public names: Done, #3808 and #3978, with P0-4 and P1-5.
- Ruling, the remaining names: Done, #3885.
- The move: Done as a pin, #4007.
partsfoundry/program_argument_contract exists with
proofsgreen on its first run, and nife depends on it at commit 764e0e55a238252391b1c06135e228ef6b9436c8 (version = "0.1.0",publish = false). No tag and no publish; a pre-release tag moves the pin later.
Open decisions
None.
What was checked, and how
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: XS is under an hour for a lane, S is half a day, M is a day or two. A door is one-way when
somebody outside the repository acts on it after the move or the release (a published name, a wire
format, an identity value, a layout, a dependency). Everything else is two-way and the maintainer
decides it. Line numbers are in crates/program_argument_contract/src/lib.rs unless a path says
otherwise.
P0: blocks the move
-
The manifest does not stand alone. Finding:
license.workspace = trueandlints.workspace = trueinherit tables from nife's workspace, which the new repository does not have. There is norust-version, nodescription, norepositoryand noreadme.publish = falsecarries a comment that sends the reader tocrates/publish-allowlist.txt, a file that stays in nife. The manifest's comment block cites a milestone and a decision section by number and calls the name provisional, while the crate root'sName:block calls it ratified. Evidence:crates/program_argument_contract/Cargo.tomllines 5 to 18;standalone.pyreports the license, lints, rust-version and publish findings. Change: writelicense = "MIT OR Apache-2.0"and a[lints.rust]table carryingunsafe_op_in_unsafe_fn,missing_docsandunexpected_cfgsnamingcfg(kani), as the template'sstandalonejob requires. Addrust-version(the siblingcounter_frequency_contractstates 1.88; verify it builds there before stating it),description,repositoryandreadme. Keeppublish = falsewith one sentence a stranger can act on, since a standing ruling holds publishing for every moved crate until its own release milestone. Delete the citation comment, since the move commit strips provenance. Door: two-way. Effort: XS. -
The repository files the template requires are absent. Finding: the crate has no
README.md, noLICENSE-MIT, noLICENSE-APACHE, noCHANGELOG.md, no_typos.toml, nodocs/stranger-test.mdand nofalsifications/directory.check / standalonefails on a missing README, a README withoutEXAMPLESandBUGSheadings, a missing license text or a missing typos configuration, andrelease / gaterefuses while the stranger record readsnone. Evidence: the crate directory holdsCargo.tomlandsrc/lib.rsonly;standalone.pyreports the README and both license files; the template'sscaffold/andscaffold/README-crate.md. Change: copyscaffold/and write the README to the scaffold's section order. Start with one line of purpose. Then addEXAMPLES(the builder-and-parser example fromPageBuilder's documentation, as compiling code) and "What is proven" (item 6's harnesses, or an honest "none yet" until they land). Then add "Building and testing" with the threerustup target addlines,BUGS(items 9, 10 and 14's facts), the minimum Rust version and the license section. Record a stranger run before the first tag. Door: two-way. Effort: S. -
The crate's text reaches back into nife. Finding:
src/lib.rsnamesnotes/foreign-program-arguments.md(line 20) anddesign/roadmap/0672-the-argument-page-layout.md(line 38). It cites decision sections: §170 (how a foreign program is told what to do) at lines 2 and 7, and §111 (inert configuration is a read-only page, and each declared key is validated against a closed domain) at line 31. It also cites milestones (205, 326, 956) by number. It carries fourName:provenance blocks (lines 35, 59, 68, and the manifest's line 13), and the block at line 35 names the architect and quotes the question asked. The template's rules say a crate carries noName:block, andstandalone.pyfails on each class: 5 section citation lines, 4 milestone citation lines, 4 provenance block lines, 3 path lines and 1 architect's name line. Evidence: lines 1 to 38, 59, 68, 358;crates/program_argument_contract/Cargo.tomllines 8 to 13; the template README's "What each nife gate became" table, row "name provenance blocks". Change: rewrite the crate root documentation to state the layout, the all-or-nothing rule and the reason the bytes carry no authority in the crate's own words, with no section or milestone number and no path. Move the measurement note's conclusions a stranger needs (why length-prefixed, whyargv[0]is present, why one page) into that text. Strip everyName:block in the move commit, as the standing rule for extracted crates has it. Drop the architect's name and the quotation. Where the crate must point at nife (thestdport copies this file), say "the nife repository" without a path. Door: two-way. Effort: S. -
Seven names fail the template's spelled-out gate, at a ceiling of 0. Finding:
ArgPage(line 148), the parameterargofpush(line 119),from_vaand its parameterva(line 195), the bindingarginIter::next(line 234), and the test helper'sargs(lines 258 and 370). In nife the two public ones sit indesign/naming-rule-baseline.txt(lines 148 and 150), a baseline the template does not carry.vaalso breaks the address rule (an address is_VIRTUAL_ADDRESSorvirtual_addressin every location) and the page-contract family rule, which names the parametervirtual_address. Evidence:spelled_out.pyoutput;design/naming.md, "Acronyms and abbreviations", "Registers and constants" and "Crates";design/naming/crates.md, "Page contract crates". Change:ArgumentPage,push(argument),from_virtual_address(virtual_address), andargumentandargumentsfor the bindings. The public two are names, so the architect ratifies them in the crate's name review before the move (the rulings below); the lane renames the bindings and the test helper without a ruling. Thestdoverlay'ssys/args/nife.rsand its generator follow the rename, since the file arrives verbatim. Door: the two public names are one-way once released and two-way today; the bindings are two-way. Effort: S, counting the overlay.
P1: before the first tag
-
CAPACITYcarries no unit. Finding: the constant is the number of record bytes one page holds (4,080). The naming rule says a length or a limit carries its unit.grant_planspells the unit for it in prose ("4,080 bytes") because the name does not. Evidence: line 49;design/naming/crates.md, "Page contract crates";crates/grant_plan/src/refusal.rsline 187. Change:MAXIMUM_RECORDS_BYTES, as the rulings name it, withCAPACITYgone (no alias for a nife spelling before the first release).grant_planfollows in the same pull request. Door: a public name, one-way once released; two-way today. Provisional, see the rulings. Effort: XS. -
The crate has no proof, and the template's front page promises one. Finding: no
#[kani::proof]and nofalsifications/. Three sibling contract crates (block_roster_contract,entropy_contract,socket_contract) carry harnesses. The scaffold's README states that every property the crate claims is a harness with a falsification patch; for this crate that sentence would be false.proofs / kanipasses with no harness, so nothing fails; the claim does. Evidence: no match forkaniinsrc/lib.rs;scaffold/README-crate.mdlines 8 to 10. Change: three harnesses, each with a falsification patch thatproofs / falsifyreplays red. First, over a short symbolic page (40 to 64 bytes;parsetakes any length),parsenever panics anditer()yields exactlylen()items, withis_empty()agreeing: verified feasible here in 37 seconds. Second, over the same page, the all-or-nothing property as the parser states it: a page that parses walkscountrecords whose lengths sum tototalexactly, sorestis empty, and any other page isEMPTY. Third, a round trip of two short symbolic arguments through the builder and the parser; this needs item 12 or a stub, because the fixed 4,096-byte page exhausted 12 GiB here. State the harness names and their run time in the README's "What is proven". Door: two-way. Effort: M. -
The one
unsafefunction has no test. Finding:from_va(lines 195 to 198) has one caller, thestdoverlay, which no host test reaches. The siblingenvironment_contracttests its reader throughConfigPage::new(page.as_ptr() as u64)in a documentation test. Here nothing exercises the raw-pointer path, so Miri in the weekly job would have nothing to check. Evidence: line 195; theenvironment_contractpackage'ssrc/lib.rslines 199 and 324. Change: one test that builds a page and reads it back throughfrom_virtual_address(page.as_ptr() as u64), asserting the same argv the slice parser gives; a second that reads a zeroed frame the same way and getsEMPTY. Door: two-way. Effort: XS. -
The mutation survivor needs its exemption, and nobody has measured the coverage floor. Finding: the census records one missed mutant,
ArgPage::checkreplacing<with<=at line 170, classified equivalent: a 16-byte page with the magic, count 0 and total 0 is an empty argv, and refusing it also yieldsEMPTY. The template'smutation / mutationfails on one survivor unless.github/mutants-exemptslists it with its reason, andcheck / mutation-diffjudges the changed lines of every pull request. The coverage job's floor is 85 per file; the lines no test reaches today arefrom_va(item 7) andEMPTY(item 11), which the review did not measure against the floor. Evidence:notes/project-metrics/mutation-survivor-classes.csvline 187; the template README's mutation row. Change: an exempts entry carrying the equivalence argument above; runcargo llvm-covonce after items 7 and 11 land and record the figure in the pull request. Door: two-way. Effort: XS. -
The all-or-nothing claim says more than the layout can keep. Finding: the crate root says a count that disagrees with the records answers an empty argv. That holds for a change to one field: the test flips one byte at a time and truncates. It does not hold for a header whose
countandtotalboth describe a prefix of the records: the parser walks exactlycountrecords, findsrestempty, and answers that prefix. There is no checksum, so the layout cannot tell a shorter line from a consistently shortened one. The page has one writer and maps read-only, so this is a property of the format under corruption, not an attack surface, and it belongs in the README'sBUGS. Evidence: lines 22 to 27 and 182 to 186; the test at lines 324 to 345 changes one byte at a time. Change: say "no single-field damage yields a partial argv" and record the two-field case inBUGS. A checksum would be a wire-format change; this block does not recommend one (the layout ruling says why). Door: two-way for the text; a checksum would be one-way and is not proposed. Effort: XS.
P2: later
The P2 items are in the appendix.
Rulings
Only the one-way doors went to the architect. Everything else above is the maintainer's.
The layout leaves as built, with a numbered magic
Ruled by the architect, 2026-11-14 (UTC), and for the magic and version on 2026-11-22 (UTC). The
argument page leaves nife with milestone 672's layout and INTERFACE_ID 18. Its magic is
PROGARG2 and its VERSION is 2: the magic is the page's name and the version's digit, and a new
magic is a new version, as the format-values check requires. There is no checksum (item 9) and the
length prefix stays four bytes.
Three public names
Ruled by the architect, 2026-11-21 (UTC), ratifying the maintainer's provisional names as built.
ArgumentPageforArgPage, matching the sibling page types.from_virtual_address(virtual_address)forfrom_va(va).MAXIMUM_RECORDS_BYTESforCAPACITY. The 4,080 bytes count each argument's four-byte prefix, so they are bytes of records, asrecord_bytessays.PAGE_CONTENT_BYTESis not used: in the contract family it is the number of bytes the page content occupies, header included (seecrates/base_digest_contract/src/lib.rs).
The crate, the std overlay and grant_plan use the new names.
The remaining names
Ruled by the architect, 2026-11-21 (UTC): the crate's other public names stand as built, except
that PageBuilder::count becomes argument_count (the standard library's count consumes an
iterator) and Refused becomes PushRefused (the name says what it refuses).
The repository
Ruled by the architect, 2026-11-14 (UTC), who cleared the review. A lane creates the repository
partsfoundry/program_argument_contract after the three renames above and milestone 994 (the pair is tested where the pin is) land.
It takes the tag v0.1.0-pre.1 after the move check and a release dry run, with publish = false.
Follow-on
- Done. Two milestones meet the layout ruling's condition (maintainer's reading, provisional, 2026-11-19 UTC): 1115 (the gate builds basalt's delivered programs from the candidate tree) in every merge group, and 994 in basalt.
- Done. The numbered magic, #3982.
- Recorded. The repository (ruled 2026-11-14 UTC): a lane creates
partsfoundry/program_argument_contract, runs the move check and a dry run, and tagsv0.1.0-pre.1with no publish, after the renames and milestone 994.
Done when
The checks are in the appendix.
BUGS
- The round-trip harness covers one pair of lengths, three bytes and two. With symbolic lengths over the exact-page builder the solver ran past 11 GiB.
- The mutation figures are the weekly census's, read from the metrics files. This review ran no census.
- Items 1 to 15 can land in nife before the move, and most should, since each is cheaper inside one repository.
- The prior-art rows for Linux, WASI, Hubris and Tock are from memory and unverified against source in this review; the four marked "from source" rest on the nife note on foreign program arguments.
Index row
An outside review of program_argument_contract before it leaves. Four items block the move (a
manifest and a repository that do not stand alone, text that reaches back into nife, and seven names
the template's gate refuses). Five land before the first tag (the content-length name, three Kani
harnesses, a test for the one unsafe function, the mutation exemption, and an honest statement of
what all-or-nothing covers), and six come later. This block records four rulings:
the layout leaves as built with the magic numbered later, three public names, the remaining names, and the repository.