Skip to content
This repository was archived by the owner on Apr 24, 2026. It is now read-only.

fix(kill_switch): expiry boundary off-by-one (>= → >)#155

Open
levleontiev wants to merge 2 commits into
mainfrom
fix/kill-switch-expiry-boundary
Open

fix(kill_switch): expiry boundary off-by-one (>= → >)#155
levleontiev wants to merge 2 commits into
mainfrom
fix/kill-switch-expiry-boundary

Conversation

@levleontiev
Copy link
Copy Markdown
Contributor

Bug

Line 124 of src/fairvisor/kill_switch.lua used >= when comparing against the current time:

if expires_epoch == nil or expires_epoch >= now then

This keeps a kill switch active at the exact expiry second, contrary to standard expiry semantics (JWT exp, HTTP cookies, ISO 8601 intervals) where the expiry timestamp is the first moment the resource is no longer valid.

Fix

Change >= to >:

if expires_epoch == nil or expires_epoch > now then

Tests

Added AC-13 to spec/unit/features/kill_switch.feature:

expires_at == nowresult is not matched

Existing AC-5 (1s after expiry → not matched) and AC-6 (1s before → matched) continue to pass.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant