8000 Add controlled publication ingestion by Mnehmos · Pull Request #34 · Mnehmos/MathOS · GitHub
[go: up one dir, main page]

Skip to content

Add controlled publication ingestion - #34

Merged
Mnehmos merged 3 commits into
mainfrom
feat/issue-21-publication-ingestion
Jul 20, 2026
Merged

Mnehmos merged 3 commits into
mainfrom
feat/issue-21-publication-ingestion

Conversation

@Mnehmos
@Mnehmos Mnehmos commented Jul 20, 2026 •
Copy link
Copy Markdown
Owner

Summary

Advances #21 with a controlled, permanently non-authoritative bridge from protected publication artifacts into durable MathOS state.

  • Adds immutable publication_stage/1 quarantine registration for the exact report, retained closure, Sigstore bundle, and all 25 fixed retained roles.
  • Adds hash-only CLI and MCP ingestion paths that accept no caller-authored report, verifier output, argument vector, or authority field.
  • Runs a private copy of the Linux-amd64 GitHub CLI 2.96.0 executable pinned by SHA-256 under bounded input, time, output, environment, and stderr controls.
  • Closed-parses exactly one attestation result and binds the bundle, report subject, workflow, immutable repository/owner IDs, ref, commit, run, runner, SLSA dependency, and 1-8 verified timestamps.
  • Retains the exact raw verifier output and canonical CAS publication_attestation_verification/1 record, then atomically registers the separate SQLite PublicationIngestionReceiptSnapshot and logical stage/actor idempotency result while rechecking the current formalization head.
  • Integrates staging/ingestion into the protected main workflow and exercises the staged-CAS barrier in pull-request CI.

The PR deliberately does not create authoritative proof/refutation evidence or derived mathematical status.

Change class

Select one:

  • Class 0: Administrative or documentation
  • Class 1: Standard implementation
  • Class 2: Verifier-critical
  • Class 3: Release, migration, or security-sensitive

Affected trust boundary: publication provenance verification, CAS quarantine integrity, immutable SQLite ingestion state, idempotency, and protected-workflow handoff.

TDD evidence

  • Acceptance criteria were defined before implementation
  • A focused test or formal obligation failed first for the expected reason
  • The smallest coherent implementation made it pass
  • Refactoring preserved passing behavior
  • Relevant unit and integration suites pass
  • Failure paths and boundary cases are covered
  • Documentation-only exception applies and is explained below

Red evidence: no retained red-run transcript is available, so that checkbox remains open. The acceptance and adversarial obligations are preserved as committed tests.

Green evidence: missing/altered staged CAS, stale head, retry-key rebinding, unknown verifier fields, multiple results, wrong subjects and certificate/run/immutable-ID bindings, invalid timestamp counts, unpinned binaries, timeout, output overflow, stderr, and caller-authored verification records fail closed.

Commands and results:

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test --all-targets - 114 Rust test cases passed
  • Legacy Python suite - 39 tests passed
  • Actionlint 1.7.12, Bash syntax checks, and git diff --check passed
  • CI run 29720847015 passed Linux Rust, Windows Rust, real storage, pinned Lean plus staged-CAS barrier, and legacy Python jobs
  • Security re-review found no remaining Slice C release blocker

Mathematical verification

  • No mathematical trust boundary is affected
  • Candidate output was checked independently from its generator
  • Formal proof passes the pinned kernel or checker
  • Counterexample premises and violated conclusion were checked
  • Assumptions, domains, tolerances, and dependency pins are recorded
  • Claim, theorem, witness, or artifact identifiers are linked

Verifier and result: PR CI proves the non-authoritative candidate and quarantine barriers. The exact protected attestation challenge and retained ingestion evidence must be observed on merged main; authority remains unavailable until the next atomic replay gate exists.

Provenance and licensing

  • No new third-party code, data, model output, or dependency
  • New third-party material has source, license, and attribution recorded
  • Generated artifacts include tool, version, configuration, seed, and hash as applicable
  • MathCorpus and RL export implications are documented
  • No credentials, private data, or access-controlled material are included

Provenance references: the committed publication policy pins the official GitHub CLI release archive and executable hashes, immutable GitHub repository/owner IDs, protected workflow and ref, Lean toolchain, SLSA predicate, and action commits. No third-party binary is vendored; the workflow downloads the official release and verifies it before use. This slice changes neither MathCorpus nor RL export behavior.

Risk and recovery

Known limitations: the production verifier pin is Linux-amd64 only; Windows can stage and test rejection but cannot ingest. CAS and SQLite are separate media, so downstream use must replay the full application closure. Every stage, attestation-verification record, and ingestion receipt remains authoritative:false.

