The console reads a line, runs it to the end, and prints the result, with and without a terminal. Notifications print while a command runs. Ctrl-C during a command stops only the wait. 314 lines (was 480). All host integration tests are modules of cli/tests/host/, so they run in one parallel pool, and the probes build once. Warm, the 184 host tests take 24 s (was about 45 s as seven binaries in sequence), and cargo test --workspace takes 45 s.
2.4 KiB
2.4 KiB
Working on Sausage
Sausage is meant to be read and changed by agents, including its own agent. Keep it that way.
Priorities
- Correct. Every behavior in
PROTOCOL.mdhas a test incli/tests/host/. - Simple and short. Prefer the obvious code. No abstraction for one caller. No configuration that nobody asked for.
- Readable. A new reader must understand a file without the others. Each module starts with a doc comment that says what it owns.
- Efficient on the paths that run per call.
- Raw and minimal. Sausage has no permissions, sandboxing beyond WASI, limits, or authentication. Do not add them to the core. Add nothing to the host that a plugin (or the agent, by changing itself) could do.
Layout
cli/: the host (sausagebinary and library): the core, the nativecargoplugin, the WASI test runner, and the console.vfs/:sausage-vfs, the virtual filesystem for WASI guests. It knows nothing about Sausage.interface/:sausage-interface: OpenRPC documents, the compatibility check, and the generator of client code.sdk/:sausage-plugin, the SDK for Rust plugins, andsdk/macros/, its macros. Never published:cargopointssausage-plugin = "0.1"at its local copy.agent/: the agent plugin.sausage initembeds and builds it.examples/: small plugins. They are not workspace members.PROTOCOL.md: the contract between the core and the plugins. Change it in the same commit as the behavior.DECISIONS.mdsays why; when the two disagree,PROTOCOL.mdand the code win.
Checks
nix flake check -L # all tests below; CI runs this on every push
nix develop -c cargo test --workspace # fast with a warm cache: run it during development
nix develop -c cargo test -p sausage --test host -- core:: # one topic of the host tests
nix develop -c cargo build --release -p agent --target wasm32-wasip2
nix develop -c cargo clippy --workspace
nix run -- init and nix run -- run must keep working without other
setup.
Tests must stay fast:
- Only a few tests may wait for a timing (grace periods, deadlines).
- Poll for a condition with a deadline. Do not sleep.
- Do not test unrealistic load, such as many fast cycles.
#[ignore]only disables a test for a short time, with the reason in the attribute.- Tests that build plugins use the persistent cache in
env!("CARGO_TARGET_TMPDIR").