Skip to content

docs(#32): runnable examples for the primitive→event walk-through#70

Merged
joeldsouzax merged 1 commit into
mainfrom
docs/32-runnable-examples
Jul 3, 2026
Merged

docs(#32): runnable examples for the primitive→event walk-through#70
joeldsouzax merged 1 commit into
mainfrom
docs/32-runnable-examples

Conversation

@joeldsouzax

Copy link
Copy Markdown
Contributor

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 Result from main and asserting its invariants (no unwrap/expect), ordered as a layered walk-through up the module stack:

Example Teaches required-features
encode_primitive qb64 encode ↔ decode round-trip of a Matter; the derivation code makes a primitive self-describing stream
keypair_sign_verify generate Ed25519 → sign → verify; tampered message rejected crypto, stream
parse_stream build a count-code framed CESR stream → parse into typed signature groups stream
incept_aid incept a KERI AID; self-addressing prefix equals the event SAID, verified on deserialize serder
multisig_threshold_icp multi-key inception with simple (M-of-N) and weighted Tholder thresholds serder

Each is wired into Cargo.toml with required-features (same pattern as concurrent_parse) and linked from a new README Examples section. Because nix flake check compiles 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:

Deferred

The key_event_log (icp→ixn→rot chain) and delegated_inception examples are deferred until #68 lands — building them today would require a fabricated Basic prefix unrelated to the inception, which would teach an incorrect KEL.

Verification

nix flake check fully 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

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>
@joeldsouzax joeldsouzax enabled auto-merge (squash) July 3, 2026 16:59
@codspeed-hq

codspeed-hq Bot commented Jul 3, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 21 untouched benchmarks


Comparing docs/32-runnable-examples (1993dea) with main (7b5dab6)

Open in CodSpeed

@joeldsouzax joeldsouzax merged commit 74a3755 into main Jul 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant