Repository navigation
Conversation
#932 made ListRecommendations kick a background collection only for contexts marked via WithBackgroundCollection. #938 added stale-refresh tests with an unmarked context, so the positive control never kicks and times out, and the sentinel test passed only because of the missing marker. Both now use the marked context. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
cristim
commented
Oct 16, 2026
cristim
left a comment
Member
Author
There was a problem hiding this comment.
Independent review of 8a7c3b5: no actionable findings
Findings: none.
What I attacked:
- Reproduced the red on origin/main (b49b494):
go test -race -count=1 -run StaleCache ./internal/scheduler/fails with "expected a background refresh for a cache older than the stale TTL" (scheduler_test.go:1003). Cause confirmed: ListRecommendations only reaches the kick whenmayCollectis set (scheduler.go:1182), which needs WithBackgroundCollection, and the helper used a bare context.Background(). - At the PR head,
go test -race -count=5 ./internal/scheduler/passes (980 tests). - Negative test stays meaningful: with the
if disabled {return at scheduler.go:1185 neutralized, StaleHoursZeroDisablesBackgroundRefresh fails 3/3 ("background refresh started although ... == 0 disables it") while the positive control passes. Probe reverted; worktree clean. - Other callers: all other test callers of ListRecommendations assert on returned records and do not wait on a kick; the suite shows no failure.
- Diff is test-only: 1 file, +3/-1, internal/scheduler/scheduler_test.go.
go test -count=1 ./internal/...at the PR head: no failures.
Gate status: independent review done on this SHA; local verification above (macOS, real affected path, fail-before/pass-after); CI and labels not part of my verdict beyond: PR has no labels and no closing issue to mirror (NON-BLOCKING, nothing to copy).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Main has been red since 18ee477 (#938): TestScheduler_ListRecommendations_StaleCacheKicksBackgroundRefresh times out after 5s.
Root cause: #932 made Scheduler.ListRecommendations kick a background collection only when the request context is marked with WithBackgroundCollection (unrestricted reader). #938 landed on top of it with a shared helper that called ListRecommendations with an unmarked context, so the positive control never kicks. The same helper also fed the stale_hours=0 sentinel test, which therefore passed only because the context was unmarked, not because of the sentinel.
Change: test only. staleListRecommendations now builds its context with WithBackgroundCollection, so the positive control kicks and the sentinel test is meaningful again. No production code changes.
Verification:
disabledearly return in ListRecommendations makes the StaleHoursZero test fail; reverted.🤖 Generated with Claude Code
Summary by CodeRabbit