Skip to content
This repository was archived by the owner on Apr 24, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions spec/unit/features/kill_switch.feature
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@ Feature: Kill-switch enforcement
When I check kill switches
Then result is matched with kill_switch reason

Scenario: AC-13 Kill-switch is inactive at exact expiry epoch (boundary)
Given the nginx mock environment is reset
And kill switches include scope "jwt:org_id" value "org_xyz" expiring at "2026-02-03T14:00:00Z"
And descriptors include "jwt:org_id" as "org_xyz"
And the route is "/v1/inference"
And the current time is ISO "2026-02-03T14:00:00Z"
When I validate kill switches
Then validation succeeds
And the kill switch has cached expiry epoch
When I check kill switches
Then result is not matched

Rule: Validation
Scenario: AC-11 Validation rejects invalid scope_key format
Given kill switches include scope "invalid_format" value "org_xyz"
Expand Down Expand Up @@ -148,3 +160,4 @@ Feature: Kill-switch enforcement
Scenario: Reject impossible calendar date
When I parse timestamp "2026-02-30T14:00:00Z"
Then parsed epoch is nil

3 changes: 2 additions & 1 deletion src/fairvisor/kill_switch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function _M.check(kill_switches, descriptors, route, now)
end
end

if expires_epoch == nil or expires_epoch >= now then
if expires_epoch == nil or expires_epoch > now then
local scope_value = descriptors and descriptors[kill_switch.scope_key]
if scope_value ~= nil and scope_value == kill_switch.scope_value then
if kill_switch.route == nil or kill_switch.route == route then
Expand All @@ -141,3 +141,4 @@ function _M.check(kill_switches, descriptors, route, now)
end

return _M

Loading