Skip to content

feat(cli): expose detached standing receipt v0 - #168

Merged
noctem-o merged 2 commits into
mainfrom
feat/standing-receipt-cli-v0
Oct 5, 2026
Merged

noctem-o merged 2 commits into
mainfrom
feat/standing-receipt-cli-v0

Conversation

@noctem-o

@noctem-o noctem-o commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Base: fbde58b65e5d0a5d7bf1476867d96d74bb25863a
Candidate: 74eeaf02deca80a3ebf4efdad488f312aeef2f1e

Implements thin CLI transport for detached-standing-receipt-v0, using merged/reviewed #167.

magpie standing-receipt <claim-id> --history <path> --verifying-key <64-lowercase-hex> --profile magpie-standing-receipt-history-v2-v0 --policy magpie-claims-standing-v2 --expectation none
magpie check-standing-receipt <claim-id> [same explicit options] --receipt <path>

For exact or contains-checkpoint, both --checkpoint-event-count <u64> and --checkpoint-sha256 <64-lowercase-hex> are mandatory; none forbids them.

Changed only crates/magpie-cli/{src/args.rs,src/commands.rs,src/lib.rs,src/receipt.rs,tests/cli.rs}.

Complete library key preflight precedes file acquisition. History is acquired once, unchanged; profile, policy, external key, expectation and selector are explicit. Detached bytes cannot select checking coordinates. Dispatch bypasses Store/Snapshot/config/saved checkpoints and ambient state; --store is rejected. No filesystem writes.

Both successes emit only the library's canonical_bytes(), without newline; --json is inert. Diagnostics stay on stderr. Exits: 0 success, 1 refusal, 2 usage, 3 operational. Output-device failure can leave partial stdout.

Ten new binary tests plus one error-mapping unit test cover exact CLI/library bytes, checking/newline mutations, expectations/suffix/truncation, malformed histories/selectors, ambient-state isolation, file inventories, closed argument shapes, acquisition/output failures and raw CRLF bytes.

Passed with Rust 1.98.1: fmt, workspace check, Clippy (-D warnings), workspace tests (1,090 passed; one existing ignored), CLI tests (60), receipt tests, frozen fixture, both 432-case corpus paths, golden tests, corpus manifest and 43 A-018 witnesses.

No library semantics, dependencies, format, identifiers, writers, MCP or integration changes. Endophasia, other repositories and user-local experiments/computer are untouched.

Fresh candidate CI and Codex review pending. Additional checks passed: Python corpus (432), release inventories, log package, log doctests and governed-standing tour.

Draft; independent Codex review required before owner merge.

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c7757217-bf5b-4fde-9659-8bb66a5f59da
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

noctem-o commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a88fa33ead

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +27 to +29
let history_bytes = std::fs::read(&input.history)?;
let history = StandingReceiptHistoryIdentityV0::of(&history_bytes)
.map_err(|error| CliError::Io(error.to_string()))?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preflight the complete key before reading history

With a lexically valid but structurally inadmissible key (for example 0200…0000), lower_hex accepts the argument and this read happens before produce_standing_receipt_v0 reaches the complete external-key gate. Consequently, a missing history returns exit 3 instead of the required ExternalKey refusal, while a large readable history is unnecessarily acquired and hashed. This violates the frozen first-failure order in docs/design/detached-standing-receipt-v0.md:76-81 and bypasses the purpose of prepare_portable_history_v0, whose API explicitly preflights the key before history acquisition; perform that complete preflight before std::fs::read.

Useful? React with 👍 / 👎.

noctem-o commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 74eeaf02de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@noctem-o
noctem-o marked this pull request as ready for review October 5, 2026 19:49
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@noctem-o
noctem-o merged commit 50c5497 into main Oct 5, 2026
2 of 3 checks passed
@noctem-o
noctem-o deleted the feat/standing-receipt-cli-v0 branch October 5, 2026 19:49
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