docs(#32): runnable examples for the primitive→event walk-through#70
Merged
Conversation
Add five self-verifying examples under examples/, each returning Result from main and asserting its invariants so they double as integration tests under `nix flake check`: - encode_primitive: qb64 encode/decode round-trip of a Matter - keypair_sign_verify: Ed25519 gen → sign → verify (+ tamper rejection) - parse_stream: build a count-code framed stream and parse typed groups - incept_aid: incept an AID; prefix == SAID, verified on deserialize - multisig_threshold_icp: multi-key inception, simple + weighted Tholder Wire each into Cargo.toml with required-features and add a README Examples section linking them. Research pass surfaced three API warts, filed separately: qb64 encode requires `stream` (#67), builders emit only Identifier::Basic so a real KEL chain isn't buildable (#68), and no indexed-signature verify (#69). The KEL gap (#68) blocks the icp→ixn→rot chain and delegated-inception examples, which are deferred until it lands. Refs #32. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a runnable
examples/set for the crate — the adoption front door, and integration tests in one. Closes the shippable portion of #32 (P2.2).Five self-verifying examples, each returning
Resultfrommainand asserting its invariants (nounwrap/expect), ordered as a layered walk-through up the module stack:required-featuresencode_primitiveMatter; the derivation code makes a primitive self-describingstreamkeypair_sign_verifycrypto,streamparse_streamstreamincept_aidserdermultisig_threshold_icpTholderthresholdsserderEach is wired into
Cargo.tomlwithrequired-features(same pattern asconcurrent_parse) and linked from a new README Examples section. Becausenix flake checkcompiles every example, the set doubles as a live tripwire against public-API regressions.Research findings — API warts filed for cleanup
The research pass predicted by #32 ("examples catch ergonomic problems") surfaced three issues, each verified from source and filed separately:
Prefixer(Matter<VerKeyCode>) and always emitIdentifier::Basic, but deserialize acceptsIdentifier::SelfAddressing. A real self-addressingicp → ixn → rotKEL is therefore not buildable through the public API (write/read parity violation).streamfeature (encode/decode live in different layers) #67 (devx) — encoding aMatterto qb64 requires thestreamfeature (matter_to_qb64lives there, notcore) and returns aParseErroron an encode path.sign_indexedyields aSiger, butverifyonly accepts aCigar; no indexed-signature verification.Deferred
The
key_event_log(icp→ixn→rot chain) anddelegated_inceptionexamples are deferred until #68 lands — building them today would require a fabricatedBasicprefix unrelated to the inception, which would teach an incorrect KEL.Verification
nix flake checkfully green: clippy, fmt, taplo, audit, deny, nextest, doctest, wasm32, no_std, fuzz-replay, typos. All five examples run to exit 0 with assertions passing.Refs #32.
🤖 Generated with Claude Code