Skip to content

test(events): count the throttle lock warning; harden the Windows fingerprint fallback - #4726

Merged
bpamiri merged 1 commit into
developfrom
test/throttle-warn-count
Dec 1, 2026
Merged

bpamiri merged 1 commit into
developfrom
test/throttle-warn-count

Conversation

@bpamiri

@bpamiri bpamiri commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to the merged #4694 throttling work (c6fb3afe8) for r2's test-quality note: the "warn once" spec proved less than its name claimed. It asserted the flag was set but never counted warnings, so a regression that keeps the flag and removes the early return (one WriteLog per failure) would still pass — reintroducing the log flood D1 exists to prevent.

Change

  • Route the lock warning through an overridable seam, $errorEmailThrottleLogWarning(), which does the same WriteLog(file="wheels", type="warning", …) inside the same try/catch.
  • The spec mocks that seam (prepareMock + $()) and calls $warnErrorEmailThrottleLockFailure() three times: it now asserts $count("$errorEmailThrottleLogWarning") is 1, not just that the flag is set.
  • Windows fingerprint note (r2, non-blocking): when GetFileFromPath returns empty for a normalized path, fall back to the last path segment (ListLast(normalized, "/")) and then "no-frame" — never the full deployment path, which could split the same failure across installs. Documented in the code comment.

No throttle behaviour changes: fail-open, one warning per application, caps accepting 0 as unlimited, and the window rejecting 0 are byte-identical.

Mutation proof (required)

Temporarily deleted the early-return block from $warnErrorEmailThrottleLockFailure() (flag still set, one warning per call), ran the focused spec:

✗ 13 passed, 1 failed, 0 errors
Failed: warns once, not per failure, when the throttle lock is unavailable:
  the lock warning must be written once per application, not once per failure.
  Expected [1] Actual [3]

Restored the early return: 14 passed.

Verification

  • Focused ErrorEmailThrottleSpec: 14 passed (Lucee 7).
  • Full local suite: 7,443 passed, 0 failed.
  • tools/test-matrix.sh adobe2023 sqlite: pass (after the one-time cold engine install) — MockBox seam works on Adobe.
  • Complexity gate PASS; cfformat clean.

CI on ad9f64b45

CLEAN (24 checks, 0 failing). One transient first-run failure on Deploy CLI tests + verb smoke / CLI suite was the known Maven Central HTTP 429 on the sqlite-jdbc download (before any Wheels code ran); gh run rerun --failed passed and the final state is green. All engine legs (Lucee, Adobe 2023/2025, BoxLang, RustCFML) green.

…gerprint fallback

The D1 "warn once" spec asserted only that the flag was set, so a regression
that kept the flag but dropped the early return (back to a WriteLog per failure)
would still pass. Route the warning through an overridable
$errorEmailThrottleLogWarning() seam and have the spec mock it and count the
calls: three failures must produce exactly one warning. Verified by mutation:
removing the early return yields "Expected [1] Actual [3]" and the spec fails;
restoring it passes.

Also address the Windows note: when GetFileFromPath returns empty for a
normalized path, fall back to the last path segment (ListLast on "/") and then
"no-frame", never the full deployment path, so the same failure cannot split
across installs.

No throttle behaviour changes: fail-open, one warning per application, caps
accepting 0 as unlimited, and the window rejecting 0 are unchanged.

Signed-off-by: Peter Amiri <peter@alurium.com>
@bpamiri
bpamiri merged commit 5a61007 into develop Dec 1, 2026
28 of 30 checks passed
@bpamiri
bpamiri deleted the test/throttle-warn-count branch December 1, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant