Skip to content

test: create the plan before stamping the stop request in production stage tests - #255

Merged
ryoari merged 1 commit into
mainfrom
fix/stop-clock-test-race
Oct 28, 2026
Merged

ryoari merged 1 commit into
mainfrom
fix/stop-clock-test-race

Conversation

@ryoari

@ryoari ryoari commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Four tests in tests/test_production_stage.py wrote the stop request with observed_epoch=int(time.time()) and only then called intent(), which sets the plan's now_epoch from the clock. When a second ticked over between the two, the stop clock was one second before the plan start and stop_window rejected it:

value = 1793114287, low = 1793114288, high = 1793114288
EvidenceError: invalid stop request clock

This failed test_controller_stop_goes_to_numerical_record_before_hard_worker_stop on #253, a docs-only PR.

The fix creates the plan first in those four tests, so the stop is never stamped before the plan starts. Test-only; the production check is unchanged.

tests/test_production_stage.py: 22 passed.

Summary by CodeRabbit

  • Tests
    • Expanded coverage for stop-request handling across replay and launch-adoption scenarios, including checks for request delivery and publication behavior when adoption fails or a request disappears.

…stage tests

The stop file's observed_epoch was taken before intent() set the plan's
now_epoch, so a second boundary between the two made the stop clock fall
below the plan start and fail with 'invalid stop request clock'.
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 057ced4 and b60528b.

Files selected for processing: 1
  • tests/test_production_stage.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The production-stage tests now create intents before stop requests. They verify stop delivery and publication behavior when launch adoption fails or removes the stop request.

Changes

Production stop handling tests

Layer / File(s) Summary
Stop request and launch adoption tests
tests/test_production_stage.py
The tests reuse an intent created before the stop request. They verify delivery before launch adoption, recorded delivery after failed adoption, and that removing the request during adoption prevents publication from resuming.

Priority: Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Other

Merge Risk: Minimal · up to b6052

The test-only changes address the reported clock-ordering race without introducing merge-blocking risk.

Pre-merge checks: Passed 4
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "test: create the plan before stamping the stop request in production stage tests" matches the main change. The objectives say PR #255 reorders plan creation before writing the stop request'…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "test: create the plan before stamping the stop request in production stage tests" matches the main change. The objectives say PR #255 reorders plan creation before writing the stop request's observed_epoch in four tests in tests/test_production_stage.py. This removes a clock-boundary race that caused EvidenceError: invalid stop request clock. The title is specific, uses a conventional prefix, and names the primary change. It is under 80 characters, so the length is acceptable.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ryoari
ryoari merged commit 14cdd31 into main Oct 28, 2026
6 checks passed
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.

1 participant