notes

Moving a crate out of nife: the runbook

Name: provisional. The file name says what the page holds: the steps of one move.

This page takes one crate from crates/<crate> to a repository of its own, partsfoundry/<crate>, and back into nife as a pinned dependency, then through its soak to publication. Every step names its command, the result that says it worked, and who takes it. A lane is an agent working a milestone; calef marks a step only the architect takes, because it creates something, holds a credential, or publishes. Journey 5 says why crates leave and in what order, and milestone 857 (crates released on their own) holds the rulings. The pilot is jh7110_entropy of milestone 818 (proven JH7110 TRNG logic, released on its own). script/crate-move does the mechanical part of a move.

The rules every step keeps:

The dry run

script/crate-move --dry-run --into <empty dir> <crate> builds the crate repository's first tree locally and creates nothing. It copies the crate's tracked files and adds the template's scaffold, with every caller pinned at the newest template release. It deletes the Name: blocks, regenerates each falsification patch over the stripped source for -p1, sets repository in the manifest and carries the crate's mutation baseline row into .github/mutants-exempts as a comment. Then it builds and tests the copy at its rust-version, runs the template's clippy job, and runs the template's cheap checks from that release. The checks are every helper the release's check / standalone job enforces, at ceiling 0 on the staged tree. A crate that nife's helpers/template_report_baseline.txt counts as baseline therefore fails the dry run until a lane fixes its findings. The dry run reads the list from the release's check.yml; a helper without a runner here fails the run as template coverage. A clean run means a green first check / standalone, except for the shellcheck step and a missing typos, which the run reports. It ends with the nife-side follow-up: each consumer manifest's new line and every other file that names the crate. The script's header lists what it skips.

A finding is a change to make before the move. A lane fixes a finding against the crate itself, in nife: a README section or a sentence over the prose limits, a mention of nife in the crate's text. The template takes a finding against the template (see BUGS). The dry run regenerates each falsification patch, so its hunk headers carry the stripped file's line numbers, and it refuses to finish when any patch applies at an offset, with fuzz or not at all under patch -p1 --dry-run -F0. It also moves each Falsification: line to the head of its harness's comment, where the template reads it, so those records pass falsify.py --check.

Before the move, in nife

  1. The architect has ratified the names (lane). script/names <crate> prints ratified under the crate's line, and script/crate-standalone <crate> exits 0 with Kani: every harness proves on the copy and every falsification patch turns its harness red.
  2. Nothing it depends on is still here (lane). The manifest step of script/crate-standalone passes: no path dependency leaves the crate.
  3. The text stands alone (lane). script/crate-move --dry-run --into "$TMPDIR/<crate>-move" <crate> exits 0. Fix each finding in nife, through an ordinary pull request, so the move commit stays mechanical. A finding against the template goes to the template.
  4. The architect clears the crate (calef). script/crate-review-packet <crate> writes the packet; the review packages hold the current ones. The clearance is also the approval to create the repository; no standing approval covers the order.

