Build and test
Describes Orbit 0.1.9 ·What changed ·Markdown
This page is for contributors building Orbit from source and deciding which checks to run before pushing. It describes the scripts as they are written in scripts/ and .github/workflows/ci.yml as of Orbit 0.1.8. CI is the authority: nothing merges without its full run, so local checks are sized to catch the common failures fast, not to repeat CI.
Toolchain
Section titled “Toolchain”| Tool | Version / source | Used for |
|---|---|---|
| Rust | The version pinned in rust-toolchain.toml, with rustfmt and clippy |
Everything. The pin keeps -D warnings reproducible; bumping it is a deliberate PR that fixes whatever new lints find. |
| Edition | 2024 (Cargo.toml) |
|
| pnpm | The version CI sets up in .github/workflows/ci.yml (corepack enable, then corepack prepare pnpm@<version> --activate) |
Owner page only. |
| Node | The version CI uses, in .github/workflows/ci.yml |
Owner page tests and build. |
Foundry anvil |
on PATH or ~/.foundry/bin |
Fork tests and the onboarding harness. |
| Python 3 | scripts/state-dir-isolation.sh, the onboarding harness. |
The makinaX dependency
Section titled “The makinaX dependency”The makinaX library and the makinaX MCP server library are git dependencies owned by Makina, pinned to one release tag in Cargo.toml; Cargo.lock records the tag and the commit it resolved to, so --locked refuses a moved tag. They are not public: building from source needs read access to them. Locally, cargo fetches over HTTPS through your git credential helper when you set:
export CARGO_NET_GIT_FETCH_WITH_CLI=trueInside Orbit the server library is imported as makinax_mcp_server (the dependency key renames it). The transpiler is a public git dependency pinned by commit.
Building
Section titled “Building”| Variant | Command | Produces |
|---|---|---|
Read-write (default feature write) |
cargo build --release |
orbit-mcp, orbit-watchdog |
| Read-only | cargo build --release --no-default-features |
orbit-mcp only (orbit-watchdog has required-features = ["write"]) |
In the read-only build signing, Tenderly simulation, the owner HTTP server dependencies and the write tools are compiled out, not runtime-gated. scripts/assert-readonly.sh [binary] proves it on the bytes: with no argument it builds the read-only binary into its own target dir (target/readonly-assert, or $READONLY_ASSERT_TARGET_DIR), checks that --version says [read-only], and fails if any write-only marker string (for example WRITE-PIPELINE, the KMS endpoints, signer construction failed) is present.
--version reports variant, version and commit. build.rs stamps the short git SHA, with -dirty for an unclean tree.
Feature sets for tests and clippy
Section titled “Feature sets for tests and clippy”acceptance-fixtures is a test-only feature (it lets a loopback fixture curator grant paid packages). Never use --all-features. Use:
cargo test --features "$(scripts/test-features.sh)"scripts/test-features.sh prints every feature except default and acceptance-fixtures (today: write). It fails closed if Cargo.toml declares a feature it neither includes nor excludes, so a new feature cannot drop out of CI by omission. scripts/assert-no-acceptance-fixtures.sh <binary>… checks a shipped binary does not carry that feature’s marker.
Do not set RUSTFLAGS locally
Section titled “Do not set RUSTFLAGS locally”RUSTFLAGS is part of cargo’s fingerprint. Alternating RUSTFLAGS="-D warnings" runs with plain ones builds two full graphs that cargo never garbage-collects. -D warnings runs in CI on a clean runner; locally, scripts/gates.sh passes it as a clippy argument instead, which does not fork the cache. If a target dir has bloated, cargo clean.
The owner page
Section titled “The owner page”The owner page is a React app in src/owner/web/. Its built single-file bundle, src/owner/web/dist/index.html, is committed and embedded with include_str! in src/owner/page.rs, so cargo build needs no Node.
After any change under src/owner/web/:
scripts/build-owner-page.sh # pnpm install --frozen-lockfile, then pnpm buildgit add src/owner/web/distCI’s owner-page job runs pnpm test (vitest), pnpm exec tsc --noEmit (vitest does not typecheck), pnpm build, then fails if git diff shows src/owner/web/dist changed: a stale committed bundle is a red build.
For design work, scripts/design-dev.sh mock [fg|start|stop|status] serves the real app against a mock API on http://127.0.0.1:5273/.
Local gates: scripts/gates.sh
Section titled “Local gates: scripts/gates.sh”Levels are ordered by cost. Every level starts with cargo fmt --all --check.
| Level | Adds |
|---|---|
cheap |
skills_guard test. Seconds. |
(none) = quick |
skills_guard; cargo check --lib (test features); cargo check --no-default-features --lib --tests; cargo test --lib; scripts/state-dir-isolation.sh; clippy with -D warnings on both feature sets (--all-targets). |
all |
cargo check --all-targets on both feature sets with warnings scanned from output (CI’s -D warnings without forking the cache); cargo test --all --locked; cargo test -p orbit-mcp --all-targets --no-default-features. Roughly 20 to 25 minutes. |
strict |
check all targets; clippy on both sets; both full test runs; scripts/assert-readonly.sh. Roughly 50 minutes; “everything CI runs” for the Rust side. |
Redirect output to a file rather than piping into tail, which buffers until exit.
Why both feature sets even at quick: read-only-only breakage (a write-gated helper referenced from ungated code or an ungated test) is the most common CI red, and it shows up in seconds here.
State-dir isolation
Section titled “State-dir isolation”scripts/state-dir-isolation.sh builds the lib test binary with your normal HOME (so the cargo cache is reused), then runs that binary with HOME pointed at an empty scratch directory. It fails if the suite created $HOME/.orbit: a test resolved a path through the process-global settings::state_dir() instead of its own Settings::state_dir(). It runs the binary rather than cargo test, because moving HOME moves CARGO_HOME and forces a cold rebuild. A sentinel directory proves the scratch HOME was the one the tests saw.
Test layout
Section titled “Test layout”| Location | What |
|---|---|
src/** #[cfg(test)] modules and *_tests.rs files |
Unit tests, run by cargo test --lib. |
tests/*.rs |
Integration tests, one binary each: guards (see Guards and wording), tool surface, owner endpoint, replay fixtures, e2e_* scenarios. |
tests/e2e_quick_setup/ |
Multi-file quick-setup scenario (driver, executor, mandate, proposer, slow_chain, transfer, upgraded, walled). |
tests/support/ |
Shared helpers for source-scanning guards (production_scan.rs, rust_regions.rs, dep_sources.rs). |
tests/fixtures/ |
Rootfiles, signed manifests, fixture curator, CCTP and Hyperliquid replay data, golden onboarding batch, redaction cases. |
Write-only tests
Section titled “Write-only tests”A test that needs the write build carries #![cfg(feature = "write")] and is also listed in Cargo.toml as a [[test]] with required-features = ["write"]. The cfg alone still leaves an empty binary for the read-only --all-targets run to link; required-features skips the target entirely. Keep the two in lockstep when you add one.
Fork tests
Section titled “Fork tests”Tests that spawn anvil forks or call real services are #[ignore] with a reason string, so the default suite stays offline. Run them explicitly:
cargo test --test e2e_fork_execution -- --ignoredCommon inputs:
| Variable | Used by |
|---|---|
ORBIT_E2E_RPC_MAINNET, ORBIT_E2E_RPC_BASE |
Fork source RPCs for e2e_* tests (some fall back to a public endpoint). |
ORBIT_E2E_INTEGRATIONS_DIR |
Staged integrations checkout for e2e_onboarding. Stage it with scripts/stage-integrations.sh [dir] (default .e2e-integrations), which checks out Makina’s public integrations repository at the pinned ref. |
CI’s findings-suite job runs a named set of ignored fork tests with Foundry installed (for example fork_lifecycle, one_shot_teardown, owner_change, selected e2e_fork_execution cases, and e2e_quick_setup slow_chain).
CI jobs
Section titled “CI jobs”.github/workflows/ci.yml runs on every PR: docs-lint, owner-page, test-readwrite (includes the state-dir isolation step), fmt-clippy, test-readonly, payload-gate, assert-readonly-binary (also checks release binaries name no private repository and lack acceptance-fixtures), helper-code-guard, contract-integrity (manifest schema body matches its pin), skill-surface (both variants), and findings-suite. Release and nightly workflows are covered in Changelog and release.
Local onboarding harness
Section titled “Local onboarding harness”docs/onboarding-local.md describes a disposable browser session that walks the real setup wizard against a local anvil fork:
pnpm -C src/owner/web buildcargo build --bin orbit-mcppython3 scripts/onboarding-local.pyIt needs Python 3 and anvil (--binary and --anvil take explicit paths; the binary defaults to target/debug/orbit-mcp). Each run creates a fresh config, state directory, encrypted operator and guardian keys and an empty package catalog, then starts owner-serve with the embedded production UI plus a visible local-fork banner. It prints the browser link, a localhost RPC and a session.json evidence path.
What it isolates: the upstream gateway allows only read methods; Orbit’s RPC config contains only the local anvil; the Safe transaction service points at a disabled local endpoint; the child environment carries no inherited wallet or RPC credentials. Use a disposable owner account, never a personal wallet.
Useful options:
| Option | Effect |
|---|---|
--chain |
Default base; also mainnet, optimism, hyperevm, robinhood. |
--fork-block N |
Repeat a pinned snapshot. ORBIT_TEST_FORK_RPC supplies an archive endpoint if the public one cannot serve it. |
--rpc-budget |
Cap on upstream reads (default in scripts/onboarding-local.py). |
--attach-session PATH |
Clone a session’s state and reuse its running anvil. |
--additional-session PATH |
Allow a second local fork for the add-a-chain flow. |
--mock-safe-service |
Simulate Safe indexing and proposer registration, labelled as simulated. |
--local-curator URL, --local-billing |
Real payment negotiation against a separately running loopback test curator. |
Test endpoints on the printed origin (bearer token from the session): /__test/fund, /__test/fail-rail, /__test/restart-backend, /__test/info. scripts/onboarding-local-control.py <session.json> <action> wraps the fault and restart actions (fail-rail, restore-rail, fail-catalog, restore-actions, restart-backend) without putting the token in arguments. scripts/onboarding-local-check.py <session.json> compares CLI and owner-page answers for the current stage and checks the RPC config stayed local, writing checks.json.
The harness does not prove Safe service indexing, WalletConnect, production curator billing, live broadcasts or HyperCore settlement.
Other scripts
Section titled “Other scripts”| Script | Purpose |
|---|---|
scripts/release-smoke.sh <binary> |
Proves a built binary runs: --version plus an audit_package call over stdio JSON-RPC. |
scripts/install-smoke.sh |
Installs a formula pointing at a local tarball and checks the documented first commands. |
scripts/prerelease-corridor.sh |
Pre-release walk on an anvil Base fork with isolated HOME, XDG_CONFIG_HOME and ORBIT_STATE_DIR: free deployment, signed packages, local compose, generated owner batch, root adoption. |
scripts/acceptance-fixtures.sh <dir> [port] |
Mints a per-run acceptance catalog for an acceptance-fixtures build against local forks only. |
scripts/resign-fixtures.sh |
Re-signs the fixture curator in tests/fixtures/curator/ from the published catalog with a fresh test key. |
scripts/mutation-red-runs.sh |
Reverts specific fixes one at a time and demands the owning test goes red, then green again. |
scripts/makinax-on-main.sh |
Points the makinaX pins at main on a temporary copy, for the nightly build. |
scripts/private-dep-remap.sh |
Prints rustc flags that keep the private dependency’s checkout path out of release binaries. |
scripts/stage-base-anvil.sh, scripts/stage-stock-anvil.sh |
Stage the pinned anvil binaries into a release package. |