Operational Remediation Reports
Sized Queue Capacity Remediation Report
Admit offered work against a fixed capacity and turn the remaining slots into an admit, hold, or shed remediation action.
remaining capacity
The fixed capacity is modeled with a scalar counter, so the remaining slots stay deterministic and free of object identity while driving the remediation action.
Sized Queue Capacity Remediation Report
sized_queue_capacity_remediation_report.rb
Replay: real traced execution (multi-file project)
offered = 1
capacity = 3
accepted = 0
offered.times do
accepted += 1 if accepted < capacity
end
remaining = capacity - accepted
action = if remaining >= 2
"admit"
elsif remaining == 1
"hold"
else
"shed"
end
puts "offered=#{offered}"
puts "accepted=#{accepted}"
puts "remaining=#{remaining}"
puts "action=#{action}"
offered = 2
capacity = 3
accepted = 0
offered.times do
accepted += 1 if accepted < capacity
end
remaining = capacity - accepted
action = if remaining >= 2
"admit"
elsif remaining == 1
"hold"
else
"shed"
end
puts "offered=#{offered}"
puts "accepted=#{accepted}"
puts "remaining=#{remaining}"
puts "action=#{action}"
offered = 4
capacity = 3
accepted = 0
offered.times do
accepted += 1 if accepted < capacity
end
remaining = capacity - accepted
action = if remaining >= 2
"admit"
elsif remaining == 1
"hold"
else
"shed"
end
puts "offered=#{offered}"
puts "accepted=#{accepted}"
puts "remaining=#{remaining}"
puts "action=#{action}"
offered ← 1, capacity ← 3, accepted ← 0
1offered→ 1 = 1 #@offered=2, 42capacity→ 3 = 33accepted→ 0 = 045offered1.times do6 accepted += 1 if accepted < capacity7enddo
5offered1.times do6 accepted0 += 1 if accepted < capacity37endremaining ← 2, action ← admit
9remaining→ 2 = capacity3 - accepted11011action→ admit = if remaining2 >= 212 "admit"13elsif remaining2 == 114 "hold"15else16 "shed"17end1819puts "offered=#{offered1}"20puts "accepted=#{accepted1}"21puts "remaining=#{remaining2}"22puts "action=#{actionadmit}"outputoffered=1 accepted=1 remaining=2 action=admit
offered ← 2, capacity ← 3, accepted ← 0
1offered→ 2 = 22capacity→ 3 = 33accepted→ 0 = 045offered2.times do6 accepted += 1 if accepted < capacity7enddo
pass 1 of 25offered.times do6 accepted0 += 1 if accepted < capacity37enddo
pass 2 of 25offered2.times do6 accepted1 += 1 if accepted < capacity37endremaining ← 1, action ← hold
9remaining→ 1 = capacity3 - accepted21011action→ hold = if remaining1 >= 212 "admit"13elsif remaining1 == 114 "hold"15else16 "shed"17end1819puts "offered=#{offered2}"20puts "accepted=#{accepted2}"21puts "remaining=#{remaining1}"22puts "action=#{actionhold}"outputoffered=2 accepted=2 remaining=1 action=hold
offered ← 4, capacity ← 3, accepted ← 0
1offered→ 4 = 42capacity→ 3 = 33accepted→ 0 = 045offered4.times do6 accepted += 1 if accepted < capacity7enddo
pass 1 of 45offered.times do6 accepted0 += 1 if accepted < capacity37endAll 4 passes — pass 1 is the card above pass acceptedoffered1 0 — 2 1 — 3 2 — 4 3 4 remaining ← 0, action ← shed
9remaining→ 0 = capacity3 - accepted31011action→ shed = if remaining0 >= 212 "admit"13elsif remaining0 == 114 "hold"15else16 "shed"17end1819puts "offered=#{offered4}"20puts "accepted=#{accepted3}"21puts "remaining=#{remaining0}"22puts "action=#{actionshed}"outputoffered=4 accepted=3 remaining=0 action=shed