Skip to content

refactor: dissolve benches/examples crates into host crates - #740

Merged
mfw78 merged 2 commits into
mainfrom
refactor/618-dissolve-bench-crates
Aug 13, 2026
Merged

refactor: dissolve benches/examples crates into host crates#740
mfw78 merged 2 commits into
mainfrom
refactor/618-dissolve-bench-crates

Conversation

@mfw78

@mfw78 mfw78 commented Aug 13, 2026

Copy link
Copy Markdown
Member

Closes #618

Summary

Dissolved crates/benches and crates/examples into their host crates and swapped the codspeed shim for plain criterion.

Bench homing: address, bmt_bench, encryption_bench, primitives, proofs to nectar-primitives; latency_bench to nectar-file; mantaray_bench to nectar-mantaray; verify to nectar-postage; sign and upload_pipeline to nectar-postage-issuer. Example homing: basic_usage and builder_patterns to nectar-primitives; dump_deployments to nectar-contracts; stamp_pipeline to nectar-postage-issuer; roam_between_machines to nectar-postage-usage. All fifteen files moved with git mv so history follows.

Feature gating uses required-features, not a self dev-dependency. A self dev-dependency (the tokio pattern) would have unified the extra feature into every build of the host package that activates dev-dependencies, silently turning the default-feature CI matrix rows into feature-on rows.

crates/benches and crates/examples are removed as workspace members; their Cargo.toml and src/lib.rs are deleted.

Testing

All commands run inside nix develop --command at 2c18d09c (branch refactor/618-dissolve-bench-crates, based on origin/main @ 1ea486b3). Toolchain: rustc 1.94.0, which equals the declared MSRV (.github/scripts/declared-msrv.sh -> 1.94), so the build below doubles as the MSRV lane's cargo check --workspace --all-targets --locked.

Workspace member count (cargo metadata --no-deps): 23 before -> 21 after. nectar-benches and nectar-examples are the two removed members.

Build and target relocation

  • cargo build --workspace --all-targets --locked: pass. Every moved bench and example builds in its new host crate.
  • cargo bench --workspace --locked --no-run: pass (default-feature benches).
  • cargo bench --locked -p nectar-postage --features parallel --no-run: pass (verify).
  • cargo bench --locked -p nectar-mantaray --features hazmat: pass (mantaray_bench).
  • All ten benches and five examples compile in their new hosts.
  • All 14 clippy rows in lint.yml pass with -D warnings.
  • cargo fmt, cargo deny check (advisories/bans/sources/licenses), and cargo-machete are clean.
  • nextest is 573/573 on the seven touched crates.
  • cargo run -p nectar-contracts --example dump_deployments emits the JSON upstream-addresses.yml consumes.
  • nostd.yml uses plain cargo check; no bench target can leak onto the bare-metal lane.

AI Assistance

Implemented by claude-opus-5. Red-teamed by claude-opus-5. PR description by claude-sonnet-5.

mfw78 added 2 commits August 13, 2026 08:07
Move every bench and example target out of the nectar-benches and
nectar-examples aggregators into the crate it exercises, and delete the
two aggregators. Swap the dormant codspeed-criterion-compat shim for
plain criterion.

Targets that need a non-default feature carry required-features, and
lint.yml gains the two feature passes that build them.
@mfw78
mfw78 merged commit b01d31e into main Aug 13, 2026
40 checks passed
@mfw78
mfw78 deleted the refactor/618-dissolve-bench-crates branch August 13, 2026 09:12
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 13, 2026
@mfw78
mfw78 restored the refactor/618-dissolve-bench-crates branch August 13, 2026 09:12
@mfw78

mfw78 commented Aug 13, 2026

Copy link
Copy Markdown
Member Author

Correction to the member count, for the record, since stage 2's gate is that the final count is written down and correct.

The brief I gave said 22 members before and 20 after. That was wrong in both directions, and the red-team caught it. The workspace declares members = ["crates/*", "crates/primitives/examples/wasm-demo"], so the member count is the number of directories under crates/ plus one: crates/primitives/examples/wasm-demo is an explicitly listed member that a directory count misses.

The true figures are 23 members before this pull request and 21 after. The directory count under crates/ did go 22 to 20, which is where my number came from, but that is not the member count.

This matters beyond bookkeeping: stage 2's exit gate in docs/PRODUCTION-PLAN.md is that cargo metadata reports the final member count and it is written down, and #713 and #716 both enumerate the tree for the release. Anything quoting 20 should quote 21.

@mfw78
mfw78 deleted the refactor/618-dissolve-bench-crates branch August 13, 2026 10:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

phase 4: dissolve the benches and examples crates; codspeed to criterion

1 participant