Skip to content

test(state): make the early stop window test independent of clock resolution - #1706

Merged
wizzomafizzo merged 1 commit into
mainfrom
test-early-stop-window-deterministic
Oct 28, 2026
Merged

wizzomafizzo merged 1 commit into
mainfrom
test-early-stop-window-deterministic

Conversation

@wizzomafizzo

@wizzomafizzo wizzomafizzo commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

TestEarlyStop_StopAfterTheWindowIsNotEarly shrank the early stop window to 1ns and assumed the clock moves between the game being published and the stop. On a fast Windows runner it doesn't, so the stop counted as early and the test failed. It failed twice on main at 3d095b3.

The test now keeps the default 30-second window and moves the recorded launch and publish times back past it, so the result no longer depends on clock resolution or runner speed. Without the time shift the test fails, so it still checks the window.

Summary by CodeRabbit

  • Tests
    • Updated timing test coverage for early-stop behavior when media has already been launched and published.

…olution

The test shrank the window to 1ns and relied on the clock moving between the
publication and the stop. On Windows the clock can read the same instant for
both, which is inside any window, so the stop counted as early and the test
failed. It now keeps the default window and moves the launch and publication
back past it.
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c04cb7e4-9750-49f7-9ed7-16ef7bd057a7
Commits

Reviewing files that changed from the base of the PR and between 3d095b3 and afc8e5f.

Files selected for processing: 1
  • pkg/service/state/early_stop_test.go

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

Walkthrough

The early-stop test now publishes media before backdating the launch and publication timestamps by twice the existing early-stop window.

Changes: Early-stop test timing

Layer / File(s) Summary
Set timestamps outside the window
pkg/service/state/early_stop_test.go
The test now backdates lastLaunchAt and activeMediaPublishedAt by twice the existing window after publishing media.

Priority: Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other

Possibly related PRs

Merge Risk: Minimal · up to afc8e

The test-only timing adjustment presents no identified merge-blocking risk.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: making the early stop window test independent of clock resolution.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.

Finishing Touches
📝 Generate docstrings
  • 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.

@wizzomafizzo
wizzomafizzo merged commit c822c0f into main Oct 28, 2026
16 checks passed
@wizzomafizzo
wizzomafizzo deleted the test-early-stop-window-deterministic branch October 28, 2026 09:16
@codecov

codecov Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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