Skip to content

feat: algebraic minter (AMP/LSP mementos) + provekit mint CLI#547

Merged
TSavo merged 1 commit into
mainfrom
ts-algebraic-minter
May 10, 2026
Merged

feat: algebraic minter (AMP/LSP mementos) + provekit mint CLI#547
TSavo merged 1 commit into
mainfrom
ts-algebraic-minter

Conversation

@TSavo
Copy link
Copy Markdown
Owner

@TSavo TSavo commented May 10, 2026

Summary

New provekit-mint-amp crate plus provekit mint CLI subcommands that mint the seven AMP/LSP memento kinds into the catalog: AlgorithmMemento, BindingMemento, SortMemento, EquationMemento, EffectSignatureMemento, LanguageSignatureMemento, LanguageMorphismMemento.

  • CIDs via provekit-canonicalizer (BLAKE3-512 of JCS canonical bytes).
  • Ed25519 signing: foundation v0 key via --signer PATH, or --unsigned dev mode which refuses to write to non-test catalog roots.
  • Catalog write per AMP §3 / LSP §3 layout; refuses to overwrite an existing CID.
  • Internal CID-reference resolution (a LanguageSignatureMemento can cite SortMemento/AlgorithmMemento/EquationMemento CIDs, or paths the minter resolves recursively).
  • Mementos minted with discharge_status: "pending"; discharge (homomorphism/refinement obligations) is a separate step using the existing prove portfolio.

5 integration tests (round-trip read by CID, deterministic CID across orderings, CID-collision refused, signature round-trips, unsigned refuses production path), fixtures, README. cargo build, cargo test -p provekit-mint-amp (5 pass), cargo clippy -p provekit-mint-amp -- -D warnings all clean locally. Companion specs: AMP/LSP (already on main via #544).

Test plan

  • cargo test -p provekit-mint-amp green
  • cargo clippy -p provekit-mint-amp -- -D warnings clean
  • provekit mint sort --spec <fixture> --unsigned --catalog /tmp/c prints <cid>\t<path> and round-trips

🤖 Generated with Claude Code

…nt CLI

Mints AlgorithmMemento, BindingMemento, SortMemento, EquationMemento,
EffectSignatureMemento, LanguageSignatureMemento, LanguageMorphismMemento
per AMP/LSP. Content-addressed CIDs via provekit-canonicalizer, Ed25519
signing (foundation v0, or --unsigned dev mode that refuses production
catalog paths), catalog write per AMP §3 / LSP §3. Discharge is a separate
step. 5 integration tests, fixtures, README.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 10, 2026 03:59
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 10, 2026

Warning

Rate limit exceeded

@TSavo has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 57 minutes and 27 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 00ba422a-789d-4337-bb29-be6df4db40e9

📥 Commits

Reviewing files that changed from the base of the PR and between 26b0c05 and a9cd56a.

⛔ Files ignored due to path filters (1)
  • implementations/rust/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (25)
  • implementations/rust/Cargo.toml
  • implementations/rust/provekit-cli/Cargo.toml
  • implementations/rust/provekit-cli/src/cmd_mint.rs
  • implementations/rust/provekit-mint-amp/Cargo.toml
  • implementations/rust/provekit-mint-amp/README.md
  • implementations/rust/provekit-mint-amp/src/catalog.rs
  • implementations/rust/provekit-mint-amp/src/lib.rs
  • implementations/rust/provekit-mint-amp/src/signer.rs
  • implementations/rust/provekit-mint-amp/src/spec.rs
  • implementations/rust/provekit-mint-amp/tests/cid_collision_refused.rs
  • implementations/rust/provekit-mint-amp/tests/common.rs
  • implementations/rust/provekit-mint-amp/tests/fixtures/algorithm_branch_on_nonzero.spec.json
  • implementations/rust/provekit-mint-amp/tests/fixtures/binding_c_branch_on_nonzero.spec.json
  • implementations/rust/provekit-mint-amp/tests/fixtures/binding_python_branch_on_nonzero.spec.json
  • implementations/rust/provekit-mint-amp/tests/fixtures/effect_signature_c_control.spec.json
  • implementations/rust/provekit-mint-amp/tests/fixtures/equation_c_branch_identity.spec.json
  • implementations/rust/provekit-mint-amp/tests/fixtures/language_signature_c_c11.spec.json
  • implementations/rust/provekit-mint-amp/tests/fixtures/language_signature_llvm_ir.spec.json
  • implementations/rust/provekit-mint-amp/tests/fixtures/morphism_c_to_llvm_ir.spec.json
  • implementations/rust/provekit-mint-amp/tests/fixtures/sort_c_bool.spec.json
  • implementations/rust/provekit-mint-amp/tests/fixtures/sort_c_int.spec.json
  • implementations/rust/provekit-mint-amp/tests/mint_then_read_round_trips.rs
  • implementations/rust/provekit-mint-amp/tests/same_spec_yields_same_cid.rs
  • implementations/rust/provekit-mint-amp/tests/signature_roundtrips.rs
  • implementations/rust/provekit-mint-amp/tests/unsigned_refuses_production_path.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ts-algebraic-minter

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 and usage tips.

@TSavo TSavo merged commit b632f8e into main May 10, 2026
8 of 10 checks passed
Copy link
Copy Markdown

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

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: a9cd56afc3

ℹ️ 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".

"reference `{s}` is neither a CID nor an existing spec path"
)));
}
mint_spec_path(&path, signer, catalog, expected)
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 Detect cyclic spec references before recursive minting

When a reference value is a path, this code always recurses into mint_spec_path without tracking an in-progress stack, so a self-reference or mutual reference cycle (for example two specs that point to each other via algorithm/input_cids) will recurse until stack overflow/abort instead of producing a validation error. This can hard-crash provekit mint on malformed input and block catalog generation.

Useful? React with 👍 / 👎.

Comment on lines +184 to +186
if existing.get("cid").and_then(Value::as_str) == Some(cid)
&& existing.get("memento") == Some(payload)
{
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 Reject reused envelopes with mismatched signatures

The reuse path accepts an existing envelope whenever cid and memento match, but it does not validate the stored signature. If a file’s signature is tampered or corrupted while payload stays the same, reminting reports success and keeps the bad signature in place, leaving a catalog entry that later signature checks will fail to verify.

Useful? React with 👍 / 👎.

Comment on lines +665 to +667
if libprovekit::canonical::is_blake3_512_cid(s) {
return Ok(s.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.

P2 Badge Enforce expected memento kind for CID references

This early return accepts any syntactically valid CID before consulting the expected kind, so typed fields like formal_sorts/operations can silently ingest CIDs of the wrong memento type when passed directly as CIDs instead of paths. That produces structurally invalid cross-references in minted payloads that only fail downstream.

Useful? React with 👍 / 👎.

@TSavo TSavo review requested due to automatic review settings May 10, 2026 04:23
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