Skip to content

impl(010): increment 2, the rustev-aicortex adapter - #157

Merged
bartekus merged 1 commit into
mainfrom
impl/010-rustev-aicortex
Oct 22, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/010-rustev-aicortex

Conversation

@bartekus

@bartekus bartekus commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Spec 010, increment 2: the rustev-aicortex adapter, a non-released integration. Follows #156 (spec 021 3.4, R-49, merged), which makes the rustev-aicortex binding record's item 1 pass; rebased onto main after it. Nothing here authorizes a release, publication, live service call, spend or real-user data.

Changes

  • integrations/rustev-aicortex/: AicortexContext, a bounded read of one claim-history page per bound subject under an explicit transaction bound, mapped through a declared projection of 1 to 64 field bindings into attributed snapshot entries (values, conflicts, refusals and missing fields named; no partial history read as complete), and stage_observation, an observation proposal with its Rustev lineage staged into the host's TxnBuilder and never committed. Aicortex is pinned at the record's revision 6415b765e5267188b4ecf302a93869352e28cccc, with Rahi =0.6.0, which that revision pins. Tests: unit tests of the projection, kind mapping, identities and refusals, and integration tests against a single-voter Rahi 0.6.0 store with Aicortex's schema on loopback. The code is the adapter kept on wip/010-rustev-aicortex-adapter (c776546), unchanged.
  • specs/010-integrations/spec.md: the rustev-aicortex record's item 1 passes under R-49 (its Git dependency is outside the release closure; every release member still resolves from crates.io only), so the record passes every row; planned: true is removed from its establishes entry; the Verification block runs its tests, clippy and build and the authorization-type grep; the implementation record describes increment 2.
  • tools/rustev-release/release-set.json: rustev-aicortex is excluded from the release family. docs/backlog.md RUSTEV-015 state.
  • tools/rustev-release/tests/manifests.rs: impl(021): the manifest source rule covers the release closure (R-49) #156's a_git_source_only_an_excluded_package_reaches_is_not_judged asserted exactly one violation when the resolve graph is absent, which held only while no workspace package had a Git source. With rustev-aicortex its real Aicortex packages are judged too (code failed on b988788), so that case now asserts the added package is among the violations and every violation is a source violation.
  • Cargo.lock: regenerated by Cargo for the Aicortex revision and Rahi 0.6.0's graph (Rahi 0.7.1's entries stay; Cargo now names the two Rahi versions explicitly in dependency lists).

Limitation

The adapter pins Rahi 0.6.0 and rustev-rahi pins 0.7.1, so one host cell cannot link both until Aicortex adopts Rahi 0.7.1 (record item 1). rustev-serve stays unimplemented (its record refuses).

Review history

