Reject engine clock and event-ID exhaustion before authority mutations #630

Merged
erikinkinen merged 1 commit from phase2/bug-629-engine-overflow-guards into main 2026-10-20 19:18:22 +02:00
Owner

Task

Closes #629.

Summary

An event at the maximum logical clock previously created authority and wrapped
time to zero. An exhausted event-ID cursor reached a fatal generator assertion
after applying the graph operation. Both engine entry points now return
Errc::Overflow before dispatch, preserving graph, history, cursors and meters.

Scope

Adds one preflight capacity guard and boundary regression fixtures. Direct
ID-generator behavior and valid legacy event behavior remain unchanged.
The research intent transaction remains separate work in the version-4 path.

Design intent

Reject exhausted infrastructure capacity before a mechanism performs any work.
The last legal clock/event identity succeeds; the next attempted mutation fails
without adding or clearing work. IDs a caller allocated before step remain
outside the entry point's preflight boundary.

Phase discipline

The fix applies to both original and measured entry points and supports the
research hard-error/no-mutation contract without changing legacy success cases.

Verification

Before the fix, the clock probe printed
error=0 time=0 authority_created=1 events_added=1; the event-ID probe exited
with SIGABRT. The new CTest failed on the original code with the expected
Overflow assertion. With the fix, all 57 tests pass at source commit
5bc3ad8780 in Debug, Release and Clang ASan/UBSan.
Fixtures cover each limit separately and together, both entry points, preserved
nonempty meters, and the final legal event followed by rejected deletion.
The archived legacy cases and repository hooks pass.

Before/after logs, reproducer, JUnit and toolchain evidence.
All eight final-head Forgejo checks must pass before the three issue steps are
checked once and the PR is merged.

## Task Closes #629. ## Summary An event at the maximum logical clock previously created authority and wrapped time to zero. An exhausted event-ID cursor reached a fatal generator assertion after applying the graph operation. Both engine entry points now return `Errc::Overflow` before dispatch, preserving graph, history, cursors and meters. ## Scope Adds one preflight capacity guard and boundary regression fixtures. Direct ID-generator behavior and valid legacy event behavior remain unchanged. The research intent transaction remains separate work in the version-4 path. ## Design intent Reject exhausted infrastructure capacity before a mechanism performs any work. The last legal clock/event identity succeeds; the next attempted mutation fails without adding or clearing work. IDs a caller allocated before `step` remain outside the entry point's preflight boundary. ## Phase discipline The fix applies to both original and measured entry points and supports the research hard-error/no-mutation contract without changing legacy success cases. ## Verification Before the fix, the clock probe printed `error=0 time=0 authority_created=1 events_added=1`; the event-ID probe exited with SIGABRT. The new CTest failed on the original code with the expected Overflow assertion. With the fix, all 57 tests pass at source commit 5bc3ad8780b6ff739aeaf8ad004f6a071e0a454e in Debug, Release and Clang ASan/UBSan. Fixtures cover each limit separately and together, both entry points, preserved nonempty meters, and the final legal event followed by rejected deletion. The archived legacy cases and repository hooks pass. [Before/after logs, reproducer, JUnit and toolchain evidence](https://git.erikinkinen.fi/attachments/569b4d76-02cc-422d-a085-257644ebbc8c). All eight final-head Forgejo checks must pass before the three issue steps are checked once and the PR is merged.
erikinkinen added this to the Phase 2 milestone 2026-10-20 19:04:04 +02:00
Reject exhausted engine clocks and event IDs before mutation
All checks were successful
markdownlint / markdown-lint (pull_request) Successful in 18s
clang-format / check-format (pull_request) Successful in 20s
ci / smoke (pull_request) Successful in 2m58s
ci / sanitizers (pull_request) Successful in 3m5s
markdownlint / markdown-lint (push) Successful in 13s
clang-format / check-format (push) Successful in 17s
ci / smoke (push) Successful in 3m20s
ci / sanitizers (push) Successful in 3m23s
5bc3ad8780
Sign in to join this conversation.
No reviewers
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!630
No description provided.