Operational Remediation Reports
Guard Flag Remediation Report
Turn the number of waiters behind a held guard flag into an enter, backoff, or page remediation action.
guard contention
The waiter count behind a held guard flag is kept as a scalar, so the remediation action stays deterministic and never depends on table or closure identity.
Guard Flag Remediation Report
guard_flag.lua
Replay: real traced execution (multi-file project)
local waiters = 0
local guard_limit = 2
local acquired = 1
local action = "enter"
if waiters >= 1 and waiters <= guard_limit then
action = "backoff"
elseif waiters > guard_limit then
action = "page"
end
print("waiters=" .. waiters .. " acquired=" .. acquired .. " " .. action)
local waiters = 1
local guard_limit = 2
local acquired = 1
local action = "enter"
if waiters >= 1 and waiters <= guard_limit then
action = "backoff"
elseif waiters > guard_limit then
action = "page"
end
print("waiters=" .. waiters .. " acquired=" .. acquired .. " " .. action)
local waiters = 3
local guard_limit = 2
local acquired = 1
local action = "enter"
if waiters >= 1 and waiters <= guard_limit then
action = "backoff"
elseif waiters > guard_limit then
action = "page"
end
print("waiters=" .. waiters .. " acquired=" .. acquired .. " " .. action)
waiters ← 0, guard_limit ← 2, acquired ← 1, action ← enter
1local waiters→ 0 = 0 --@waiters=1, 32local guard_limit→ 2 = 23local acquired→ 1 = 145local action→ enter = "enter"6if waiters >= 1 and waiters <= guard_limit then7 action = "backoff"8elseif waiters > guard_limit then9 action = "page"10end1112print("waiters=" .. waiters0 .. " acquired=" .. acquired1 .. " " .. actionenter)outputwaiters=0 acquired=1 enter
waiters ← 1, guard_limit ← 2, acquired ← 1, action ← enter
1local waiters→ 1 = 12local guard_limit→ 2 = 23local acquired→ 1 = 145local action→ enter = "enter"6if waiters >= 1 and waiters <= guard_limit thenaction ← backoff
5local action = "enter"6if waiters1 >= 1 and waiters <= guard_limit2 then7 action→ backoff = "backoff"8elseif waiters > guard_limit thenprint("waiters=" .. waiters .. " acquired=" .. acquired .. " " .. acti…
12print("waiters=" .. waiters1 .. " acquired=" .. acquired1 .. " " .. actionbackoff)outputwaiters=1 acquired=1 backoff
waiters ← 3, guard_limit ← 2, acquired ← 1, action ← enter
1local waiters→ 3 = 32local guard_limit→ 2 = 23local acquired→ 1 = 145local action→ enter = "enter"6if waiters >= 1 and waiters <= guard_limit thenaction ← page
7 action = "backoff"8elseif waiters3 > guard_limit2 then9 action→ page = "page"10endprint("waiters=" .. waiters .. " acquired=" .. acquired .. " " .. acti…
12print("waiters=" .. waiters3 .. " acquired=" .. acquired1 .. " " .. actionpage)outputwaiters=3 acquired=1 page