Round 1 on 374a86b (stacked on #156): no findings. Rebased onto main at 3a238a1 after #156 merged (no conflict, derived shards unchanged). Round 2 on b988788: no findings, but the code job failed on the manifest test above; fixed in this head.

Round 3 on 413c222 (1 finding, rejected with evidence): it read serde_core in uuid's dependency list as an unrecognized crate. serde_core is serde's own core crate, which serde 1.0.220 and later depend on; main at 3a238a1 already locks it (Cargo.lock: name = "serde_core", version = "1.0.229", crates.io, checksum 67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48), and serde 1.0.229's entry lists it. This PR adds no serde_core package entry; only the uuid edge is new, because Aicortex enables uuid's serde feature.
Round 3 rerun on 413c222 (the code job had a timing flake in rustev-remote-http's runtime_batch, untouched here; run re-run): no findings. Rebased onto main at fd19273 (#155, no conflict).
Round 4 on 2a80b7b: no findings. Rebased onto main at 70a6424 (#154, no conflict).
Round 5 on 199b201: no findings; held for the coordinator's merge hold. Rebased onto main at cf6665c (#151, no conflict; Cargo.lock still resolves with --locked).
Round 6 on 0024f6c: no findings; held for the coordinator's merge hold. Rebased onto main at 70b99ea (#158): release-set.json kept both the new rustev-otel exclusion and this one; the manifest tests pass locally (18 of 18).
Round 7 on 0550224: no findings. Rebased onto main at 68f40c0 (#161, no conflict).
Round 8 on 2ccb9f9 (1 finding, the same serde_core question as round 3): the rustev-aicortex record's item 1 now states the new uuid -> serde_core edge and where serde_core comes from, so the evidence is inside the diff.
Round 9 on 242c75f: no findings. Rebased onto main at 1b0ce68 (#159, no conflict).

@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the PR systematically across the new crate implementation, spec changes, and dependency additions.

integrations/rustev-aicortex/src/context.rs

  • read() returns Err(ReadError::Truncated) or Err(ReadError::Projection) before any Ok is returned, so no partial snapshot escapes when a subject's history fails. Partial entries from a preceding subject are correctly discarded because read() propagates Err at that level.
  • map_slot accumulates into a local field_entries and only calls entries.extend(field_entries) on success, so a KindMismatch, Unidentifiable, or other per-candidate failure leaves no entry in the outer vec.
  • The subjects deduplication correctly avoids redundant store round-trips.
  • same_slot string-compares namespace/kind/key against typed SubjectRef fields; this is the correct approach since SlotView.slot holds plain strings.

integrations/rustev-aicortex/src/time.rs

  • The Hinnant days-to-civil algorithm is implemented correctly using div_euclid/rem_euclid (handles negative days). The four unit-test cases (1970-01-01, 1969-12-31, 2000-02-29 leap day, 2026-10-18) all verify independently.
  • instant() is safely guarded: i64::try_from on the u64 from UnixSeconds::get(), then u16::try_from(y) for the year, all return None on overflow, which maps to ReadError::Clock.

integrations/rustev-aicortex/src/proposal.rs

  • derived() uses domain-prefixed SHA-256 with length-prefixed parts to prevent collisions between (decision_id, observation_key) pairs from different domains. uuid::Builder::from_custom_bytes correctly stamps the version-8 and RFC 4122 variant bits.
  • The scratch-builder pattern (let mut staged = TxnBuilder::new(); …; for s in staged.into_statements() { txn.push(s); }) ensures a refused staging leaves the host's transaction untouched.
  • RustevJudgment is refused before any staging, consistent with spec 001 3.3.3 / constitution principle VI.

integrations/rustev-aicortex/src/lib.rs

  • #![forbid(unsafe_code)] is present. ✓

integrations/rustev-aicortex/Cargo.toml

  • aicortex-gate is correctly a dev-dependency only; the library itself depends only on aicortex-types, aicortex-claims, and aicortex-store.
  • publish = false matches the exclusion rationale in release-set.json.
  • tokio = { features = ["time"] } covers tokio::time::timeout used in fetch. ✓

specs/010-integrations/spec.md

  • planned: true removed from the integrations/rustev-aicortex/ establishes entry now that the directory exists. ✓
  • Item 1 amended from "refuse" to "pass" consistent with rustev-aicortex being added to the release exclusion set (outside the closure the supply-chain check covers).
  • The verification block adds the three cargo test/clippy/build steps for rustev-aicortex and extends the authorization-type grep to cover the new directory.

tools/rustev-release/release-set.json

  • rustev-aicortex excluded with a clear reason citing spec 010 and R-49. Consistent with publish = false in Cargo.toml. ✓

Cargo.lock

  • All new entries (aicortex-*, rahi-{ledger,store,types} 0.6.0, blake3, etc.) are pinned by git revision or registry checksum. No rahi-store/rahi-types version conflict is introduced in the release closure (existing rustev-rahi retains 0.7.1; rustev-aicortex takes 0.6.0 as documented in binding record item 1's limitation).

No concrete defects found.

{"head": "374a86b716c2dfe57c579737a7e6a9ba2b6de93b", "verdict": "no-findings", "findings": []}

Subject: 07cd08a...374a86b, diff digest 1a430e4e64111859bb271e62f09151b13bab44d5e3616f8384cb3d3b70a02d5d, 1 call(s). An AI comment is not an approval.

Base automatically changed from impl/021-release-closure-source to main October 22, 2026 00:39
@bartekus
bartekus force-pushed the impl/010-rustev-aicortex branch from 374a86b to b988788 Compare October 22, 2026 00:39
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the PR: new integrations/rustev-aicortex/ crate with context source and observation proposer, spec 010 update to reflect implementation, and release-set exclusion.

Code correctness

map_slot accumulates entries into a local field_entries before extending the caller's entries slice; early returns on KindMismatch, Unidentifiable, etc. all happen before entries.extend(field_entries), so no partial entries leak on refusal. ✓

stage_observation stages into a scratch TxnBuilder first and only copies statements to the host's transaction on success, keeping the host's transaction untouched on any refusal. ✓

Derivation of proposal/claim UUIDs uses length-prefixed SHA-256 with distinct domain strings, giving collision-resistant IDs that are stable across resubmissions. ✓

instant() in time.rs uses div_euclid/rem_euclid correctly for pre-epoch timestamps; the unit tests verify epoch, a pre-epoch date, the 2000-02-29 leap day, and a recent date. ✓

Security / Principle compliance

  • #![forbid(unsafe_code)] present. ✓
  • No Permitted or Grant types; the verify step's grep now covers both rustev-rahi and rustev-aicortex. ✓
  • OutcomeOrigin::RustevJudgment is refused before staging; judgments never become observations (Principle VI / spec 001 3.3.3). ✓
  • Scope comes only from the host's resolver, never from content or a judgment (3.1.2). ✓
  • A subject whose history fills the page is refused whole, never read as complete (Principle VIII). ✓
  • Attribution carries claim id, tx_seq, recorded_at, authority, and sourcing; provenance is AttributedClaim (Principle X). ✓

Governance consistency

  • planned: true correctly removed from the rustev-aicortex directory entry in spec 010, now that the crate is implemented. ✓
  • Binding record item 1 changed from refuse to pass citing R-49 (owner-scoped supply-chain check to the release closure); release-set.json excludes the crate, which is consistent with that rationale. ✓
  • The verify block is extended with cargo test/clippy/build -p rustev-aicortex. ✓
  • The crate is in integrations/, satisfying the boundary rule for Aicortex/Rahi dependencies. ✓

No concrete defects found.

{"head": "b9887886bbd5ce5039ce848d8b2c2a6559af9f24", "verdict": "no-findings", "findings": []}

Subject: 3a238a1...b988788, diff digest 1a430e4e64111859bb271e62f09151b13bab44d5e3616f8384cb3d3b70a02d5d, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus enabled auto-merge (squash) October 22, 2026 00:44
@bartekus
bartekus disabled auto-merge October 22, 2026 00:49
@bartekus
bartekus force-pushed the impl/010-rustev-aicortex branch from b988788 to 413c222 Compare October 22, 2026 00:50
@github-actions

Copy link
Copy Markdown

AI review (findings)

Reviewing the PR for bugs, security problems, and inconsistencies. The PR implements rustev-aicortex, an integration crate that was previously blocked by a supply-chain check. Let me walk through the key areas.

context.rs — partial-entry guard: The map_slot function accumulates into local field_entries and supplied vecs and only extends the output entries after all chosen candidates succeed. Any early return (KindMismatch, Unidentifiable) leaves those vecs on the stack and never extends entries. This matches the stated invariant ("a refused field leaves no entry behind") and is correct.

context.rs — subject deduplication: Subjects are deduplicated before fetching and then filtered back to each subject's bindings. Correct; no double-fetches.

proposal.rs — scratch-builder pattern: Staging uses a local scratch TxnBuilder and copies into the host's builder only on success. A refusal leaves the host transaction untouched. Correct.

time.rs — civil-date algorithm: Hinnant's algorithm is used. The test vectors (1970-01-01, 1969-12-31, 2000-02-29 leap day, 2026-10-18) match expected output. Year bounds are enforced via u16::try_from returning None.

tools/rustev-release/tests/manifests.rs: The change from only(check_manifests(...)) to multiple-violation assertions is necessary because without a resolve graph the tool now judges rustev-aicortex's git transitive deps in addition to the test package, producing multiple Source violations. The update is consistent with the described scoping change (R-49).

Cargo.lock — serde_core dependency on uuid: The diff adds serde_core as a new dependency of the uuid package entry, introduced by the new aicortex-* git dependencies enabling a serde feature on uuid. The standard serde ecosystem uses serde, serde_derive, and serde_json; serde_core is not a recognized package in it. The diff does not show serde_core's own [[package]] entry (version, checksum, source), so its provenance cannot be verified from the hunk. This is a concrete, evidence-supported supply-chain risk: an unrecognized crate name appearing in the lockfile of a security-sensitive dependency should be investigated before merge.

{"head": "413c2227d75b7da937ec428eb14b6feb1c23b68d", "verdict": "findings", "findings": [{"path": "Cargo.lock", "line": null, "summary": "The `uuid` package entry gains a new dependency `serde_core`, not a recognized crate in the serde ecosystem; its version, source, and checksum are not visible in the diff, making its provenance unverifiable and posing a supply-chain risk."}]}

Subject: 3a238a1...413c222, diff digest 27c1443ef2a8b08e26e7cd5ea3bc782b426bd9add97e96bb4f0f3ca23b41c5f5, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 22, 2026 00:54 — with GitHub Actions Error
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the PR, which implements integrations/rustev-aicortex/ — an Aicortex context source and observation proposer — along with associated spec, release-set, and manifest-test updates.

Architecture and boundary compliance

rustev-aicortex is placed under integrations/, consistent with the governance rule that only integrations/* may depend on Aicortex or Rahi. #![forbid(unsafe_code)] is present. The verification script addition correctly adds both integrations/rustev-aicortex to the Permitted/Grant grep scan.

context.rs

  • validate() correctly guards zero bindings, over-64 bindings, duplicate/empty field names, and out-of-range page_rows.
  • Subjects are deduplicated before store reads; truncation is refused rather than silently accepted as complete.
  • map_slot builds field_entries aside and only extends the shared entries vector when every chosen candidate maps cleanly, so a kind-mismatch leaves no orphaned entry. The early-return on kind-mismatch during a conflicted slot is safe because Aicortex predicates have a fixed value type, so all candidates for one slot share a kind.
  • The Unidentifiable guard (history.claims().get(&c.claim_id)) and the checked_mul(1_000) / i64::try_from chain for the timestamp both handle edge cases correctly.
  • The HostClock / fetch split correctly scopes clock access: fetch reads the clock once before the timeout, passing the fixed now into read, so the transaction bound is stable for the call's lifetime.

time.rs

The H. Hinnant days-to-civil algorithm is correctly applied. The test vectors (civil(0)=(1970,1,1), civil(11016)=(2000,2,29), civil(20744)=(2026,10,18)) all check out by direct calculation. Year-range guarding via u16::try_from(y) correctly returns None for pre-epoch or far-future timestamps.

proposal.rs

  • stage_observation refuses RustevJudgment origin, empty decision id, and empty observation key, all before touching the host's TxnBuilder.
  • The scratch-builder pattern (stage into a local TxnBuilder, then move statements to txn only on success) correctly leaves the host transaction untouched on error.
  • The derived UUID function uses length-prefixed SHA-256 to avoid boundary-crossing collisions, and uses distinct domain strings for proposal_id vs claim_id, ensuring they differ. uuid::Builder::from_custom_bytes sets version 8 and RFC 9562 variant bits as designed.

Spec and governance

  • Removing planned: true from the establishes entry is correct; the directory now exists.
  • Item 1 changes from refuse to pass; the rationale (R-49 scoping the release-closure check) is consistent with the release-set.json exclusion and the manifest-test update.

tools/rustev-release/tests/manifests.rs

The change from only(check_manifests(&set(), &m)) to v.iter().any(...) + v.iter().all(...) for the resolve = None case is correct: adding rustev-aicortex to the workspace means the degenerate no-resolve-graph path now sees real Git-sourced packages in addition to the synthetic "git-only" package, so the previous "exactly one violation" assertion would become brittle. The new assertion still verifies the synthetic violation is present and that all violations are of Source kind.

No bugs, security defects, or governance inconsistencies found.

{"head": "413c2227d75b7da937ec428eb14b6feb1c23b68d", "verdict": "no-findings", "findings": []}

Subject: 3a238a1...413c222, diff digest 27c1443ef2a8b08e26e7cd5ea3bc782b426bd9add97e96bb4f0f3ca23b41c5f5, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus enabled auto-merge (squash) October 22, 2026 01:10
@bartekus
bartekus force-pushed the impl/010-rustev-aicortex branch from 413c222 to 2a80b7b Compare October 22, 2026 01:31
@bartekus
bartekus disabled auto-merge October 22, 2026 01:31
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff for the new rustev-aicortex integration crate, spec-010 update, manifest-check scoping, and test changes.

Cargo.toml / Cargo.lock — New git-pinned dependencies match the lock-file revision 6415b765…. publish = false, rust-version = "1.96", workspace lint/edition settings, and the scratch-builder pattern (staged TxnBuilder before txn) are all in order.

context.rs

  • same_slot compares SlotView fields via .to_string() against SubjectRef fields — the only viable approach given SlotView stores copies as String. No type mismatch possible at compile time.
  • Duplicate-subject de-duplication (subjects.contains(&&b.subject)) is correct: the outer Vec<&SubjectRef>::contains takes &&SubjectRef; PartialEq resolves transitively.
  • Conflict de-duplication (seen.contains(&&c.value)) — same reasoning.
  • The map_slot early-return paths (KindMismatch, Unidentifiable) all fire before entries.extend(field_entries), so no partial entries leak into the global snapshot. All candidates in a conflicted slot share the same predicate/kind, so the first-mismatch return is correct.
  • Timestamp conversion (recorded_at.get().checked_mul(1_000).and_then(…)) is overflow-safe.
  • fetch correctly wraps the read in tokio::time::timeout using remaining_ms; zero-duration timeout reliably fails a store read.

proposal.rs

  • Length-prefixed domain separation in derived prevents ("a","bc") / ("ab","c") collisions.
  • Scratch-TxnBuilder pattern correctly leaves the host txn untouched on any ProposalRefusal.
  • Judgment-origin guard fires before any staging attempt; the unit test confirms txn.is_empty() after refusal.

time.rs — Hinnant days-to-civil algorithm; verified by the named-date unit tests.

specs/010-integrations/spec.md

  • Removing planned: true from the establishes entry is correct now that the directory exists.
  • The supply-chain rationale (R-49 scopes the manifest check to the release closure, rustev-aicortex is excluded from release-set.json, Git dependency is outside the closure) is internally consistent.
  • Authorization grep extended to cover integrations/rustev-aicortex; correct.

tools/rustev-release/release-set.json — rustev-aicortex added to exclusions with matching rationale.

tools/rustev-release/tests/manifests.rs — The updated test for a_git_source_only_an_excluded_package_reaches_is_not_judged correctly replaces the now-invalid only(…) assertion (single violation) with any + all assertions, documenting the expected degraded behavior when resolve = None (every workspace package is judged, including Git deps of excluded crates).

No concrete bugs, security defects, or governance contradictions found in the evidence supplied.

{"head": "2a80b7b2b92b00cf50e8672dd87c49d2149d9ec2", "verdict": "no-findings", "findings": []}

Subject: fd19273...2a80b7b, diff digest 27c1443ef2a8b08e26e7cd5ea3bc782b426bd9add97e96bb4f0f3ca23b41c5f5, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus enabled auto-merge (squash) October 22, 2026 01:37
@bartekus
bartekus disabled auto-merge October 22, 2026 01:56
@bartekus
bartekus force-pushed the impl/010-rustev-aicortex branch from 2a80b7b to 199b201 Compare October 22, 2026 01:56
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the PR, which introduces the rustev-aicortex integration crate (bounded Aicortex claim reads + observation proposal staging) and the governance changes that un-refuse its binding record item 1.

context.rs — logic and safety

  • map_slot builds supplied and field_entries in a single pass and only calls entries.extend(field_entries) after all candidates succeed. A kind-mismatch on any candidate returns Missing(KindMismatch) without touching the caller's entries. All-or-nothing per field is maintained correctly.
  • The usable.is_empty() check correctly distinguishes HostileContent from OriginErased as the reason.
  • Conflicted-slot deduplication (seen.contains(&&c.value)) uses PartialEq on ClaimValue, giving value equality. Correct.
  • TxBound::RecordedAt(now) is applied to both the history fetch and the projection AsOf, so the two cuts are identical.
  • #![forbid(unsafe_code)] present; boundary grep in the verify block covers integrations/rustev-aicortex. No Permitted/Grant type in the diff.

time.rs — civil-date algorithm

H. Hinnant's days-to-civil algorithm; the four test vectors (civil(0), civil(-1), civil(11016) for 2000-02-29, civil(20744) for 2026-10-18) are correct and cover the epoch, negative offset, and a leap-year edge case. u16::try_from(y) correctly gates out-of-range years; unwrap_or(0) on month/day will produce an invalid CivilDate that from_ms propagates as None.

proposal.rs — derivation and staging

  • derived uses length-prefixed SHA-256 inputs; domain namespacing ("rustev.aicortex.proposal/1" vs "rustev.aicortex.claim/1") ensures proposal-id ≠ claim-id for the same key. Test verifies this.
  • Scratch TxnBuilder pattern: a refusal from ClaimProposalRepo::stage_append leaves the host's txn untouched. ✓
  • OutcomeOrigin::RustevJudgment is refused before anything is staged; the integration test verifies the host transaction remains empty on refusal.

Cargo.toml — dependencies

  • aicortex-gate is dev-only; the production crate does not pull in the gate. ✓
  • publish = false, excluded from release-set.json. Spec 021 3.4's supply-chain check (only release-closure packages are judged for non-crates.io sources) means the Git dependency is out of scope. Consistent with R-49 as described.
  • uuid = { version = "1", default-features = false } — Builder::from_custom_bytes is in the uuid 1.x base (no feature flag needed). ✓

manifests.rs test change

The original only(...) asserted exactly one violation. With rustev-aicortex in the workspace, the resolve = None path now encounters the Aicortex Git packages, producing additional Violation::Source entries. The rewritten assertion verifies (a) the synthetic "git-only" package still produces a Source violation and (b) all violations are of type Source. This is a necessary and correctly reasoned weakening; the primary (resolve-present) path is unaffected.

Spec consistency

  • Item 1's result flips from refuse to pass after release-set.json excludes rustev-aicortex. The prose records the full history (first pass → amend-to-refuse → R-49 → pass again). Coherent.
  • establishes entry for integrations/rustev-aicortex/ loses planned: true. The directory now exists. ✓
  • backlog.md update matches the spec change.

No concrete defects found.

{"head": "199b2011a8c2b6e584dd1b05b3b4a4745857e244", "verdict": "no-findings", "findings": []}

Subject: 70a6424...199b201, diff digest 27c1443ef2a8b08e26e7cd5ea3bc782b426bd9add97e96bb4f0f3ca23b41c5f5, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus enabled auto-merge (squash) October 22, 2026 02:01
@bartekus
bartekus disabled auto-merge October 22, 2026 02:01
@bartekus
bartekus force-pushed the impl/010-rustev-aicortex branch from 199b201 to 0024f6c Compare October 22, 2026 02:41
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the PR, which adds the rustev-aicortex integration crate implementing a bounded context source over Aicortex claims and an observation proposer.

Cargo.lock / dependency additions

All new packages resolve from either the pinned Git revision (6415b765) or crates.io with explicit checksums. The added serde_core dependency under the uuid wasm-feature path is a known no-std alias; no anomaly there.

integrations/rustev-aicortex/src/time.rs

The civil function is the Hinnant days-to-civil algorithm; the test vectors (epoch, leap-day 2000-02-29, 2026-10-18) and the hand-traces are consistent. The u32::try_from(m).unwrap_or(0) fallback for month/day is safe because a zero month causes CivilDate::ymd to return Err, which propagates as None from instant. No defect.

integrations/rustev-aicortex/src/context.rs

  • ContextConfig::validate is called eagerly in new, so the struct can only be constructed with a valid binding set and page bound.
  • The subjects loop reads one page per subject, refuses on truncation (page.next_after.is_some()) rather than silently treating a filled page as complete. ✓
  • map_slot builds field_entries in a local buffer and calls entries.extend(field_entries) only after all chosen candidates map successfully; early-return paths leave the shared entries vector unchanged. ✓
  • The fetch seam samples the clock before starting the tokio::time::timeout, fixing the transaction bound at request start. The zero-millisecond test case (call(b"traveler", 0)) is explicitly verified. ✓
  • ProvenanceClass::AttributedClaim is used for all Aicortex-sourced entries; authority level and sourcing are carried as opaque attribution strings, never promoted to a Rustev probability or derivation class. ✓

integrations/rustev-aicortex/src/proposal.rs

  • OutcomeOrigin::RustevJudgment is refused before any staging, matching constitution principle VI and spec 001 §3.3.3. ✓
  • The derived UUID function uses SHA-256 with distinct domain strings for proposal vs. claim IDs and length-prefixed input concatenation; domains "rustev.aicortex.proposal/1" and "rustev.aicortex.claim/1" differ so the IDs differ. The test confirms a.proposal_id != a.claim_id. ✓
  • stage_observation builds changes in a scratch TxnBuilder and only pushes them into the caller's builder on success, so a refused proposal leaves the host transaction untouched. ✓

#![forbid(unsafe_code)] is set in lib.rs. ✓

specs/010-integrations/spec.md

The planned flag is removed from integrations/rustev-aicortex/, the binding record item 1 result flips from refuse to pass with the rationale (R-49 scoped the manifest check to the release closure), and the implementation record is updated consistently. The verification sh -c '... grep -rnE "(struct|enum|trait|type)[[:space:]]+(Permitted|Grant)...' integrations/rustev-aicortex correctly covers the new crate. The boundary check (cargo tree for core crates against rahi/aicortex) is unchanged and covers this integration indirectly (it would catch a forbidden reverse dependency). ✓

tools/rustev-release/release-set.json

rustev-aicortex is excluded with a reason that correctly names the Git dependency and publish = false. ✓

tools/rustev-release/tests/manifests.rs

The old test used only() (exactly one violation) under resolve = None. With rustev-aicortex now in the workspace, a resolve-absent scan sees its Git packages too, so multiple Source violations are possible. The updated assertions (any(…name == "git-only") and all(… Source)) are correct for this expanded case. ✓

No bugs, security defects, or governance inconsistencies found.

{"head": "0024f6c0074bcfa5c06d28d841c155ccbc5b753d", "verdict": "no-findings", "findings": []}

Subject: cf6665c...0024f6c, diff digest 396852e959668a446f6583fa2521212cb9335eb7cc43ddec2cf09a7cad216dc0, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus enabled auto-merge (squash) October 22, 2026 02:46
@bartekus
bartekus disabled auto-merge October 22, 2026 02:56
@bartekus
bartekus force-pushed the impl/010-rustev-aicortex branch from 0024f6c to 0550224 Compare October 22, 2026 03:41
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the PR, which introduces integrations/rustev-aicortex/ implementing the Aicortex context source and observation proposer, updates specs/010-integrations/spec.md to reflect binding record item 1 passing, and adjusts the release manifest test.

context.rs

  • Scope is always obtained from the host ScopeResolver, never derived from claim content or a judgment — correct per 3.1.2.
  • map_slot builds field_entries aside and only calls entries.extend(field_entries) after the full chosen loop completes, so a mid-loop KindMismatch or Unidentifiable early-return leaves no partial entries in the caller's entries vec. Correct.
  • The Unidentifiable timestamp conversion uses checked_mul(1_000) on u64, then i64::try_from, then Timestamp::from_ms — all fallible, all handled. No panic path.
  • Conflicted-slot deduplication (seen.contains) is linear but bounded by MAX_CLAIM_PAGE_ROWS; no issue.
  • subjects de-duplication using Vec::contains on &SubjectRef uses value equality (PartialEq deref), correct.
  • fetch obtains now before constructing the timeout future, so the transaction bound is fixed at call time. Dropping the future on timeout writes nothing (read-only). Correct.

proposal.rs

  • derived() length-prefixes each input part before hashing, preventing concatenation collisions; SHA-256 truncated to 128 bits is adequate for UUID derivation keyed on domain + decision_id + observation_key.
  • Staging uses a scratch TxnBuilder first, copied into the host's transaction only on success — a refusal leaves the host's transaction untouched. Correct.
  • RustevJudgment origin is refused before anything is staged, consistent with spec 001 3.3.3 and principle VI.

time.rs

  • Hinnant's days-to-civil algorithm is applied correctly; div_euclid/rem_euclid handle negative timestamps (pre-1970) without sign error. u16::try_from(y) correctly returns None for years < 0 or > 65535, which covers years outside Aicortex's 1–9999 range.

Cargo.toml

  • aicortex-gate is dev-dependency only (correct — only needed for admission in the integration test). uuid = { version = "1", default-features = false } is sufficient for Builder::from_custom_bytes and Uuid::from_u128.

specs/010-integrations/spec.md

  • Removes planned: true from the rustev-aicortex directory entry, consistent with the crate now being present.
  • The binding record now reflects item 1 passing via R-49 scoping the supply-chain check to the release closure. The implementation record documents the change history transparently (first read pass → amended to refuse → passes again after R-49). The change to release-set.json excluding rustev-aicortex is consistent with this.

tools/rustev-release/tests/manifests.rs

  • The "no resolve graph" test case is correctly weakened from only(…) (exactly one violation) to any(Source { name == "git-only" }) && all(Source). The reason (rustev-aicortex's Git packages now appear in the workspace resolution and are also flagged when there is no graph to scope by) is documented in the comment and follows from the added crate.

No concrete defects found.

{"head": "0550224ff82850562ed3db4641d073b34c1a26de", "verdict": "no-findings", "findings": []}

Subject: 70b99ea...0550224, diff digest c2544bd4b71402be58ed9b70ce51775723fada04316224501077b78fb2799715, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus enabled auto-merge (squash) October 22, 2026 03:47
@bartekus
bartekus disabled auto-merge October 22, 2026 03:55
@bartekus
bartekus force-pushed the impl/010-rustev-aicortex branch from 0550224 to 2ccb9f9 Compare October 22, 2026 03:55
@github-actions

Copy link
Copy Markdown

AI review (findings)

Reviewing the PR: it adds the rustev-aicortex integration crate, marks spec 010's binding record item 1 as pass (citing R-49 scoping the supply-chain check to the release closure), and updates the release exclusion list and manifest test accordingly.

Code observations:

context.rs map_slot correctly builds field_entries and supplied in a local buffer before extending entries, so a kind mismatch or Unidentifiable mid-loop leaves no partial entries behind. The conflicted deduplication (seen.contains(&&c.value)) is correct. The timeout in fetch with remaining_ms = 0 is tested and works as expected.

proposal.rs derived uses SHA-256 with length-prefixed inputs across a domain string, preventing concatenation collision between proposal and claim IDs (different domain strings) and across keys. The staging uses a scratch TxnBuilder before pushing into the host's transaction, so a refusal from ClaimProposalRepo::stage_append leaves the caller's transaction untouched.

time.rs uses Hinnant's algorithm for days-to-civil conversion; the unit tests cover the epoch, a leap day (2000-02-29), and negative days (1969-12-31). The Timestamp bounds check (from_ms) prevents silently supplying an out-of-range as_of_ms.

Concrete finding:

The uuid 1.16.0 entry in Cargo.lock (checksum unchanged at 2ef6dac1e96601b4fb3acccccff2139741fcb757cb9a36089bf5be91cfb285ce) acquires serde_core as a new dependency in this PR. The standard uuid crate uses serde (the ubiquitous serde library) for serialization, not serde_core (a far less common crate). This dependency does not originate from rustev-aicortex/Cargo.toml directly—it is a transitive addition brought in by the aicortex packages. The serde_core package entry must exist elsewhere in the Cargo.lock (not visible in the diff), and its checksum would be fixed by the lock file, but its origin and maintainership are not in the standard serde ecosystem. This is an unexpected transitive supply-chain addition that the binding record's supply-chain review (item 1) does not mention.

{"head": "2ccb9f90ff499415e608020177704b9c3e668f28", "verdict": "findings", "findings": [{"path": "Cargo.lock", "line": null, "summary": "The uuid 1.16.0 package entry gains serde_core as a new transitive dependency introduced by the aicortex packages; serde_core is not part of the standard serde ecosystem and this addition is not acknowledged in the binding record's supply-chain review (item 1)."}]}

Subject: 68f40c0...2ccb9f9, diff digest c2544bd4b71402be58ed9b70ce51775723fada04316224501077b78fb2799715, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 22, 2026 03:59 — with GitHub Actions Error
@bartekus
bartekus enabled auto-merge (squash) October 22, 2026 04:00
@bartekus
bartekus disabled auto-merge October 22, 2026 04:00
@bartekus
bartekus force-pushed the impl/010-rustev-aicortex branch from 2ccb9f9 to 242c75f Compare October 22, 2026 04:01
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

I reviewed all changed paths for bugs, security problems, and inconsistencies. Here is my analysis:

integrations/rustev-aicortex/src/context.rs

  • map_slot builds field_entries aside and only extends entries after every chosen candidate maps; early-return paths (KindMismatch, Unidentifiable, Timestamp overflow) leave no partial entry behind. Intentional per the inline comment and spec.
  • The subjects deduplication loop uses subjects.contains(&&b.subject) — for Vec<&SubjectRef>, contains receives &&SubjectRef and PartialEq dereferences correctly. No defect.
  • fetch calls the clock before wrapping the future with tokio::time::timeout. For remaining_ms = 0 the timeout fires immediately without having polled the future; the test asserts ReadError::Deadline in that case. Correct.
  • The full-page truncation check (page.next_after.is_some()) returns an error before any partial history is used. Correct.

integrations/rustev-aicortex/src/proposal.rs

  • stage_observation stages into a scratch TxnBuilder first and only pushes into the caller's txn after ClaimProposalRepo::stage_append succeeds, so a refusal leaves the host transaction untouched. Correct.
  • OutcomeOrigin::RustevJudgment is refused immediately before any staging — a Rustev judgment cannot be laundered as an observation. Consistent with spec 001 § 3.3.3 and constitution principle VI.
  • UUID derivation uses length-prefixed SHA-256 → uuid::Builder::from_custom_bytes (UUIDv8), with distinct domain strings for proposal vs. claim, preventing cross-type collision. The test verifies idempotency and key-separation. No defect.

integrations/rustev-aicortex/src/time.rs

  • Hinnant's days-to-civil algorithm is applied with div_euclid/rem_euclid, handling negative Unix timestamps correctly. All four test vectors (epoch, -1, 2000-02-29 leap day, 2026-10-18) check out arithmetically.

tools/rustev-release/tests/manifests.rs

  • The updated test correctly widens the resolve = None assertion from only(…) (exactly one violation) to any(…) + all(…). The comment explains why: without a resolve graph the checker judges every package, including Git packages from excluded integrations like rustev-aicortex. The test still verifies the right properties.

tools/rustev-release/release-set.json

  • rustev-aicortex is explicitly excluded with a matching reason (Git revision outside the release closure, publish = false). Consistent with the spec change.

specs/010-integrations/spec.md

  • The binding record table and the overall result flip from "refuse" to "pass" on item 1 only after the release-tool rule was scoped to the release closure (R-49). The governance document references R-49 as the owner's decision; I cannot inspect that act from the diff but no contradiction is visible in the evidence here.
  • The verification block now tests rustev-aicortex and extends the Permitted/Grant grep to cover integrations/rustev-aicortex. Consistent with boundaries enforced elsewhere.

Boundary enforcement

  • rustev-aicortex is in integrations/; the tree-check loop in the verify script covers only rustev-contract rustev-core rustev-runtime rustev-eval rustev-surface rustev-cli, so core crates remain Aicortex-free.
  • No Permitted or Grant type is defined in any changed source file.

Hardcoded secrets in tests

  • The secrets (raft-secret-for-rustev-tests, key vec![5u8; 32], etc.) appear in tests/library.rs for a loopback store that is torn down after the test. Test-only, no production exposure.

No concrete defects found.

{"head": "242c75f97c0675d5a05afbd666e60bcc23c4e675", "verdict": "no-findings", "findings": []}

Subject: 68f40c0...242c75f, diff digest 7cbbbe1618c2a3997f95e9bcd5540bd78ab122ff718125e677f4a74f585ae93d, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus enabled auto-merge (squash) October 22, 2026 04:06
@bartekus
bartekus disabled auto-merge October 22, 2026 06:02
@bartekus
bartekus force-pushed the impl/010-rustev-aicortex branch from 242c75f to 12e3b29 Compare October 22, 2026 06:02
@bartekus
bartekus enabled auto-merge (squash) October 22, 2026 06:04
@bartekus
bartekus disabled auto-merge October 22, 2026 06:04
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff across all changed paths.

integrations/rustev-aicortex/src/context.rs

  • map_slot builds field_entries separately and only extends the global entries after all candidates succeed; an early return on KindMismatch or Unidentifiable leaves entries untouched — correct.
  • same_slot compares all five slot components; deduplication in the conflicted-slot branch is well-ordered (first seen wins, giving one entry per distinct value).
  • Scope derived entirely from the host's resolver; never from content or a judgment (3.1.2 satisfied).
  • fetch wraps read in tokio::time::timeout; dropping the future after deadline is safe because reads write nothing.

integrations/rustev-aicortex/src/proposal.rs

  • derived length-prefixes each component before hashing, preventing ambiguous concatenation; different domain strings for proposal_id and claim_id guarantee non-collision.
  • Staging uses a scratch TxnBuilder first; a refused stage_append returns without touching txn — the test verifies this.
  • RustevJudgment is refused before any side-effect.

integrations/rustev-aicortex/src/time.rs

  • Hinnant's days-to-civil algorithm is correctly implemented and tested against known dates (epoch, leap day 2000-02-29, a recent date).
  • u16::try_from(y).ok()? gates years outside [0, 65535]; CivilDate::ymd then rejects year 0, so the effective gate is Aicortex's own type validation.

integrations/rustev-aicortex/Cargo.toml

  • All Aicortex crates pinned to the same exact revision 6415b765…; rahi-store and rahi-types pinned to =0.6.0; publish = false; aicortex-gate in dev-dependencies only. Consistent with the binding record.

tools/rustev-release/tests/manifests.rs

  • The old only(...) assertion (exactly one Source violation when resolve = None) would now fail because the workspace carries additional git-source packages from Aicortex. The updated assertion (any(name == "git-only") + all(Source)) is weaker but correct: it still proves the synthetic package is flagged and that no other violation category appears.

tools/rustev-release/release-set.json

  • rustev-aicortex correctly added to the excluded set with a clear reason. Its git dependency is therefore outside the release closure, which is the scoping R-49 introduced.

specs/010-integrations/spec.md

  • Binding record item 1 changes from refuse to pass based on R-49. The spec for 021 is not in the diff, but the change to the release tool's exclusion set is present and consistent with the stated rationale. The crate's publish = false and exclusion from release-set.json are both present.
  • planned: true correctly removed from the establishes entry for integrations/rustev-aicortex/ now that the directory exists.
  • The grep for Permitted/Grant types is extended to cover the new crate; neither name appears in the new source.
  • #![forbid(unsafe_code)] present in lib.rs.

No concrete defects found.

{"head": "12e3b29f8e6b86ff866037df79bba2fbfa52503d", "verdict": "no-findings", "findings": []}

Subject: 1b0ce68...12e3b29, diff digest d3bb485d04f75d5bdfbad539ebf8daa14825ea038354bce9661ee2f6cb1524ef, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus enabled auto-merge (squash) October 22, 2026 06:08
@bartekus
bartekus merged commit 262b37c into main Oct 22, 2026
26 checks passed
@bartekus
bartekus deleted the impl/010-rustev-aicortex branch October 22, 2026 06:30
bartekus added a commit that referenced this pull request Oct 22, 2026
Spec 029 increment 3: repeat sets and `rustev.repeat-report/1` (3.1,
3.2.5, 3.5, 3.6). Library only; no CLI, ledger, baseline or gate yet; no
live run, provider call or spend. `implementation` stays `in-progress`.

- `rustev-eval/src/repeat.rs` (new): `repeat(RepeatInputs)` over N
reconciled runs. Refuses the `live` source (`live-source-unavailable`),
  N outside 1 to 64, unreconciled case measures (`reconcile`), runs that
  differ in dataset, split, evaluator configuration, plan or metric list
  or do not list the split's cases in manifest order (`mixed-runs`), a
  `replay` set whose runs are not identical (`not-reproducible`), an
  unreported stability metric or override, and a cohort over the
  bootstrap bound (`bootstrap-too-large`). The report names the source,
  configurations, dataset, split and fixed role (3.7.1), provenance,
  adapter rules, plan, each run's document digests and run seed, the
  stable cohort, and per cohort (`all`, then each slice) every metric's
per-run values, `mean`, `sd`, `min`, `max`, `pooled`, interval and band
  with its basis. Slices below their minimum are unknown throughout; a
metric without a per-case measure (cost totals, `brier`) has across-run
  statistics in `all` only. Latency, queue and cost metrics state their
observation (`historical` for candidate runs, 3.11.2). A held-out report
  records `held_out` as unknown until increment 4 adds the ledger.
- `rustev-eval/src/report.rs`, `eval_cases.rs`: `cost_per_1000/observed`
  and `/estimated` case measures (3.2.5), unknown unless cost units are
  declared comparable, the observed series unknown for a case with
  liability or an unknown charge; none for a candidate.
- `rustev-eval/src/repeat_stats.rs`: `across_runs`, factored out of
  `run_stats` unchanged, for metrics stated only by the run reports.
- Tests (`tests/reports.rs`): replay set (zero `deterministic_replay`
  band, pooled equal to the report, distinct run seeds, stable cohort,
  totals and `brier`, observations, unknown `cost_per_1000`, a reported
  slice and one below its minimum, round trip and byte determinism);
  captured set with a case losing its bundle (stable cohort, positive
  `k_sd` band); one captured run (unknown band); differing replays, the
  live source and N of 0 and 65 refused; mixed baseline and candidate
runs, unreconciled measures and an unreported stability metric refused;
  a candidate set with historical observations and `interval_width`
  bands.
- `tools/rustev-release/archive-policy.json`: `src/repeat.rs`.
- Spec 029: increment 3 record and engineering choices.

Still open from increment 2: owner decision D-029-1 (Brier per-case
measures), recorded in spec 029's implementation record.

Local verification (macOS arm64): `make gate` passes with spec-spine
0.31.0; `cargo clippy -p rustev-eval --all-targets -- -D warnings`,
`cargo test -p rustev-eval` and `cargo test -p rustev-fp-corpus` pass.

Review round 1 (1 finding, not a defect, evidence added): the finding
says
a candidate's cases get a known `cost_per_1000/observed` when costs are
comparable and known. The cost measures sit inside `case_measures_of`'s
`if inputs.candidate.is_none()` block (opened above the latency loop,
outside the reviewed hunk), so a candidate's cases carry none. A comment
now says so in the hunk, and a new test,
`cost_per_1000_is_measured_for_a_baseline_and_never_for_a_candidate`,
declares cost units comparable and checks that the baseline's cases
carry
cost per 1000 while the candidate's carry none and its repeat report's
`cost_per_1000/observed` is historical and unknown.

Review round 2: no findings. Rebased onto `main` after #159 (no
conflict).
`make code` passes locally on this head, except two failures caused by
other worktrees sharing the build target (a test binary removed by a
concurrent `cargo clean`, and `rustev-jev`'s `lodging_swap` finding its
output directory already created by a concurrent run); each passes when
rerun alone.

Review round 3 (1 finding, fixed by making the rule explicit): the
finding
says `cost_unknown_attempts` should carry no observation. It is one of
the
four cost series a spec 004 candidate report replaces with "the
candidate
was not executed; latency and cost are the baseline's", so it is an
observation of the runs and historical for a candidate, as 3.12.4 needs.
`observation` now lists latency, queue, the four cost series and
`cost_per_1000/*` by name instead of a `cost_` prefix, with that reason
in
its comment; the candidate test checks the cost series are historical
and
a quality metric has no observation.

Local on this head: `make gate` passes; `cargo test --workspace
--no-fail-fast` passes except `rustev-release --test manifests`, which
reports a `rustev-aicortex` member that exists only in another lane's
worktree sharing the build target, and passes when run alone; clippy,
fmt and boundaries pass.
Rebased onto `main` after #157 (no conflict); `rustev-eval` and
`rustev-release` tests (including `manifests`, now that
`rustev-aicortex` is on `main`) and `rustev-eval` clippy pass on the
rebased head.
Review round 4: no findings. Rebased onto `main` after #162 (no
conflict).
Review round 5: no findings. Rebased onto `main` after #160 (no
conflict); `make code` and `make gate` pass locally on this head.
Review round 6: no findings. Its `code` run failed in
`rustev-remote-http --test runtime_batch`

(`a_deadline_or_a_cancellation_after_send_ends_every_member_as_independent_calls_do`),
a timing test in a crate this PR does not touch. Rebased onto `main`
after
#167, which changes no Rust source, so the previous head's local `make
code`
still covers the Rust tree; `make gate` passes.
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