Repository navigation
Conversation
…e missing background-collection marker ListRecommendations only kicks a stale refresh when the ctx carries WithBackgroundCollection (issue #627). The twin tests from #938 used a bare context.Background(), so the positive control never saw a refresh (5s timeout in CI) and the negative twin passed vacuously. The tests were written against a base without that gate and merged after it landed. Mark the helper ctx with WithBackgroundCollection. Verified: positive control fails before the change on current main and passes after; the #308-shape mutation (resolveEffectiveCacheTTL not returning disabled for 0) fails the negative test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 1 billable file and costs up to $0.25.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 36 minutes for your next included review. View limit details
Comment |
|
This duplicates #960, which merged at 2ef2f5d and makes the same |
|
Merge driver note (claude-cc-pr-merge-2): this is superseded. #960 (merged as 2ef2f5d at 11:2xZ) already made the same change: |
|
@coderabbitai review |
|
Summary
Fixes red main CI. Since #938 (18ee477),
TestScheduler_ListRecommendations_StaleCacheKicksBackgroundRefreshhas failed in GitHub Actions in both the unit and integration jobs, with "expected a background refresh for a cache older than the stale TTL" after 5s. Example run: 38889963878.Root cause: semantic merge skew with #627. #627 landed in parallel and made
ListRecommendationsstart a refresh only whenBackgroundCollectionAllowed(ctx)is true (internal/scheduler/scheduler.go:1153, used at:1183). The API sets that marker throughWithBackgroundCollection(background_collection.go:20, set athandler_recommendations_refresh.go:141). The #938 test helper passed a barecontext.Background(), so no refresh was ever started:The pre-merge local runs were green because that base did not have #627 yet.
Fix: the helper now uses
WithBackgroundCollection(context.Background()), matching production and every other refresh-expecting test in the package. A one-line comment explains why. This is a test-only change; there is no production bug.Evidence
go test -race -short -run StaleCacheKicks(the CI unit flags): fails after 5.00s. Passes with the fix.-race -short -count=20(40 passed) and-tags integration -count=5(10 passed). The full scheduler package passes under-race -short(196) and-tags integration(41).go vet -tags integrationis clean. golangci-lint v2.10.1 reports 0 issues.Review
An independent non-author reviewed this and found no blocking findings at b4b18ca. The same reviewer also reviewed #938.
Follow-up to #938 (#167).
🤖 Generated with Claude Code