Skip to content

fix(api): weekly pool window start landed on next Monday all day Sunday - #1039

Merged
dylanjeffers merged 1 commit into
mainfrom
fix/weekly-pool-window-sunday
Sep 13, 2026
Merged

dylanjeffers merged 1 commit into
mainfrom
fix/weekly-pool-window-sunday

Conversation

@dylanjeffers

Copy link
Copy Markdown
Contributor

Why

getWeeklyPoolWindowStart walks back to "Monday of this week" with now.AddDate(0, 0, -int(now.Weekday())+1). Go numbers Sunday as 0, so on Sundays that is +1 day: the following Monday 16:00 UTC. With the window start in the future, no disbursement matches and /v1/challenges/:id/info reports the full weekly pool as remaining every Sunday. TestV1ChallengesInfo fails the same way on Sundays (it is failing on main today, and blocked #1038's CI).

What

  • Days-since-Monday computed with Sunday as 6, then step back a week when it is Monday before 16:00. Behaviour on every other day is unchanged.
  • time.Now() moves into a thin wrapper so the window function is testable; new table test covers Monday before/at 16:00, midweek, Saturday, and both ends of Sunday.
  • Drops the stray fmt.Println of the window start that ran on every request.

🤖 Generated with Claude Code

getWeeklyPoolWindowStart walked back to "Monday of this week" with
now.AddDate(0, 0, -int(now.Weekday())+1). Go numbers Sunday as 0, so on
Sundays that is +1 day: the *following* Monday 16:00 UTC. With the window
start in the future no disbursement matched, and /v1/challenges/:id/info
reported the full weekly pool as remaining every Sunday. TestV1ChallengesInfo
failed the same way on Sundays, which is how this surfaced.

Compute days-since-Monday with Sunday as 6, then step back a week when it is
Monday before 16:00. The time.Now() read moves out into a thin wrapper so the
function can be tested across the week. Also drops the stray
fmt.Println of the window start on every request.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@dylanjeffers
dylanjeffers merged commit ea07d44 into main Sep 13, 2026
2 checks passed
@dylanjeffers
dylanjeffers deleted the fix/weekly-pool-window-sunday branch September 13, 2026 21:43
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