Skip to content

fix(lifecycle): read a phase event's "now" after taking the writer - #109

Merged
TusanHomichi merged 1 commit into
mainfrom
claude/phase-event-now
Oct 14, 2026
Merged

TusanHomichi merged 1 commit into
mainfrom
claude/phase-event-now

Conversation

@TusanHomichi

Copy link
Copy Markdown
Member

Primary Issue

Closes #108

Problem And Outcome

record_phase_event read the implicit effective instant (now) before storage::write_tx waited for the writer. Inside the transaction, it then refused any event older than the newest committed one as OutOfOrder. So a request that waited across a second boundary while another event committed got OutOfOrder instead of the real answer.

This failed pr-gate on #106 in phase_events_validate_the_committed_pause_state with left: OutOfOrder, right: AlreadyPaused (job). That PR doesn't touch lifecycle.

Now "now", and the future-instant refusal, are read after the writer is held, so a request is judged at the moment it can commit. Explicit back-dated events keep the effective-order refusal unchanged.

Changes

  • lifecycle.rs: write_tx first, then now/effective and EffectiveInFuture, which now returns through storage::refuse(tx, …).
  • tests/write_transactions/training.rs: new deterministic test a_present_phase_event_is_judged_after_waiting_for_the_writer.
    • A pause request waits on a held writer.
    • The clock passes a second, and a later pause commits through the blocker.
    • The waiting request must get AlreadyPaused.
  • CHANGELOG.md: Unreleased → Fixed.

Correction rung: 2. A deterministic test pins down the timing the flaky concurrency test only hit by chance.

Verification

  • Negative control: with the old ordering, the new test fails exactly as CI did (left: Err(OutOfOrder), right: Err(AlreadyPaused)).
  • write_transactions: 22 passed. fmt and clippy are clean.
  • Full local proof: to be added below.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts


Generated by Claude Code

record_phase_event read the implicit effective instant before waiting for
the write lock, then refused anything older than the newest committed event
as out of order. A request that waited across a second boundary while
another event committed got OutOfOrder instead of the real answer. It now
reads "now" (and checks for a future instant) under the lock.

Closes #108

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T22:49:10.204403Z ade36ce PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copy link
Copy Markdown
Member Author

Full local proof on ade36ce (scripts/proof.py, euid 0 with DAC capabilities dropped): passed, all 7 gates. Browser suite 59 expected, 0 unexpected, 0 flaky. Receipt .proof/20261014T224643Z-ade36ce16ae2/receipt.json, sha256 aee25be1c2ecceed5853390682ecf29cadb689ccdae12fc094dcec44f766a402. CI is green and Codex had no findings.


Generated by Claude Code

@TusanHomichi
TusanHomichi merged commit 5f031b9 into main Oct 14, 2026
4 checks passed
@TusanHomichi
TusanHomichi deleted the claude/phase-event-now branch October 14, 2026 22:59
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.

lifecycle: a phase event's "now" is read before it waits for the writer, so it can be refused as out of order

2 participants