Skip to content

feat: compile governance lineage Iceberg Atlas - #168

Merged
4444J99 merged 7 commits into
mainfrom
agent/governance-iceberg-atlas-20260716
Jul 19, 2026
Merged

feat: compile governance lineage Iceberg Atlas#168
4444J99 merged 7 commits into
mainfrom
agent/governance-iceberg-atlas-20260716

Conversation

@4444J99

@4444J99 4444J99 commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

  • add bounded candidate-testament compilation and Iceberg Atlas generation
  • materialize resolver-neutral snapshot references only after exact snapshot and digest checks
  • compile the first pass from reviewed immutable operator events while keeping the operator-directive assertion unverified until CORPVS ratification
  • reject a candidate that predeclares constitutional evidence or a verified assertion
  • activate the final render only from an exactly matched CORPVS-ratified testament and assertion evidence
  • derive ideal and self-image state from predicate receipts, then render two timelines, all six zooms, reviewed relationships, coverage, and citation debt
  • support an honest blocked Atlas (strict=False) without emitting a verified Event Spine event
  • quarantine malformed children by hash, resume finite child cursors, and use pinned RFC 8785 canonical JSON for identities and governed digests

Bounded cadence owners

Engine now owns the distill and render stages in Limen's nine-stage cadence.

  • distill consumes direct source/event/lineage/assertion/coverage/ideal/testament artifacts and emits an exact non-ratifying candidate plus compiler receipt.
  • render requires the CORPVS-ratified testament and reconciled node self-image set, then emits the public Atlas, private detail, Atlas receipt, cursor, event-spine projection, and typed owner projection.
  • Both owners bound the complete source/event/node/edge/assertion/ideal/self-image denominator with LIMEN_GOV_MAX_ITEMS.
  • Proof traversal recompiles into temporary custody, requires every governed byte to match, binds the exact prior child, emits zero new events, and rewrites nothing.
  • Independent read-only predicates verify snapshot bindings, candidate/ratification state, exact output digests, readiness derivation, timeline and six-zoom counts, and event disposition.

Readiness semantics

ready requires valid snapshot contracts and self-digests, exact source coverage, a ratified evidence-backed testament, verified assertions, receipt-derived complete ideals and self-images, nonempty operator and artifact timelines, all six populated zooms, reviewed relationships, zero citation debt, and zero compiler quarantine.

Blocked compilation still materializes a deterministic Atlas and receipt with the exact debt. It does not emit a verified Atlas event. A missing immutable event, blocked constitutional scope, fabricated identity, handwritten pass value, stale digest, single-source assertion, or missing zoom therefore cannot become a false ready.

Real frozen evidence

Against frozen snapshot governance-native-20260716, the new distill owner processed 125,985 bounded units and produced:

  • candidate digest sha256:1082c824d2608eefef63de75963a47289fafb44663ee358aa259381f6197cd6c
  • exact_all: true
  • ready: false
  • status closed_with_owner_routed_debt
  • 18 blockers, two missing requirements, one citation-debt item, and ten incomplete predicates

The independent real predicate passed. A proof traversal produced an exact skipped_completed child with the prior receipt digest and zero events.

Verification at exact head 0da635b

  • cadence plus Atlas suites: 29 passed
  • exact CI Ruff command (ruff check src/ tests/ --ignore SIM105): passed
  • scoped Pyright: 0 errors, 0 warnings
  • real frozen candidate owner and independent predicate: passed
  • proof traversal: byte-identical, zero new events
  • git diff --check: passed

The broader repository test attempt reached 5,298 passing and 71 skipped tests; remaining failures were environment/optional-dependency cases outside these changed governance modules. The prior exact-head CI exposed one COM812 formatting failure; 0da635b corrects it and passes the exact lint command locally. Current-head public CI remains the remote authority.

Dependency and honest boundary

The baseline public contracts are merged through schema-definitions #10. This branch additionally consumes the proposed denominator and raw-unit/cadence contracts in schema-definitions #11 and #12, plus direct Ontologia/CORPVS owner artifacts.

This PR does not itself ratify CORPVS or acquire inaccessible exports. distill deliberately stops at a candidate, and render deliberately refuses that candidate. CORPVS must materialize the exact authority transition before the final render can execute. Global readiness remains false until that transition, self-image reconciliation, the blocked source debt, and the full two-traversal cadence are all resolved.

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown

Spec Compliance Report

Traceability Audit

  • Headers found: 33
  • Specs covered: 27/27 (100%)
  • Errors: 0
  • Warnings: 22

Invariant Validators

  • INV-000-001:dag
  • INV-000-002:reachability
  • INV-000-005:observability

Ruff Lint

✅ Exit code: 0

Tests & Coverage

✅ Tests exit code: 0

  • Coverage: 74%

@4444J99
4444J99 marked this pull request as ready for review July 19, 2026 08:12
Copilot AI review requested due to automatic review settings July 19, 2026 08:12
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@4444J99, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b1d2a9e6-3f6d-4c08-9a75-56d6685055e0

📥 Commits

Reviewing files that changed from the base of the PR and between c99f641 and 0f7ecc0.

📒 Files selected for processing (19)
  • docs/governance-cadence-owner.md
  • pyproject.toml
  • receipts/README.md
  • receipts/engine/candidate-testament-governance-native-20260716.json
  • src/organvm_engine/cli/__init__.py
  • src/organvm_engine/cli/testament.py
  • src/organvm_engine/corpus/__init__.py
  • src/organvm_engine/corpus/governance_bundle.py
  • src/organvm_engine/corpus/governance_lineage.py
  • src/organvm_engine/testament/__init__.py
  • src/organvm_engine/testament/governance_cadence.py
  • src/organvm_engine/testament/governance_cadence_contract.py
  • src/organvm_engine/testament/governance_cadence_predicate.py
  • src/organvm_engine/testament/governance_compiler.py
  • src/organvm_engine/testament/iceberg_atlas.py
  • src/organvm_engine/testament/receipt_registry.py
  • tests/test_governance_atlas.py
  • tests/test_governance_cadence.py
  • tests/test_governance_receipt_custody.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/governance-iceberg-atlas-20260716

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.

@4444J99

4444J99 commented Jul 19, 2026

Copy link
Copy Markdown
Member Author

Backlog engagement 2026-07-19 — disposition: evolving.

Verified live state before touching: MERGEABLE/CLEAN and all checks green (test, both test-matrix legs, spec-compliance, secret scan, CLAssistant, release-draft). I marked it ready-for-review because the draft was green. I am not merging it in this conservative pass: the diff is large core governance/testament work (+6110/-1 across 19 files, including governance_lineage.py, iceberg_atlas.py, and 1.6k+ lines of new tests), so it needs owner review of semantics before landing.

Copilot AI 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.

Pull request overview

This PR introduces Engine-owned “distill” and “render” cadence stages for governance lineage compilation and deterministic Iceberg Atlas generation, including durable receipt custody resolution and extensive contract-style tests to ensure exact digest-bound outputs and fail-closed semantics.

Changes:

  • Add bounded governance cadence owner adapters (distill/render) plus read-only predicates and contracts to validate digest bindings, readiness derivation, and proof traversal behavior.
  • Implement the deterministic Iceberg Atlas compiler (dual timelines, six zooms, quarantine/cursor resumption, readiness gating, and optional “blocked but renderable” output without emitting verified events).
  • Add Engine durable receipt resolution by convention (receipt:engine:<key>receipts/engine/<key>.json), plus custody docs/fixtures and pin RFC 8785 canonical JSON dependency.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_governance_receipt_custody.py Verifies receipt:engine:* resolution, digest exactness, and public-safe custody constraints.
