Persistent store with Git semantics: lazy reads, delayed writes, content-addressing
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

irmin/test/cram: add proof_cli.t for the proof subcommand group

Covers the two sub-subcommands introduced when cmd_proof was split
(cmd_proof_produce / cmd_proof_verify): produce a proof for a present
and a missing key, verify the happy path in both cases, and assert
the JSON output shape. Hashes are scrubbed with sed so the transcript
is stable; the field names and Fmt.pr column alignment ([Root: ],
[Key: ], [After: ]) are left intact on purpose — they are part of
the CLI's visible contract.

The existing proof.t exercises the low-level Atp.Mst proof format via
the mst_proof helper driver; this new test covers the CLI surface.

+54
+54
test/cram/proof_cli.t/run.t
··· 1 + irmin proof - produce and verify Merkle proofs from the CLI 2 + 3 + The [proof] group has two subcommands: 4 + - [produce -k KEY ENTRIES...] emits a sparse proof for reading KEY 5 + from a flat Merkle tree built from ENTRIES (format KEY=VALUE). 6 + - [verify -k KEY ENTRIES...] runs the same produce + verify round-trip 7 + and prints whether the proof checks out. 8 + 9 + Both accept [-o json] for machine-readable output. 10 + 11 + Produce a proof (human output). Hashes are scrubbed but the field 12 + names / spacing must be exactly what the CLI emits: 13 + 14 + $ irmin proof produce -k post/1 post/1=hello post/2=world \ 15 + > | sed -E 's/[0-9a-f]{16}/HASH/g' 16 + Root: HASH 17 + Key: post/1 18 + Value: hello 19 + Before: HASH 20 + After: HASH 21 + 22 + Produce a proof for a missing key: the value becomes [<not found>] 23 + and the rest of the frame is unchanged: 24 + 25 + $ irmin proof produce -k ghost post/1=hello \ 26 + > | sed -E 's/[0-9a-f]{16}/HASH/g' 27 + Root: HASH 28 + Key: ghost 29 + Value: <not found> 30 + Before: HASH 31 + After: HASH 32 + 33 + Verify a proof: happy path prints "Verified" and the value. 34 + 35 + $ irmin proof verify -k post/1 post/1=hello post/2=world 36 + ✓ Verified: hello 37 + 38 + Verify for a missing key: still Verified, with [<none>] for the value. 39 + 40 + $ irmin proof verify -k ghost post/1=hello 41 + ✓ Verified: <none> 42 + 43 + JSON output of [produce] is a single line with root/key/value/before/ 44 + after fields. Only the hex fields are scrubbed: 45 + 46 + $ irmin proof produce -o json -k post/1 post/1=hello post/2=world \ 47 + > | sed -E 's/"(root|before|after)":"[0-9a-f]+"/"\1":"HASH"/g' 48 + {"root":"HASH","key":"post/1","value":"hello","before":"HASH","after":"HASH"} 49 + 50 + JSON output of [verify] (no hex; contains only the verified flag and 51 + value): 52 + 53 + $ irmin proof verify -o json -k post/1 post/1=hello 54 + {"verified":true,"value":"hello"}