Engine events mutate authority before detecting exhausted clocks or event IDs #629

Closed
opened 2026-10-20 18:51:56 +02:00 by erikinkinen · 0 comments
Owner

Problem

Engine::step and Engine::step_measured apply the graph operation before
allocating its event identity and incrementing the logical clock. At
time == UINT64_MAX, an accepted event wraps time to zero and publishes its
authority change. An exhausted event-ID cursor also reaches the generator's
fatal overflow check after the operation instead of returning a hard error.

Reproduced on 5ef0cd37b1902300f6bbb0c2c24d524cd6a7fa0f with a valid subject/object and a fresh proposed
capability, then setting the event clock to its maximum:

error=0 time=0 authority_created=1 events_added=1

The probe exits 1 because the expected overflow error and unchanged authority
are absent. This violates the research overflow/no-mutation contract and can
produce a noncontiguous accepted history.

Required behavior

Preflight both the logical clock and the next event identity before applying
an event through either engine entry point. Return Errc::Overflow without
changing graph, history, clock, identity cursors or the measured work meter.
Keep the ID generator's existing direct-call overflow behavior and valid
legacy executions unchanged.

Acceptance

  • Reproduce clock wrap and add failing engine-boundary regression fixtures.
  • Guard both entry points before mutations, with boundary-success controls.
  • Pass full Debug, Release, ASan/UBSan, legacy fixture and Forgejo checks.
## Problem `Engine::step` and `Engine::step_measured` apply the graph operation before allocating its event identity and incrementing the logical clock. At `time == UINT64_MAX`, an accepted event wraps time to zero and publishes its authority change. An exhausted event-ID cursor also reaches the generator's fatal overflow check after the operation instead of returning a hard error. Reproduced on `5ef0cd37b1902300f6bbb0c2c24d524cd6a7fa0f` with a valid subject/object and a fresh proposed capability, then setting the event clock to its maximum: ```text error=0 time=0 authority_created=1 events_added=1 ``` The probe exits 1 because the expected overflow error and unchanged authority are absent. This violates the research overflow/no-mutation contract and can produce a noncontiguous accepted history. ## Required behavior Preflight both the logical clock and the next event identity before applying an event through either engine entry point. Return `Errc::Overflow` without changing graph, history, clock, identity cursors or the measured work meter. Keep the ID generator's existing direct-call overflow behavior and valid legacy executions unchanged. ## Acceptance - [x] Reproduce clock wrap and add failing engine-boundary regression fixtures. - [x] Guard both entry points before mutations, with boundary-success controls. - [x] Pass full Debug, Release, ASan/UBSan, legacy fixture and Forgejo checks.
erikinkinen added this to the Phase 2 milestone 2026-10-20 18:51:56 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
erikinkinen/AES#629
No description provided.