Concurrency Coordination Reports
Actor Counter Coordination Report
Record serialized increments against one owned counter and report the deterministic final count.
actor-serialized count
A coordination report can record state that an actor would keep consistent. An `actor` owns its counter and applies each `bump` one at a time so the updates never interleave, leaving a single deterministic total. This report models that guarantee with one owned `count` updated through a single `bump` step per loop iteration, since the trace bridge cannot instrument the body of an `actor` type cleanly; the scalar model keeps the same serialized, replay-safe behavior. With no updates the counter stays idle, with a few updates it is still counting, and once the count reaches the threshold it is reported as settled. The status line summarizes the mode while the count confirms the serialized total.
Actor Counter Coordination Report
actor_counter_coordination_report.swift
Replay: real traced execution (multi-file project)
func bump(_ current: Int, by amount: Int) -> Int {
return current + amount
}
let updates = 1
let step = 2
var count = 0
for _ in 0..<updates {
count = bump(count, by: step)
}
var status = "counting"
if updates == 0 {
status = "idle"
}
if count >= 6 {
status = "settled"
}
let line = "updates=\(updates) count=\(count) \(status)"
print(line)
func bump(_ current: Int, by amount: Int) -> Int {
return current + amount
}
let updates = 0
let step = 2
var count = 0
for _ in 0..<updates {
count = bump(count, by: step)
}
var status = "counting"
if updates == 0 {
status = "idle"
}
if count >= 6 {
status = "settled"
}
let line = "updates=\(updates) count=\(count) \(status)"
print(line)
func bump(_ current: Int, by amount: Int) -> Int {
return current + amount
}
let updates = 3
let step = 2
var count = 0
for _ in 0..<updates {
count = bump(count, by: step)
}
var status = "counting"
if updates == 0 {
status = "idle"
}
if count >= 6 {
status = "settled"
}
let line = "updates=\(updates) count=\(count) \(status)"
print(line)
updates ← 1, step ← 2, count ← 0
5let updates→ 1 = 1 //@updates=0, 36let step→ 2 = 27var count→ 0 = 0for _ in 0..<updates
9for _ in 0..<updates1 {10 count = bump(count0, by: step2)11}func bump(_ current: Int, by amount: Int) -> Int
1func bump(_ current0: Int, by amount2: Int) -> Int {2 return current0 + amount23}count ← 2
9for _ in 0..<updates {10 count→ 2 = bump(count, by: step2)11}status ← counting, line ← updates=1 count=2 counting
13var status→ counting = "counting"14if updates == 0 {15 status = "idle"16}17if count >= 6 {18 status = "settled"19}2021let line→ updates=1 count=2 counting = "updates=\(updates1) count=\(count2) \(statuscounting)"2223print(lineupdates=1 count=2 counting)outputupdates=1 count=2 counting
updates ← 0, step ← 2, count ← 0, status ← counting
5let updates→ 0 = 06let step→ 2 = 27var count→ 0 = 089for _ in 0..<updates {10 count = bump(count, by: step)11}1213var status→ counting = "counting"14if updates == 0 {if updates == 0
13var status = "counting"14if updates0 == 0 {15 status = "idle"16}line ← updates=0 count=0 idle
21let line→ updates=0 count=0 idle = "updates=\(updates0) count=\(count0) \(statusidle)"2223print(lineupdates=0 count=0 idle)outputupdates=0 count=0 idle
updates ← 3, step ← 2, count ← 0
5let updates→ 3 = 36let step→ 2 = 27var count→ 0 = 0for _ in 0..<updates
pass 1 of 39for _ in 0..<updates3 {10 count = bump(count0, by: step2)11}All 3 passes — pass 1 is the card above pass count1 0 2 2 3 4 func bump(_ current: Int, by amount: Int) -> Int
pass 1 of 31func bump(_ current0: Int, by amount2: Int) -> Int {2 return current0 + amount23}All 3 passes — pass 1 is the card above pass current1 0 2 2 3 4 count ← 2
9for _ in 0..<updates {10 count→ 2 = bump(count, by: step2)11}count ← 4
9for _ in 0..<updates {10 count→ 4 = bump(count, by: step2)11}count ← 6
9for _ in 0..<updates {10 count→ 6 = bump(count, by: step2)11}status ← counting
13var status→ counting = "counting"14if updates == 0 {if count >= 6
16}17if count6 >= 6 {18 status = "settled"19}line ← updates=3 count=6 settled
21let line→ updates=3 count=6 settled = "updates=\(updates3) count=\(count6) \(statussettled)"2223print(lineupdates=3 count=6 settled)outputupdates=3 count=6 settled