Creating the repository

  1. Create it (calef).

    gh repo create partsfoundry/<crate> --public --description "<one line from the manifest>"
    

    Expected: gh repo view partsfoundry/<crate> --json isEmpty --jq .isEmpty prints true.

  2. Install the nife-smelter app on it (calef, as an organization owner, in the app's repository access settings). The release workflow's tag job authenticates as the app, and the tag ruleset accepts the app as its bypass actor only once the app sits on the repository.

  3. Grant the two organization secrets that have selected visibility (calef, with an admin:org token). NIFE_SMELTER_APP_ID is open to every repository and needs nothing. The list of NIFE_SMELTER_PRIVATE_KEY and SETTINGS_TOKEN grows by one per crate:

    script/grant-org-secrets <crate>
    

    The script resolves the repository id, makes both grants (granting twice changes nothing), lists each secret's repositories and exits 1 if the crate is missing. --dry-run shows what it would do. It refuses nife and any name that is not an existing repository of the organization. The fine-grained token behind SETTINGS_TOKEN has access to all repositories of the organization, so the secret's repository list is the only setting a move changes; the token needs no per-crate widening. No agent handles any key value.

The move

  1. Stage from the merged tree (lane). From main at the commit the move will cite:

    script/crate-move --dry-run --into "$TMPDIR/<crate>-move" <crate>
    

    Expected: exit 0 and <crate>: clean. The staged tree has git initialized, every file added and nothing committed. It builds each fuzz target with cargo +nightly fuzz build and runs it once over its corpus, which needs cargo-fuzz and nightly. A target moves if it links only the crate and its dependencies. The staged fuzz caller sets public-crash-inputs: true only for a crate without unsafe, the weekly fuzzing opt-in the maintainers ruled; any other crate gets false, and the run says why.

  2. Commit and push (lane). The message names the template release and nothing of nife:

    cd "$TMPDIR/<crate>-move"
    git config core.hooksPath .githooks
    git commit -m "Adopt the shared crate workflows at crate-workflows <release>" \
      -m "Co-Authored-By: <model> <noreply@anthropic.com>"
    git remote add origin git@github.com:partsfoundry/<crate>.git
    git push -u origin main
    

    Expected: git ls-remote origin refs/heads/main prints the local HEAD, and the push starts the check and proofs runs on main. The repository starts with one root commit; nothing of this tree's history travels.

  3. Apply the settings (lane, with repository administration). From a checkout of the template at the pinned release:

    script/apply-settings partsfoundry/<crate>
    script/check-settings partsfoundry/<crate>
    

    Expected: apply-settings reports nothing it could not set, and check-settings exits 0. That gives both rulesets, the crates-io environment with calef as required reviewer, the labels, the crate-maintainers team, and the fork approval policy for every outside contributor.

  4. The first runs are green (lane). End the turn with WAITING partsfoundry/<crate>:<run id>... on check and proofs. Expected: gh run list -R partsfoundry/<crate> --branch main --limit 4 shows check and proofs succeeded. A pull request in the crate repository fixes a red job, and the maintainer gates and merges it as in nife.

11a. Run the outside review (a fresh lane the maintainer launches, on the most capable model available; never the lane that wrote the crate or took part in its extraction). It runs once the repository exists and before its first tag or publish. The pass is read-only on the crate repository: no push, no pull request, no issue, no tag. It reads the crate's review package for the accepted baseline, so it does not raise a settled decision again. It covers: - public API and names, against the naming rules; - correctness and soundness; - proofs and their falsification patches, tests and mutation results; - the README and documentation, read as a stranger would; - Cargo metadata for publishing, the template pin and the workflow wiring; - the no_std posture and performance; - prior art on crates.io; - which checks need real hardware. The pass never claims one done without it.

Its output is one draft milestone in the roadmap format. Each item carries a priority: P0 blocks any publish, P1 comes before the first release, P2 can follow later. Each item gives the finding, the evidence, the change, the door (one-way or two-way) and the effort. The milestone also carries a prior-art box and acceptance criteria. The maintainer promotes it into the roadmap, and a lane addresses its items. Only the one-way doors go to an architect, one at a time, each with a recommendation.

Three safeguards apply. A lane checks every finding against the code before it acts on one, since a pass can be wrong, for example about what a CI run shows. The pass marks a claim it could not verify as unverified. It reports a possible vulnerability to the maintainer alone and leaves it out of the milestone. It never reads fuzz findings, seeds or crash inputs. Expected: the draft milestone exists and its P0 items stand closed. The combine review checks both for each crate.

The stranger test and the tag

  1. Run the stranger test (a fresh-context agent the maintainer launches, never the move lane). It clones the repository and follows the README alone to a build, the tests and the proofs; the protocol is the stranger test's. The lane records the run as a pull request in the crate repository that sets Last run: <date> in docs/stranger-test.md and adds the run's appendix beside it. Expected: release / gate stops refusing, since it refuses a record that reads none.

  2. Tag the version (calef). The tag ruleset refuses a hand-made v* tag, so the release workflow makes it:

    gh workflow run release.yml -R partsfoundry/<crate> -f version=0.1.0 -f dry-run=false
    

    The gate and the tag job run, and the publish job waits in crates-io. calef cancels the run there (gh run cancel <run id> -R partsfoundry/<crate>), so nothing publishes. Expected: gh api repos/partsfoundry/<crate>/git/ref/tags/v0.1.0 resolves, and the soak holds its first semver baseline.

The nife side

  1. Replace the path dependency (lane, one pull request in nife). Take the commit of the tag:

    rev=$(gh api repos/partsfoundry/<crate>/commits/v0.1.0 --jq .sha)
    

    In each consumer manifest the dry run listed, the line becomes

    <crate> = { version = "0.1.0", git = "https://github.com/partsfoundry/<crate>", rev = "<rev>" }
    

    keeping any other key the old line carried. Remove crates/<crate> from the workspace members and delete the directory with git rm -r crates/<crate>. The same pull request reads every other file the dry run listed. For the pilot and the FAT crate those are:

    • the script/verify table and the Kani reach list in .github/workflows/kani-reach.yml;

    • helpers/trust_boundary_crates.tsv and packages/*.package.toml;

    • the mutation baseline, the deny.toml wrappers and _typos.toml;

    • the fuzz targets, which the dry run staged in the crate repository's fuzz/ (milestone 1043 (a moved crate is fuzzed in its own repository)). The dry run's last list names each removal:

      • the [[bin]] sections of fuzz/Cargo.toml, and the crate's dependency line there when no remaining target links it;
      • fuzz/fuzz_targets/<target>.rs, and the targets' names and fixtures case in script/fuzz;
      • fuzz/seeds/<target>, the seed scripts and their paragraphs in fuzz/seeds/README.md;
      • the targets' sections of notes/fuzzing/targets.md.

      Afterwards script/fuzz --list names none of them.

    • citations into crates/<crate>/src, which repoint to the repository at the tag, by symbol.

    • nothing, for a crate the std farm copies into its platform layer (COPIED_FILES in xtask/src/farm/copied.rs, which the dry run lists because it names the package). The farm finds each package's directory through cargo metadata, so it reads the moved crate from Cargo's checkout of the pin, as long as a workspace member still depends on it; with none, cargo xtask std-src stops and names the missing package. The stamp then hashes the files as <crate>/src/... instead of crates/<crate>/src/..., so the farm rebuilds once.

    The crate's milestone block states the soak's state. Expected: cargo tree --locked -i <crate> prints the git source at rev, git grep -n 'crates/<crate>' -- '*.toml' prints nothing, cargo xtask std-src exits 0, script/lint exits 0, and the merge queue lands it.

  2. Bump basalt's pin (lane, a separate pull request in nifeos/basalt). It cites the landed commit as nifeos/nife@<sha> and names the nife pull request it waits for.

A later bump of the crate's pin is its own nife pull request, citing partsfoundry/<crate>@<sha> of a tagged commit.

The soak's five end conditions

Every crate soaks as its own repository before it publishes (ruled 2026-10-17 UTC; ยง305 (git dependencies are allowed on nifeos/* only, pinned to a landed commit)). The soak ends, with no duration, when all five conditions hold (condition 5 ruled 2026-11-26 UTC, nifeos/record#48). Condition 5 does not read weekly / semver, which succeeds whatever it finds.

condition check who
1. nife builds and passes CI against the pinned commit, with no path dependency left git grep -n 'path = .*crates/<crate>' -- '*.toml' is empty, and gh run list -R nifeos/nife --branch main --workflow ci.yml --limit 1 shows success at or after the step 14 merge lane
2. the template's weekly run is green gh run list -R partsfoundry/<crate> --workflow weekly.yml --limit 1 --json conclusion prints success; gh workflow run weekly.yml -R partsfoundry/<crate> starts one early lane
3. a release dry run is green gh workflow run release.yml -R partsfoundry/<crate> -f version=<manifest version> -f dry-run=true, then that run's gate succeeds and it creates no tag lane
4. the stranger test builds and proves the crate from its README alone grep '^Last run:' docs/stranger-test.md in the crate repository prints a date, with that run's appendix beside it step 12
5a. every consumer in nife builds against the tagged release, unpatched git grep -n '^<crate> = ' -- '*.toml' in nife, tools/ included: each rev is tag v<version>'s commit, each version that tag's; no [patch] names it lane
5b. cargo-semver-checks finds no break from that tag to main cargo semver-checks --baseline-rev v<version> --release-type minor passes a nonzero count; a pre-release without --release-type skips every check lane
5c. no open issue, milestone or BUGS entry proposes a break read the crate's open issues, gh search issues --owner nifeos --owner partsfoundry --state open <crate>, its BUGS and each unbuilt milestone naming it lane

Publication and consumption by version

Each publication waits for its soak and its turn in the ruled order, and a contract crate never publishes.

  1. Allow the publication (calef approves; a lane writes the line). The crate joins crates/publish-allowlist.txt in nife, and a pull request in the crate repository removes publish = false and allow-unpublished: true.
  2. The first-publish token (calef). crates.io binds a trusted publisher only to a crate that exists, so 0.1.0 publishes with CRATES_IO_FIRST_PUBLISH_TOKEN, a publish-new token limited to the crate's name with a short expiry, stored on the repository's crates-io environment.
  3. Publish (calef). gh workflow run release.yml -R partsfoundry/<crate> -f version=<version> -f dry-run=false, then approve the crates-io deployment. Expected: cargo search <crate> --limit 1 shows the version.
  4. Bind the owners and the trusted publisher, and delete the token (calef). cargo owner --add github:partsfoundry:crate-maintainers <crate>; on crates.io, a trusted publisher for partsfoundry/<crate>, workflow release.yml, environment crates-io; then delete the secret. Every later release publishes through trusted publishing alone.
  5. nife consumes the release (lane). Each consumer line becomes <crate> = "<version>", and a lint fails any [patch] on main. Expected: cargo tree --locked -i <crate> resolves from crates.io and Cargo.lock records the checksum. The milestone's exit holds.

What calef does, in one list

BUGS