Phase 0: Event application API #50
No reviewers
Labels
No labels
bug
cli
core
docs
event
experiment
figure
invariant
metrics
oracle
phase-0
phase-1
phase-2
phase-3
phase-4
phase-5
phase-6
provenance
revocation
tests
workload
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
erikinkinen/AES!50
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "0-event-application-api"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #8
Summary
This PR implements the event application API for Phase 0, introducing
apply_event()as the single, canonical mechanism for mutating the authority graph. This establishes strict mutation discipline: all graph modifications must occur through event application, with explicit precondition checking and explicit delta reporting.The implementation supports all Phase 0 event types (CreateSubject, CreateObject, CreateCap, DeleteCap, DelegateCap, ReduceRights, DestroyObject, DestroySubject, UseCap) and enforces all invariants (I1–I10) through mandatory runtime precondition checks.
Scope
Included
apply_event()API withApplyEventResultcontaining error status and explicitGraphDeltaGraphDeltastructure tracking all graph mutations (created/destroyed nodes, created/deleted/modified edges)TestAccesshelper for unit tests to access store methods directly (test-only, not for production)SubjectStore,ObjectStore, andEdgeStore(accessible only throughapply_event()orTestAccess)Explicitly excluded
Design intent
The event application API establishes mutation discipline as a first-class architectural constraint. By making store mutation methods private and accessible only through
apply_event(), the design enforces that:GraphDeltadescribing exactly what changedTestAccessallows direct store manipulation in unit tests while preventing accidental misuse in productionThis design supports the broader AES goal of deterministic, reproducible simulation by ensuring that the authority graph evolves only through well-defined event sequences.
Phase discipline
Phase 0: Event Application API
This PR completes the Phase 0 authority model by implementing the event application layer. It builds on prior Phase 0 work:
Phase stability: The semantics of Phase 0 events are now fixed. Later phases may introduce new event types but must not retroactively alter the meaning of Phase 0 events.
Reserved fields: The
GraphDeltastructure does not include temporal information (creation time, generation counters). These fields are reserved for Phase 1+ when the temporal model is defined.Verification
apply_event()orTestAccessTestAccess)Notes
Review focus:
TestAccessusage pattern — confirm it's only used in tests, never in production codeImplementation notes:
edges_from_subject()) were made public to support precondition checking without exposing mutation methodsKnown limitations:
Follow-up work:
apply_event(graph, event)(#8)