Skip to content

test(mecatui): make template clock refresh test deterministic - #2518

Merged
rdimitrov merged 1 commit into
mainfrom
fix/statusline-template-clock-flake
Oct 26, 2026
Merged

rdimitrov merged 1 commit into
mainfrom
fix/statusline-template-clock-flake

Conversation

@rdimitrov

Copy link
Copy Markdown
Member

Summary

TestStatusLine_Scenario4_DebounceTemplateRefreshAndClock flaked under -race in CI (for example on the catalog-refresh PR #2517, which changed only a JSON file).

The template half of the test used a real 1-second ticker with a 1.5-second deadline. The status-line source does not publish a render whose text is unchanged. When the first tick rendered the same HH:MM:SS as the submit-time render, that refresh was dropped, and the next tick arrived after the deadline.

This change splits newTemplateSourceWithTicks out of newTemplateSource so the test can send interval ticks and set the submit-time clock by hand. It now asserts exact clock values (12:00:00 after submit, 12:00:01 after a tick) instead of "changed within 1.5s". Production behavior is unchanged.

Testing

  • go test -race -count=50 -run TestStatusLine_Scenario4 ./cmd/mecatui/customization/: passed
  • go test -race ./cmd/mecatui/customization/: passed
  • pinned golangci-lint on the package: 0 issues

🤖 Generated with Claude Code

TestStatusLine_Scenario4_DebounceTemplateRefreshAndClock relied on a real
1s ticker and a 1.5s deadline. Unchanged renders are not published, so when
the first tick rendered the same HH:MM:SS as the submit-time render, the
refresh was dropped and the next tick missed the deadline. This flaked under
-race on loaded CI runners.

Split newTemplateSourceWithTicks out of newTemplateSource so the test can
drive interval ticks and the submit-time clock by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rdimitrov
rdimitrov merged commit e56ff17 into main Oct 26, 2026
39 of 40 checks passed
@rdimitrov
rdimitrov deleted the fix/statusline-template-clock-flake branch October 26, 2026 09:54
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