Rollback or recovery plan: revert the workflow and application entry points if necessary. Migration 0010 only adds immutable tables and triggers and may remain inert; do not delete retained evidence. Replay fails closed if CAS bytes are missing or altered.

Follow-up work: build the atomic authority gate that application-replays a current PublicationIngestionReceiptSnapshot and its bound CAS closure, requires a passed report plus current fidelity, and creates typed proof/refutation evidence without trusting table presence.

Review readiness

  • The branch is current with main
  • The pull request addresses one coherent concern
  • Required checks pass
  • Review threads are resolved
  • I have not represented generated output as independently verified evidence

@coderabbitai
coderabbitai Bot commented Jul 20, 2026 •
Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a non-authoritative publication staging and controlled ingestion pipeline with immutable SQLite records, strict attestation validation, CLI/MCP operations, workflow integration, CAS integrity checks, and updated publication authority documentation.

Changes

Publication ingestion workflow

Layer / File(s) Summa 8000 ry
Publication contracts and attestation validation
src/domain/publication.rs, src/publication_attestation.rs, src/config.rs, schemas/publication/*, mcl.toml.example
Defines the publication-stage schema and models, tightens attestation verification counts, validates GitHub attestation output, and adds bounded verifier configuration.
Immutable stage and receipt persistence
migrations/0010_publication_ingestion.sql, src/store/mod.rs
Adds immutable publication-stage and ingestion-receipt tables, CAS inventory tracking, idempotency, integrity validation, and migration version 10.
Application staging and verifier execution
src/app.rs, src/verifier/mod.rs
Implements staging and ingestion operations, staged-byte revalidation, pinned bounded verifier execution, receipt generation, and CAS registration.
CLI, MCP, scripts, and workflow wiring
src/cli/mod.rs, src/mcp/mod.rs, scripts/publication-ingest.sh, .github/workflows/*, tests/*
Exposes staging and ingestion actions, validates script contracts, runs protected workflow paths, retains ingestion artifacts, and adds CLI/MCP coverage.
Publication policy and validation evidence
docs/trust/PUBLICATION_AUTHORITY.md, docs/implementation/*
Documents quarantine staging, controlled ingestion, non-authoritative receipts, authority boundaries, and updated validation evidence.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Workflow
  participant CLI
  participant Application
  participant Store
  participant GitHubCLI
  Workflow->>CLI: stage publication candidate
  CLI->>Application: submit report, closure, and bundle
  Application->>Store: register immutable stage
  Workflow->>CLI: ingest staged hashes
  CLI->>Application: request controlled ingestion
  Application->>Store: reload and validate stage
  Application->>GitHubCLI: run bounded pinned verifier
  GitHubCLI-->>Application: return attestation JSON
  Application->>Store: register ingestion receipt
  Store-->>Workflow: return ingestion outcome
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.89% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding controlled publication ingestion.
Description check ✅ Passed The description covers the template’s required sections, includes status, evidence, risk, and review readiness, and is mostly complete.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/issue-21-publication-ingestion

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.

@Mnehmos
Mnehmos marked this pull request as ready for review July 20, 2026 05:46
@Mnehmos
Mnehmos commented Jul 20, 2026
Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai
coderabbitai Bot commented Jul 20, 2026 •
Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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: 59fb473bd3

ℹ️ 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 thread src/publication_attestation.rs Resolved
@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 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/implementation/RELEASE_CHECKLIST.md`:
- Line 52: Distinguish the canonical CAS verification record from the separate
idempotency-keyed SQLite ingestion receipt, using their exact names
consistently. Update docs/implementation/RELEASE_CHECKLIST.md at line 52 and
docs/implementation/STATUS.md at lines 195-196 so “attestation receipt” and
“publication_attestation_verification/1 receipt” no longer conflate these
outputs; explicitly identify each artifact according to its role.

In `@docs/trust/PUBLICATION_AUTHORITY.md`:
- Around line 140-144: Clarify the distinction between implemented workflow
capability and observed merged-main evidence across
docs/trust/PUBLICATION_AUTHORITY.md:140-144,
docs/implementation/RELEASE_CHECKLIST.md:52, and
docs/implementation/STATUS.md:195-201. Update the claims so
PUBLICATION_AUTHORITY.md does not state that protected main has demonstrated
retained staged/ingested evidence unless the checklist and status confirm it;
otherwise explicitly label the passage as capability while preserving the
pending merged-main evidence status in the sibling documents.
🪄 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: 3ea414ce-7102-47e0-bb91-ec348ec1be38

📥 Commits

Reviewing files that changed from the base of the PR and between b787935 and 59fb473.

📒 Files selected for processing (23)
  • .github/workflows/ci.yml
  • .github/workflows/publication.yml
  • docs/implementation/RELEASE_CHECKLIST.md
  • docs/implementation/STATUS.md
  • docs/trust/PUBLICATION_AUTHORITY.md
  • mcl.toml.example
  • migrations/0010_publication_ingestion.sql
  • schemas/publication/publication-attestation-verification-1.schema.json
  • schemas/publication/publication-stage-1.schema.json
  • scripts/publication-attestation-verify.sh
  • scripts/publication-ingest.sh
  • src/app.rs
  • src/cli/mod.rs
  • src/config.rs
  • src/domain/mod.rs
  • src/domain/publication.rs
  • src/lib.rs
  • src/mcp/mod.rs
  • src/publication_attestation.rs
  • src/store/mod.rs
  • src/verifier/mod.rs
  • tests/mcp_stdio.rs
  • tests/phase1_cli.rs

Comment thread docs/trust/PUBLICATION_AUTHORITY.md Resolved
@Mnehmos
Mnehmos commented Jul 20, 2026
Copy link
Copy Markdown
Owner Author

@codex review

@Mnehmos
Mnehmos merged commit 95bd8a1 into main Jul 20, 2026
6 checks passed
@Mnehmos
Mnehmos deleted the feat/issue-21-publication-ingestion branch July 20, 2026 06:20
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 7fe0343ee9

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

@Mnehmos
Mnehmos commented Jul 20, 2026
Copy link
Copy Markdown
Owner Author

Merged-main controlled-ingestion evidence

PR #34 merged as 95bd8a1d2068612b5eca644c3d77754b5e4f49fd, tree 4027d03fe05bd997108c86250adcf2d920adda48.

  • Main CI run 29721420110 passed Linux Rust, Windows Rust, real storage, pinned Lean plus the staged-CAS barrier, and legacy Python.
  • Protected publication run 29721420136, job 88285050682, passed protected-ref enforcement, clean isolated Lean execution, both exact attestations, both independent challenges, candidate staging, controlled ingestion, and unconditional retention.
  • Artifact 8452528096, publication-boundary-95bd8a1d2068612b5eca644c3d77754b5e4f49fd, is retained for 90 days. GitHub reports archive digest sha256:66cd47753a77f90bf216b874d4d7c99f7ba561a4586e29c524e094c82eb3206c.

Downloaded byte audit:

  • candidate report: 5f02696eac1308f48eae9f085f003e750f009dbe496d055543792b088e3b2aa6
  • retained closure: 6440836d612d91dfe43af952d6ac83ca1445bf75c86b8b52a8c79f6121427b38
  • candidate Sigstore bundle: c02cde0384cd015bbb085d2f98e69c245888dd7cfbc10973b0c9a9e722ad326c
  • canonical quarantine stage: e4b307416358ef657c57d81d07c6b21df0381befbf5600982442bc435d98baa5
  • raw pinned-gh verification: bdfe54e9e889c52c7dc32941dc8fb16d50b1e2b8071a5b69be04eb1040d45932
  • canonical CAS publication_attestation_verification/1 record and SQLite receipt key: 659b789a41a14ac59ca9253c2c71d73c4717acc58dcc2187809e92c710814402
  • separate independent shell challenge record: ee83075cd636e0359ad3ff27fdb81f059d687ced9a8c1d748fa52ebe8fcb5d3a

The audit recomputed the canonical stage and verification-record hashes; checked all 71 retained files; matched every one of the 25 exact, ordered closure roles by path, byte size, and SHA-256; confirmed the passed report binds the merge commit, tree, run, attempt, protected workflow, main, GitHub-hosted runner, Lean 4.32.0, empty axiom set, clean checkout, complete dependencies, network isolation, and memory enforcement; and verified every retained stderr file is empty.

The closed attestation result contains exactly one result, report subject, source dependency, and verified attestation. Its certificate and SLSA fields bind repository ID 1305399818, owner ID 193347153, the protected workflow, merge commit, push event, run/attempt, and GitHub-hosted runner. The verified Rekor timestamp is 2026-07-20T06:22:33Z.

All 18 retained authoritative fields audited as false. This establishes merged-main controlled provenance ingestion only. It does not create authoritative proof/refutation evidence or mathematical status. The next #21 slice must application-replay the current PublicationIngestionReceiptSnapshot and its full bound CAS closure, require a passed report and current fidelity, then atomically create typed authority without trusting receipt-table presence.

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

0