1073. counter_frequency_contract: what an outside maintainer would fix before it leaves
Raised by a read-only review of crates/counter_frequency_contract as a stranger to this tree
would meet it. The review read the crate's five tracked files, every caller in the tree, the review
package, the naming rules and the crate template, and ran a local dry run of the move. It changes
nothing; it lists what the next lanes change.
The review took its accepted baseline from
the review package and reopens none of
the decisions it settles. Those are the crate name and the thirteen ratified names (MAGIC,
VERSION, INTERFACE_ID, PAGE_CONTENT_BYTES, PAGE_VIRTUAL_ADDRESS,
MINIMUM_PLAUSIBLE_HERTZ, MAXIMUM_PLAUSIBLE_HERTZ, is_plausible, build_page,
CounterFrequencyPage, new, hertz and the hertz and virtual_address parameters). They are
also the kept wire value TIMEBAS1, the dual license, and the three edits the package assigns to
the move lane: the README's "written for the nife kernel" sentence, the three sibling-crate
citations, and the machine and tree names in the doc comments. The package's open question on PAGE_VIRTUAL_ADDRESS existing on aarch64 stays
with the maintainer and is not reopened. Where a later rule contradicts the baseline, the item
says so; one does (item 7, the #[doc(alias)] sentence).
Reuse: the template partsfoundry/crate-workflows and its helpers, script/crate-move --dry-run,
script/crate-standalone, Kani, cargo-llvm-cov, Miri and the sibling contract crates' tests as
patterns. No new tool.
Goal
A stranger who finds counter_frequency_contract in its own repository can tell in one screen
what the page is, build and test it from the README alone, and trust every claim the documentation
makes about what is checked and by whom. The repository's gates are green on the day the crate
arrives, for the crate's own reasons, and nife's own build keeps working the day the crate leaves.
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 prior art 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 (a published name, a wire value, a layout, a fixed address, a dependency); everything else is two-way and the maintainer decides it.
P0: blocks the move or the first green run
-
nife's
stdbuild reads this crate's source by path, and loses it the day the crate leaves. Finding:xtask/src/farm/generate.rscopiescrates/counter_frequency_contract/src/lib.rsverbatim into thestdplatform layer assys/pal/nife/counterfreqproto.rs, andxtask/src/farm/stamp.rshashes the same path to decide when the farm rebuilds. Both areroot.join("crates/..."). After the move the path does not exist,cargo xtask std-srcfails, and nostdprogram builds. The crate's review package does not list this; the packages forclock_contractandentropy_contractdo, andnotes/crate-move.mdrecords it as a known gap for thirteen crates of milestone 1017 (the contract crates leave in this order). Evidence:xtask/src/farm/generate.rsline 142;xtask/src/farm/stamp.rsline 70;notes/crate-move.mdlines 295 to 301;patches/std-nife/overlay/std/src/sys/pal/nife/mod.rslines 65 to 72. Change: both files resolve each copied crate's source directory throughcargo metadata(themanifest_pathof the package the workspace depends on), so a crate pinned byrevcomes from Cargo's checkout and a crate still incrates/comes from there. One change serves every copied crate. It lands before the first of them leaves, and it is not this crate's alone. The generated copy also keeps the#[cfg(doctest)] include_str!("../README.md")item; it is harmless insidestdbecausedoctestis never set there, and a sentence in the generator's comment should say so. Door: two-way. Effort: M. Owner: a nife lane, shared with the other copied contract crates. -
The template's clippy job is red on arrival. Finding: the module documentation writes
x86_64without backticks,clippy::doc_markdowniswarnin the manifest's[lints.clippy], and the template runs clippy with-D warningson stable. Stable 1.99.1 and 1.88 both refuse the crate. The nightly this tree pins accepts it, which is why nife's own gate never saw it (nobody verified why the two differ). Evidence:crates/counter_frequency_contract/src/lib.rsline 9;Cargo.tomllines 25 to 31. Change: backticks aroundx86_64on that line, and acargo +stable clippy -- -D warningspass over the standalone copy before the move, whichscript/crate-move --dry-runshould run (BUGS). Door: two-way. Effort: XS.
P1: before the first tag
The P1 items are in the appendix.
P2: later
The P2 items are in the appendix.
Decisions for the architect
The architect froze the identity: magic TIMEBAS1, version 1, interface 9 (ruled 2026-11-11 UTC,
#3516).
Clearing the review package
Ruled 2026-11-19 (UTC): the architect clears the review of counter_frequency_contract. The
clearance approves creating partsfoundry/counter_frequency_contract and moving the crate there. The review
package is the review package. It
states the crate, its thirteen ratified names, its frozen identity (TIMEBAS1, version 1,
interface 9) and what the move changes.
The pre-release tag
Ruled 2026-11-19 (UTC): the architect approves the tag v0.1.0-pre.1, once the move lane finds that the new
repository matches this tree's copy and the release dry run is green. These are the two conditions
of the approval of 2026-11-11 (UTC) for seven cleared crates. After the move, nife pins the crate
by rev at the commit of the tag, with Cargo.toml carrying the same version. Nothing publishes:
a contract crate never publishes to crates.io, and the tag is its release.
How the page crates spell their offset constants (item 10)
Ruled 2026-11-14 (UTC) for the whole family: the byte position of a page field or region-layout
field is named <FIELD>_OFFSET_BYTES, with the field name spelled out under design/naming.md.
This crate's constants are MAGIC_OFFSET_BYTES and HERTZ_OFFSET_BYTES. A constant that counts
words says _OFFSET_WORDS. The family keeps no alias for an old spelling.
Done when
The checks are in the done-when appendix.
BUGS
script/crate-move --dry-runruns the newest template release's checks, not the template head's, and its notes say so. A gate the template adds after that release first runs in the new repository.- The dry run's three remaining findings (
.github/pull_request_template.mdline 2,CONTRIBUTING.mdline 23, and five "mentions nife" lines in.githooks/commit-msg,deny.toml,docs/stranger-test.mdandrustfmt.toml) are in the pinnedv7scaffold, not in this crate. The template head's scaffold names nife nowhere, so a move at the next template release clears them. - Item 5 came from reading, not from a build for a 32-bit target; the fix is cheap enough to land without one, and the three targets the crate names are all 64-bit.
- The kernel's writer caches the page's physical frame on first use. If the rate has not resolved
at that moment, the frame stays zeroed for the machine's lifetime, and every process reads the
rate as unknown (
timebase_page_physinkernel/src/user/loader.rs). The crate's contract does not cover when the writer runs.
Finding status
- Item 1 (P0), the
stdfarm reads the source by path: Done, #3514. - Item 2 (P0), clippy red on stable: Done, #3513.
- Item 3 (P1), BUGS in the contract's own terms: Done, #3556.
- Item 4 (P1), the band is the reader's to apply: Done, #3556.
- Item 5 (P1), pointer-width assertion: Done, #3556.
- Item 6 (P1), manifest
publishcomment: Done, #3556. - Item 7 (P1), documentation a stranger reads: Done, #3556.
- Item 8 (P1), the template's prose gates: Done, #3556.
- Item 9 (P1), two Kani harnesses with falsification patches: Done, #3556.
- Item 10 (P2), private offset constants: Done, #3571.
- Item 11 (P2), README says where the end-to-end test lives: Done, #3556.
- Item 12 (P2),
Debugprints the address: Won't fix. The address is a compile-time constant in every real use, and the change waits for the next change to the crate's public interface; maintainer's ruling, 2026-11-14 (UTC). - The frozen identity: Done, #3516.
- The mutation census after the harnesses: Done, run 43876176886: 23 mutants tested, 0 missed.
- The kernel's zeroed frame: Done, #3283.
- The move dry run's gaps: Done, #3940.
script/crate-move --dry-runruns the template'sclippyjob on stable and reports a path that leaves the crate, such as the manifest's oldpublishcomment. - The review package: Done, #3615, #3626 and #3635.
- Clearance of the review package: Done, #3773.
- The move to its own repository: Done. The crate lives at
partsfoundry/counter_frequency_contract, and nife pins it by the commit of its tag. - The stranger test: Done, partsfoundry/counter_frequency_contract#2 and partsfoundry/counter_frequency_contract#3.
- A pre-release tag: Done. The release workflow made
v0.1.0-pre.1after partsfoundry/counter_frequency_contract#4. - Publishing to crates.io: Won't fix. A contract crate never publishes, and the tag is its release; ruled 2026-11-19 (UTC), under "The pre-release tag" above.
Open decisions
None.
Follow-on
- Recorded. Item 10, the spelling of the page crates' offset constants: ruled, see the decisions above.
- Recorded. The architect cleared the review (ruled 2026-11-19 UTC), which approves creating
the repository and moving the crate. The same ruling approves the tag
v0.1.0-pre.1, after the move check and the release dry run pass. - Recorded. The move dry run runs the template's
clippyjob and reports a path that leaves the crate. - Recorded. Item 12 (
Debugprints the address) isdesign/roadmap/1073-counter-frequency-contract-outside-review/later-items.mditem 12: no change until the next API change.
Index row
An outside review of counter_frequency_contract before it leaves this tree. Items 1 to 9 and 11
have landed. They cover the std farm's source lookup, the stable clippy failure and the BUGS
entries in the contract's own terms. They also cover the band the reader applies, the pointer-width
assertion, the manifest comment and the documentation fixes. The rest are the template's prose
gates, two Kani harnesses, and a README sentence on where the end-to-end test lives. Item 10, the private offset constants, follows the family rule. The identity does not change, and
the crate lives in its own repository at the tag v0.1.0-pre.1. A contract crate never publishes.