Repository navigation
Add controlled attested Comparator evidence authority - #66
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📝 WalkthroughWalkthroughThis PR adds a receipt-bound Comparator authority pipeline with strict schemas, immutable stage and receipt storage, replay-based promotion to ChangesComparator authority
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
scripts/comparator-authority-ingest.sh (1)
118-131: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winIngest step skips the dry-run parity check used for stage and promote.
Stage (Lines 90-91) and promote (Lines 159-160) both run a
--dry-runinvocation before the real/retry pair to validate the preview path is side-effect-free and deterministic. Ingest jumps straight to the real run, so an ingestion dry-run regression (e.g. accidental writes) wouldn't be caught here.♻️ Mirror the stage/promote dry-run pattern
+"$mcl_bin" --root "$state_root" --json verify ingest-comparator-authority \ + "${ingest_args[@]}" --dry-run >"$output_dir/ingestion-dry-run.json" "$mcl_bin" --root "$state_root" --json verify ingest-comparator-authority \ "${ingest_args[@]}" >"$output_dir/ingestion.json" "$mcl_bin" --root "$state_root" --json verify ingest-comparator-authority \ "${ingest_args[@]}" >"$output_dir/ingestion-retry.json"🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/comparator-authority-ingest.sh` around lines 118 - 131, Add a dry-run invocation before the real/retry calls in the ingest step, matching the pattern used by stage and promote. Use the same ingest arguments and state root, write the preview output to the corresponding dry-run artifact, then preserve the existing real invocation and byte-identical retry comparison.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/trust/RELEASES.md`:
- Around line 75-80: Clarify the authority statement near the referenced
“evidence/2” text so it applies specifically to portable-release
publication/proof authority, while preserving the separate Comparator evidence/3
authority model introduced in this paragraph. Distinguish the two scopes
explicitly and avoid implying that evidence/2 governs Comparator authority.
In `@fixtures/comparator/authority/pilot-a-attestation.json`:
- Line 1: Replace the mojibake checkpoint marker “—” in the Rekor checkpoint
envelope within the attestation fixture with the expected em dash “—”,
preserving all other protected-bundle bytes unchanged.
In `@src/app.rs`:
- Around line 3788-3809: Remove the MCL_COMPARATOR_AUTHORITY_POLICY_CHANGED
match arm mapping to ComparatorAuthorityStaleReason::PolicyChanged in the
stale_reason match within comparator_authority_status. Preserve the existing
replay_comparator_stage policy-drift error behavior and continue propagating
unmatched errors through the default branch.
In `@src/store/mod.rs`:
- Around line 6923-6937: Strengthen the comparator read-time validation
condition around stored receipt integrity by validating receipt_byte_size with
validate_publication_input_size, matching the checks in
read_publication_ingestion_receipt. Preserve the existing equality and other
integrity comparisons, while ensuring oversized or zero receipt sizes fail
closed.
---
Nitpick comments:
In `@scripts/comparator-authority-ingest.sh`:
- Around line 118-131: Add a dry-run invocation before the real/retry calls in
the ingest step, matching the pattern used by stage and promote. Use the same
ingest arguments and state root, write the preview output to the corresponding
dry-run artifact, then preserve the existing real invocation and byte-identical
retry comparison.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a9a4ea7b-b6b4-4777-98fa-6bf15d413087
📒 Files selected for processing (30)
.github/workflows/publication.ymldocs/decisions/ADR-0016-controlled-comparator-evidence-authority.mddocs/implementation/RELEASE_CHECKLIST.mddocs/implementation/STATUS.mddocs/trust/COMPARATOR_AUTHORITY.mddocs/trust/COMPARATOR_PACKAGES.mddocs/trust/RELEASES.mdfixtures/comparator/authority/pilot-a-attestation-verification-raw.jsonfixtures/comparator/authority/pilot-a-attestation.jsonfixtures/comparator/authority/pilot-a-report.jsonmigrations/0012_comparator_authority.sqlpolicies/comparator-authority-1.jsonschemas/comparator/comparator-attestation-verification-1.schema.jsonschemas/comparator/comparator-authority-policy-1.schema.jsonschemas/comparator/comparator-authority-stage-1.schema.jsonschemas/comparator/comparator-authority-status-1.schema.jsonschemas/evidence/evidence-3.schema.jsonscripts/comparator-authority-ingest.shsrc/app.rssrc/cli/mod.rssrc/comparator_authority.rssrc/domain/comparator_authority.rssrc/domain/evidence.rssrc/domain/mod.rssrc/lib.rssrc/mcp/mod.rssrc/publication_attestation.rssrc/store/mod.rstests/mcp_stdio.rstests/phase1_cli.rs
|
Review follow-up 2ae2ac3 also adds the missing ingestion dry-run invocation before the persisted/retry pair. Bash syntax, ShellCheck 0.11.0, formatting, warnings-denied Clippy, and the full 187-lib/1-Lean/4-MCP/20-CLI Rust suite pass locally. |
|
Cross-platform follow-up 4422168 fixes the Windows-only cryptographic fixture checkout drift by marking the protected Comparator fixture set as byte-preserved Git inputs. A local core.autocrlf=true checkout reproduced both protected hashes, and exact-head CI run 30172477751 now passes all five required jobs, including Windows. |
Summary - add the closed evidence/3 Comparator authority contract while preserving evidence/1 and evidence/2 canonical behavior - stage and replay the exact run, release, plan, policy, and attestation closure through immutable CAS-backed records - verify provenance with the pinned GitHub CLI, create a non-authoritative receipt, and promote only by receipt hash - enforce the gate independently in the application, Store transaction, SQLite trigger, and read-time projection checks - expose the same closed stage, ingest, promote, and currentness actions through CLI and MCP - run the path in the separate protected Comparator job and retain a database-independent portable audit closure ## Trust boundary The accepted Comparator report, workflow result, and attestation receipt remain structurally non-authoritative. Only receipt-bound application promotion derives accepted authoritative comparator_run evidence. Comparator evidence does not create Lean proof or refutation evidence, replace fidelity review, mutate proved or disproved status, or complete Pilot C. ## Local validation - cargo fmt --all -- --check - cargo clippy --workspace --all-targets --all-features -- -D warnings - cargo test --workspace --all-targets (187 library tests, 20 CLI tests, 4 MCP tests) - opt-in real Lean 4.32 worker integration - 39 legacy Python regressions - Bash syntax and ShellCheck 0.11.0 - Actionlint 1.7.12 - git diff --check ## Risk and recovery Migration 12 is additive and authority records are immutable by design. Before protected use, the change can be reverted normally. Once a receipt-bound authority record exists, recovery is quarantine plus exact replay; no manual database rewrite is an accepted path. Issue closure remains gated on exact-head CI, the protected same-run authority playtest, and an independent downloaded-artifact audit. Refs #65 ## Summary by CodeRabbit * New Features * Added controlled Comparator authority staging, attestation ingestion, promotion, and status reporting with current/stale outcomes. * Extended CLI and MCP verify actions to manage Comparator authority evidence end-to-end. * Introduced receipt-bound authoritative Comparator evidence and portable audit bundles for promoted results. * Documentation * Added/updated trust docs, ADR coverage, release guidance, and implementation status for the controlled authority workflow. * Bug Fixes * Strengthened protected validation with strict artifact/attestation/policy checks, canonical state snapshots, and anti-symlink/path-safety safeguards. * Tests / Chores * Added new fixtures, schemas, and migration coverage; updated CLI/MCP integration test expectations. ## Change class - [x] Class 3: Release, migration, or security-sensitive Affected trust boundary: Comparator attestation, immutable receipt creation, receipt-only promotion, evidence currentness, and protected portable auditability. ## TDD evidence - [x] Acceptance criteria were defined before implementation - [x] Focused failure-path tests drove the implementation - [x] The smallest coherent implementation made them pass - [x] Refactoring preserved passing behavior - [x] Relevant unit and integration suites pass - [x] Failure paths and boundary cases are covered Red evidence: adversarial Store/SQL/CLI/MCP tests rejected forged authority; review correction of only one encoded fixture made the exact protected parser fail until both source artifacts were rest 8000 ored. Green evidence: exact fixture hashes are asserted; 187 library, 1 Lean gate, 4 MCP, and 20 CLI tests pass with warnings-denied Clippy. ## Mathematical verification - [x] Candidate output was checked independently from its generator - [x] Formal proof passes the pinned checker - [x] Assumptions and dependency pins are recorded - [x] Artifact identifiers are linked in #65 Verifier and result: the accepted protected run is replayed from exact report, package, release, attestation, and tool pins. Comparator evidence cannot create Lean proof/refutation authority or set claim truth status. ## Provenance and licensing - [x] No new third-party code, data, model output, or dependency - [x] Generated artifacts retain tool versions, configuration, and hashes - [x] MathCorpus and RL export implications are unchanged and documented - [x] No credentials, private data, or access-controlled material are included Provenance references: protected run
29898749807, source3a75ddc8bc5de685dc6425d6158791553be0ca40, report42b29ecd69b222c26e1de47bed83f6e3e8df5910f35f1c2543a2d9ed72eb3198, package7a3adfa8e30085cbda8ca240ab8288909a088d7ae0f9880ba0cc5b410645cc52, bundlea447696ceeb6e537c0bc6e5ebf81ab95d2e91006df57aa2bb632edc60d4cf0a5. ## Review readiness - [x] The branch is current with main - [x] The pull request addresses one coherent concern - [x] Required checks pass on the review-fix head - [x] Review threads are resolved - [x] Generated output is not represented as independently verified evidence