This directory is a runnable Rust provider example for Observer.
Read ../HOWTO.md first if you want the full model, especially the determinism gate and the provider host contract.
It is intended to show the whole real process, not just the Rust authoring helpers in isolation:
- write ordinary Rust code under test
- author tests with
describe!(...),test!(...), andexpect(...) - compile a provider host with Cargo
- inspect the raw provider
listoutput - derive canonical inventory with
observer derive-inventory - run a suite against that inventory
- verify canonical hashes and JSONL output
Contents:
src/lib.rs: tiny Rust code under testsrc/bin/ledger-observer-host.rs: Observer-authored tests plus the host entrypointobserver.toml: provider resolution configtests.obs: simple-surface Observer suiteMakefile: end-to-end commandstests.inv: derived inventory snapshotexpected.inventory.sha256: expected canonical inventory hashexpected.suite.sha256: expected canonical suite hashexpected.default.jsonl: expected canonical report snapshot
Suggested reading order:
- read
src/lib.rs - read
src/bin/ledger-observer-host.rs - run
make list - run
make inventory - inspect
tests.inv - run
make run - run
make verify - compare this directory with
../starter-failure/
Key idea:
- the Rust tests are authored in Rust
- the provider host exposes them through the standard Observer provider protocol
- Observer derives inventory from that host output
- the suite runs against canonical inventory, not against ad hoc Cargo conventions
One detail is intentional and worth noticing:
- the suite uses one
prefix:selector plus two exact-name selectors - that means
make runexecutes four cases even though the provider exports three tests - the overlap is there on purpose so users can see both selector styles in one tiny example
Useful commands:
make list
make inventory
make host-run TARGET='ledger/rejects-overdraft'
make run
make report
make verifyThe starter uses explicit stable ids for every exported test:
ledger/applies-ordered-postingsledger/rejects-overdraftformat/renders-balance-line
That is deliberate.
It keeps the end-to-end inventory and suite contract mechanically obvious.