tests/test_governance_cadence.py Contract tests for distill/render adapters, predicates, bounded denominator enforcement, and proof traversal invariants.
tests/test_governance_atlas.py Large regression fixture suite for Atlas determinism, quarantine, readiness gating, resumable cursor, and redaction behavior.
src/organvm_engine/testament/receipt_registry.py Adds convention-based durable Engine receipt resolver.
src/organvm_engine/testament/iceberg_atlas.py Implements deterministic Iceberg Atlas compiler/renderer, receipt emission, and event spine behavior.
src/organvm_engine/testament/governance_compiler.py Adds bounded candidate-testament compiler with non-ratifying/corroboration rules.
src/organvm_engine/testament/governance_cadence.py Adds distill/render owner commands that compile in temporary custody, validate, then atomically install outputs.
src/organvm_engine/testament/governance_cadence_predicate.py Adds independent read-only predicate entrypoints for distill/render.
src/organvm_engine/testament/governance_cadence_contract.py Adds shared pure validation contracts for owner/predicate including digest bindings and readiness semantics.
src/organvm_engine/testament/__init__.py Re-exports Atlas compiler types/functions.
src/organvm_engine/corpus/governance_lineage.py Adds/extends canonical JSON digesting + state normalization/finalization used by the Atlas compiler.
src/organvm_engine/corpus/governance_bundle.py Adds local resolver for snapshot-bundle artifact references with exact digest verification.
src/organvm_engine/corpus/__init__.py Exposes selected governance-lineage helpers from the corpus package.
src/organvm_engine/cli/testament.py Adds CLI entrypoints for candidate-testament and iceberg-atlas compilation (dry-run/write modes).
src/organvm_engine/cli/__init__.py Wires new testament subcommands into the top-level CLI dispatch.
receipts/README.md Documents receipt custody conventions and a pinned candidate receipt digest.
receipts/engine/candidate-testament-governance-native-20260716.json Adds a tracked Engine-owned candidate-testament receipt fixture.
pyproject.toml Pins rfc8785==0.1.4 for canonical JSON.
docs/governance-cadence-owner.md Documents owner command invocation, env bindings, and predicate behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +467 to +471
"coverage": {
"exact_all": bool(bundle["coverage"]["exact_all"]) and not state["quarantine"],
"source_count": len(state["source_envelopes"]),
"event_count": len(bundle.get("normalized_events", nodes)),
"node_count": len(nodes),
Comment on lines +41 to +48
root = (
repository_root.resolve()
if repository_root is not None
else Path(__file__).resolve().parents[3]
)
path = root / "receipts" / "engine" / f"{key}.json"
if path.is_symlink() or not path.is_file():
raise ReceiptResolutionError(f"Engine receipt is not tracked: {reference}")

@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: 0f7ecc0545

ℹ️ 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 +994 to +998
matching_nodes = [
node
for node in nodes.values()
if node["source_envelope_id"] == source_id and node["lane"] == "operator_intent"
]

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 Require reviewed nodes for ratification authority

In the render activation path, this match accepts any operator_intent node for the authority source. Nothing later requires review_state == "reviewed", so a ratified testament that references an immutable but still-unreviewed operator node is activated and can produce a ready Atlas/verified event. Please include the review-state check in the authority-node match before accepting the ratification.

Useful? React with 👍 / 👎.

Comment on lines +1010 to +1013
or normalized.get("authority_class") != "operator_intent"
or normalized.get("normalized_role") != "operator"
or normalized.get("identity_basis", {}).get("content_hash")
!= source.get("body_hash")

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 Bind authority event timestamps before activation

In the render path, this condition binds the normalized authority event by id/source/content hash but never compares normalized["occurred_at"] with the source envelope/node timestamp. A normalized event with a stale or fabricated timestamp but the same content hash therefore still activates the directive and can emit a ready Atlas, whereas the candidate compiler rejects the same mismatch. Please add the timestamp check before accepting the authority event.

Useful? React with 👍 / 👎.

Comment on lines +610 to +614
quarantine_ids = [
f"{item.get('reason', 'quarantine')}:{item.get('unit_id', 'unknown')}"
for item in finalized["quarantine"]
if isinstance(item, Mapping)
]

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 Preserve quarantine diagnostic ids in receipts

For blocked renders with compiler quarantines, finalized["quarantine"] entries have diagnostic_id, collection, source_index, record_hash, and error_code, not reason or unit_id. This turns every compiler quarantine in the Atlas receipt into the same quarantine:unknown string, so multiple malformed children collapse into one debt item and the receipt no longer points operators at the hashed diagnostic they need to fix. Use the diagnostic id or record hash here instead.

Useful? React with 👍 / 👎.

if paths.node_self_image_set is not None:
bundle["node_self_image_set"] = load_object(paths.node_self_image_set)
_validate_core_snapshot(bundle, require_ratified=require_ratified)
if require_ratified:

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 Validate distill readiness inputs before trusting debt

When require_ratified is false for the distill owner path, this skips the stronger bundle validation and returns after only core header checks; run_distill then derives readiness from the coverage and ideal-form ready fields. A candidate run with inconsistent coverage counts or a stale ideal-register self digest can still emit a ready distill projection, giving downstream ratification a false readiness signal. Add equivalent coverage semantics and self-digest validation before computing distill readiness.

Useful? React with 👍 / 👎.

for source in bundle["source_envelopes"]
if isinstance(source, Mapping)
}
or detail.get("assertion_evidence") != bundle["assertion_evidence"]

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 Compare assertion evidence independent of input order

