diff --git a/dotnet/OpenWaf.Tests.Integration/AlertPushQueueTests.cs b/dotnet/OpenWaf.Tests.Integration/AlertPushQueueTests.cs index 0e38f00..e6f8a9f 100644 --- a/dotnet/OpenWaf.Tests.Integration/AlertPushQueueTests.cs +++ b/dotnet/OpenWaf.Tests.Integration/AlertPushQueueTests.cs @@ -162,7 +162,17 @@ public sealed class AlertPushQueueTests await BreakTheUpstreamAsync(f); - var state = await WaitForStateAsync(f, s => s.GetProperty("alertPushGivenUp").GetInt32() >= 1); + // Settled means the QUEUE is empty, not merely that one row reached its + // end. Six 502s at N=3 raise two alerts — the crossing at 3 and the + // doubling at 6 — so two deliveries are owed, and the first one to give + // up leaves the second still retrying for another backoff window. Waiting + // on givenUp alone read that window as a product that had stopped asking + // while still holding a row: measured on the Gitea Actions runner (run + // 2361, head 223b8d6) this assertion read pending=1 there, and the same + // race is what the Settled helper two screens up already exists for. + var state = await WaitForStateAsync(f, + s => s.GetProperty("alertPushGivenUp").GetInt32() >= 1 + && s.GetProperty("alertPushPending").GetInt32() == 0); Assert.Equal(0, state.GetProperty("alertPushPending").GetInt32()); Assert.True(state.GetProperty("alertPushGivenUp").GetInt32() >= 1, state.ToString()); diff --git a/scripts/console-check.cjs b/scripts/console-check.cjs index 40b03e8..ca33ec8 100644 --- a/scripts/console-check.cjs +++ b/scripts/console-check.cjs @@ -1777,6 +1777,24 @@ const rgb = (s) => s.match(/\d+/g).slice(0, 3).map(Number); && /^asked: 192\.0\.2\.120\/30 at \/ - \d+ sources probed - newly refused 0, already refused 0, still passing [1-9]\d*$/.test(exempt[0] || ''), JSON.stringify(exempt)); + // The exemption comes off BEFORE the covering-range question is asked. + // /admin-api/impact reports alreadyCoveredBy as what already ANSWERS for the + // match's own address, and while a live allow covers that address the answer + // is pass_allowlisted — the engine never reaches the range, so the field is + // null by design (AdminEndpoints.cs, the self.IsBlocked arm). Asking with the + // exemption still in place asked the same question twice: measured on Gitea + // Actions run 2361 (head 223b8d6) the answer named the exemption and nothing + // else, and this assertion could not have passed for any build. + const exemptKey = await page.$$eval('#allow tbody tr', (trs, t) => { + const tr = trs.find((r) => (r.children[0].textContent || '').trim() === t); + const b = tr && tr.querySelector('button[data-act="delallow"]'); + return b ? b.dataset.k : ''; + }, IMP_NET); + if (exemptKey) await page.click(`#allow tbody button[data-act="delallow"][data-k="${exemptKey}"]`); + await page.waitForFunction((m) => ![...document.querySelectorAll('#allow tbody tr')] + .some((tr) => (tr.children[0].textContent || '').trim() === m), IMP_NET, + { timeout: 15000 }).catch(() => {}); + await page.fill('#blockIp', IMP_WIDE); await page.fill('#blockReason', 'console gate: impact wide range'); await page.click('#addBlock'); @@ -1787,12 +1805,6 @@ const rgb = (s) => s.match(/\d+/g).slice(0, 3).map(Number); covered.some((l) => /^already covered at its own address: block_operator by 192\.0\.2\.112\/28 - this write would change nothing there/.test(l || '')), JSON.stringify(covered)); - const allowKey = await page.$$eval('#allow tbody tr', (trs, t) => { - const tr = trs.find((r) => (r.children[0].textContent || '').trim() === t); - const b = tr && tr.querySelector('button[data-act="delallow"]'); - return b ? b.dataset.k : ''; - }, IMP_NET); - if (allowKey) await page.click(`#allow tbody button[data-act="delallow"][data-k="${allowKey}"]`); await page.click(`#blocks tbody button[data-act="delblock"][data-k="${IMP_WIDE}"]`); await page.waitForFunction((k) => ![...document.querySelectorAll('#blocks tbody button[data-act="delblock"]')] .some((b) => b.dataset.k === k), IMP_WIDE, { timeout: 15000 }).catch(() => {});