Conversation
…s) (#219) Move owner facts out of audit reason strings into the typed AuditEvent.actor dimension (spec #208 D-007), and add the two reserved identity audit kinds, following #201's hash pre-image discipline (new rows only; historical hashes untouched). - AuditDescriptor gains an `actor` field + `with_actor` builder; with_audited_effect now routes through append_audit_conn_with_actor so the actor is folded into the audit pre-image. - event_bus replay agreement list gains "actor" (missed by #201) so the field is cross-validated meta_json<->event_json. Safe for legacy rows. - identity.bound carries actor = owner principal; owner fact removed from the reason string (reason keeps only the bound-identity reference). - identity.bootstrapped: owner-creation now routes through with_audited_effect (Immediate tx), emitting the kind with actor = the new owner principal, atomic with the owner insert. Unique-constraint race recovery preserved. - identity.owner_config_mismatch: config mismatch commits a durable rejection audit (actor = stored owner) via append_audit_with_actor, then fails closed with NotOwner. - Resolution paths stay read-only; identifiers stay hash-only.
|
Warning Review limit reached
Next review available in: 43 minutes Limit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?Wait for the limit to reset, then comment An organization admin can change what happens after included review limits in Billing. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4fc3d3c02b
ℹ️ 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".
| pub fn with_actor(mut self, actor: PrincipalId) -> Self { | ||
| self.actor = Some(actor); | ||
| self |
There was a problem hiding this comment.
Forward descriptor actors through begin_effect
When an AuditDescriptor built with .with_actor(...) is passed to Store::begin_effect—the other existing consumer of this descriptor—effect_settlement.rs still calls the actor-less append_audit_conn, so the actor is silently persisted as null. This loses attribution for any owner-authored fenced effect despite the new descriptor contract; that path should pass audit.actor to append_audit_conn_with_actor as well.
Useful? React with 👍 / 👎.
What
Fills the reserved identity audit dimension in the kernel Store (spec #208 D-007). Moves owner facts out of audit
reasonstrings into the typedAuditEvent.actordimension (delivered by #201) and adds the two reserved identity audit kinds, following #201's hash pre-image discipline exactly — new rows only, historical hashes never rewritten.Why
Per spec #208 D-007: let a later tenancy/identity audit query filter by actor without reopening the Store interface. Owner facts previously lived in opaque
reasonstrings (owner={} identity={}); the bootstrap-binding and owner-config-mismatch paths emitted no audit at all. This closes both gaps while keeping resolution read-only and identifiers hash-only.Changes
AuditDescriptorgains anactor: Option<PrincipalId>field +with_actorbuilder;with_audited_effectnow routes throughappend_audit_conn_with_actorso the actor is folded into the hashed audit pre-image.event_busreplay agreement list gains"actor"(missed by Retype ApprovalRecord.approved_by and add AuditEvent.actor #201) so the field is cross-validatedmeta_json↔event_json. Safe for legacy rows (meta lacks key → Null;event_jsonserializesactor: null).identity.boundcarriesactor = owner principal; the owner fact is removed from the reason string (reason keeps only the bound-identity reference).identity.bootstrapped(new kind): owner-creation routes throughwith_audited_effect(Immediate tx), emitting the kind withactor = new owner principal, atomic with the owner insert. Unique-constraint race recovery preserved.identity.owner_config_mismatch(new kind): config mismatch commits a durable rejection audit (actor = stored owner) viaappend_audit_with_actor, then fails closed withNotOwner.get_identity,principal_exists,resolve_identity_by_identifier_hash) stay read-only; identifiers stay hash-only.Verification
./scripts/check.shgreen (exit 0). New tests inidentity_tests.rs: actor on all three kinds, idempotent re-bootstrap emits no second row, mismatch still returnsNotOwner, resolution writes no audit rows, and no raw identifier is persisted acrossevent_json/meta_json/identity_identifiers.Implementation notes (5-line summary)
owner_config_mismatchusesappend_audit_with_actor, notwith_audited_effect(audit-only path per theaudited_effect.rsmodule contract that reserves the combinator for effect writes)."actor".identity.bootstrapped,identity.owner_config_mismatch;identity.boundnow carries typed actor.crates/openspine-kernel/src/store/identity.rsandaudited_effect.rs.Closes #219
Summary by cubic
Reserves the identity audit dimension by moving owner facts from audit reasons into the typed
AuditEvent.actorand adding two identity audit kinds. This enables filtering by actor without changing the Store interface and keeps identifiers hash-only.Old:
identity.boundencodedownerinreason. New: setsactor = owner principaland keepsreasonto the bound identity; actor is folded into the audit hash pre-image. Side effect:event_busreplay now validates"actor"acrossmeta_jsonandevent_json, remaining safe for legacy rows (nullwhen absent).Old: owner bootstrap wrote no audit. New: emits
identity.bootstrappedwithactor = new owner principal, atomic with the owner insert viawith_audited_effect; idempotent re-bootstrap writes no second row.Old: config-owner mismatch wrote no audit. New: emits
identity.owner_config_mismatchwithactor = stored owner, then rejects withNotOwner.AuditDescriptoraddsactorandwith_actor;with_audited_effectroutes throughappend_audit_conn_with_actorso actor is included in the hashed pre-image. Historical rows are unchanged.Resolution paths remain read-only; identifier handling remains hash-only, with no raw IDs persisted.
Migration: Consumers of audit logs should read
actorinstead of parsing owner fromreason. Handleactor: nullfor legacy events. No data migration required.Written for commit 4fc3d3c. Summary will update on new commits.