When a render input contains more than one assertion and the JSONL/array is not already sorted by assertion_id, the compiler normalizes state["assertions"] into sorted order before writing detail["assertion_evidence"], but the predicate compares that list to the original input order here. Valid owner artifacts in a different order therefore fail with Atlas receipt does not bind its direct owner artifacts. Compare assertions by id, as the source-envelope check does, or preserve input order.

Useful? React with 👍 / 👎.

Comment on lines +721 to +725
self._receipt_event(
str(bundle["snapshot_id"]),
input_digest,
artifact_digest,
)

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 Emit verified events only after artifacts are durable

For a ready Atlas through the public compiler/CLI, _receipt_event appends to the Event Spine before any atlas, detail, receipt, or cursor file is written. If one of those writes fails, for example because the output directory is full or not writable, the append-only spine retains a testament.verified event for artifacts that were never materialized. Stage the event until after successful artifact/cursor writes or write it in the same temporary custody.

Useful? React with 👍 / 👎.

Comment on lines +1041 to +1048
assertion_reference = ratification.get("assertion_evidence_reference")
assertion_reference_is_id = assertion_reference in assertions
operator_assertions = [
assertion
for assertion in resolved_assertions
if (
not assertion_reference_is_id
or assertion["assertion_id"] == assertion_reference

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 Resolve the ratification assertion reference exactly

When assertion_evidence_reference is present but does not match an assertion id, assertion_reference_is_id is false and this filter stops constraining the operator assertion at all. A typo or stale ratification reference such as assertion:does-not-exist still activates any cited operator-directive assertion and can produce a ready Atlas/verified event. Treat an unresolved assertion reference as debt instead of disabling the check.

Useful? React with 👍 / 👎.

Comment on lines +493 to +496
"node_self_image_set": {
**deepcopy(bundle["node_self_image_set"]),
"self_images": deepcopy(state["self_images"]),
},

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 Keep self-image set bytes aligned with its digest

For bundles with multiple self-images whose input order differs from the compiler's sorted state order, this replaces the original self_images list while preserving the original set_digest. The render can still be ready, but node_self_image_set in the private detail no longer verifies against its own sha256-rfc8785-excluding-self-digest-v1 digest. Preserve the original contract projection or recompute the digest for the rewritten body.

Useful? React with 👍 / 👎.

Comment on lines +179 to +183
if ratified_input:
if verification_state != "verified" or not constitutional_evidence:
raise ValueError(
"ratified input requires verified constitutional assertion evidence",
)

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 Scope constitutional evidence to directive assertions

For ratified inputs, this requires every assertion in the bundle to carry a ratified_constitutional_record. A legitimate ratified snapshot that also includes verified external/current-state assertions without constitutional-record evidence cannot be reprojected into its exact candidate, even though only the operator-directive assertion needs that ratification backing. Apply this requirement only to the referenced/cited directive assertion.

Useful? React with 👍 / 👎.

Comment on lines +127 to +129
custody = source.get("custody_snapshot")
if not isinstance(custody, Mapping) or custody.get("immutable") is not True:
raise ValueError("candidate source envelope is not immutable")

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 Bind candidate sources to the snapshot

The public candidate compiler accepts any immutable source envelope here without checking that its custody_snapshot.snapshot_id matches the candidate bundle's snapshot_id. A candidate can therefore be marked ready_for_owner_ratification while one of its cited native operator sources is from a different custody snapshot. Include the snapshot binding check before adding the source to the candidate authority set.

Useful? React with 👍 / 👎.

@4444J99
4444J99 merged commit 9d35bb9 into main Jul 19, 2026
10 checks passed
@4444J99
4444J99 deleted the agent/governance-iceberg-atlas-20260716 branch July 19, 2026 16:06
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants