From 9fcef927fd4086e05c6b505275329de61b49c50a Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 11 Oct 2026 09:35:50 +0200 Subject: [PATCH] Pin the budget sweep and Retry-After rounding; drop a redundant Math.Max Survivors of the first Stryker pass on FixedWindowBudget: the sweep dropping live windows, sweeping every call, and the exact window boundary (masked by the sweep in the first test). Co-Authored-By: Claude Opus 5.5 --- src/Bifrost.Web/Pages/Mill/Vote.cshtml.cs | 2 +- .../ConceptVoteRateLimitTests.cs | 5 ++- .../FixedWindowBudgetTests.cs | 41 +++++++++++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/src/Bifrost.Web/Pages/Mill/Vote.cshtml.cs b/src/Bifrost.Web/Pages/Mill/Vote.cshtml.cs index 5e46e1d..a06c3b3 100644 --- a/src/Bifrost.Web/Pages/Mill/Vote.cshtml.cs +++ b/src/Bifrost.Web/Pages/Mill/Vote.cshtml.cs @@ -140,7 +140,7 @@ public sealed class VoteModel( return null; } - Response.Headers.RetryAfter = Math.Max(1, (int)Math.Ceiling(wait.TotalSeconds)).ToString(System.Globalization.CultureInfo.InvariantCulture); + Response.Headers.RetryAfter = ((int)Math.Ceiling(wait.TotalSeconds)).ToString(System.Globalization.CultureInfo.InvariantCulture); return new StatusCodeResult(StatusCodes.Status429TooManyRequests); } diff --git a/tests/Bifrost.Web.Tests/ConceptVoteRateLimitTests.cs b/tests/Bifrost.Web.Tests/ConceptVoteRateLimitTests.cs index 7165973..5049071 100644 --- a/tests/Bifrost.Web.Tests/ConceptVoteRateLimitTests.cs +++ b/tests/Bifrost.Web.Tests/ConceptVoteRateLimitTests.cs @@ -92,14 +92,15 @@ public sealed class ConceptVoteRateLimitTests : IClassFixture