Skip to content

test(controller): make controller cost tests clock-independent on Windows - #408

Merged
kyle-sexton merged 1 commit into
mainfrom
fix/windows-controller-cost-tests
Sep 27, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
fix/windows-controller-cost-tests

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: fixes main's Windows go-quality lane broken by #403.

Summary

TestReconcilerPublishesPreviousTickCost failed on main's Windows go-quality lane (run 36356368154): LastTickDurationSeconds:0. A fast fake Step measures 0 on Windows' coarse wall clock, so the test's nonzero assertions were timing-dependent. #403's own PR run passed the Windows lane by chance.

Fix

  • Both controller cost tests now run inside synctest.Test with a slowResources monitor that sleeps 1s per sample. The bubble clock advances only on that sleep, so Step's measured duration is deterministic and the test asserts the persisted previous-tick value is at least 1s.
  • Process CPU (GetProcessTimes, ~15.6 ms granularity) is asserted non-decreasing across Steps / non-negative, not nonzero.
  • Production code is unchanged.

Verification

  • Native Windows: cross-compiled test binary run via WSL interop, -test.run 'ControllerCost|PreviousTickCost' -test.count 20: 40/40 PASS.
  • go build ./..., go test -race ./..., golangci-lint run ./... (v2.13.2, 0 issues), CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath ./cmd/... all pass.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01GZgRs2crE1YQ1TT4kftix1

…dows

Run both controller cost tests in a synctest bubble with a resource
monitor that sleeps 1s per sample, so the first Step's measured wall time
is set by the bubble clock instead of Windows' coarse timer. Process CPU
is asserted non-decreasing / non-negative rather than nonzero.

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

chatgpt-codex-connector Bot commented Sep 27, 2026 •

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-09-27T23:00:41.324691Z 3cacf8e 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.

@kyle-sexton
kyle-sexton merged commit d9f3f89 into main Sep 27, 2026
2 checks passed
@kyle-sexton
kyle-sexton deleted the fix/windows-controller-cost-tests branch September 27, 2026 23:06
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