Operational Remediation Reports
Once Do Remediation Report
Apply at most one idempotent write and turn the accepted and skipped counts into a commit, skip, or retry remediation action.
idempotent write
Only the first write is accepted and later writes are counted as skipped, so the remediation action is reproducible without a live one-shot guard.
Once Do Remediation Report
once_do_remediation_report.go
Replay: real traced execution (multi-file project)
package main
import "fmt"
func main() {
var writes = 1
accepted := 0
skipped := 0
for i := 0; i < writes; i++ {
if accepted == 0 {
accepted++
} else {
skipped++
}
}
var action string
if accepted == 0 {
action = "retry"
} else if skipped > 0 {
action = "skip"
} else {
action = "commit"
}
fmt.Printf("writes=%d accepted=%d skipped=%d %s\n", writes, accepted, skipped, action)
}
package main
import "fmt"
func main() {
var writes = 0
accepted := 0
skipped := 0
for i := 0; i < writes; i++ {
if accepted == 0 {
accepted++
} else {
skipped++
}
}
var action string
if accepted == 0 {
action = "retry"
} else if skipped > 0 {
action = "skip"
} else {
action = "commit"
}
fmt.Printf("writes=%d accepted=%d skipped=%d %s\n", writes, accepted, skipped, action)
}
package main
import "fmt"
func main() {
var writes = 2
accepted := 0
skipped := 0
for i := 0; i < writes; i++ {
if accepted == 0 {
accepted++
} else {
skipped++
}
}
var action string
if accepted == 0 {
action = "retry"
} else if skipped > 0 {
action = "skip"
} else {
action = "commit"
}
fmt.Printf("writes=%d accepted=%d skipped=%d %s\n", writes, accepted, skipped, action)
}
writes ← 1, accepted ← 0, skipped ← 0
5func main() {6 var writes→ 1 = 1 //@writes=2, 07 accepted→ 0 := 08 skipped→ 0 := 09 for i := 0; i < writes; i++ {for i := 0; i < writes; i++
8skipped := 09for i0 := 0; i < writes1; i++ {10 if accepted == 0 {accepted ← 1
9for i := 0; i < writes; i++ {10 if accepted0 == 0 {11 accepted→ 1++12 } else {action ← ""
15}16var action→ "" string17if accepted == 0 {action ← "commit"
20 action = "skip"21} else {22 action→ "commit" = "commit"23}fmt.Printf("writes=%d accepted=%d skipped=%d %s ", writes, accepted, s…
23 }24 fmt.Printf("writes=%d accepted=%d skipped=%d %s\n", writes1, accepted1, skipped0, action"commit")25}outputwrites=1 accepted=1 skipped=0 commit
writes ← 0, accepted ← 0, skipped ← 0, action ← ""
5func main() {6 var writes→ 0 = 07 accepted→ 0 := 08 skipped→ 0 := 09 for i := 0; i < writes; i++ {10 if accepted == 0 {11 accepted++12 } else {13 skipped++14 }15 }16 var action→ "" string17 if accepted == 0 {action ← "retry"
16var action string17if accepted0 == 0 {18 action→ "retry" = "retry"19} else if skipped > 0 {fmt.Printf("writes=%d accepted=%d skipped=%d %s ", writes, accepted, s…
23 }24 fmt.Printf("writes=%d accepted=%d skipped=%d %s\n", writes0, accepted0, skipped0, action"retry")25}outputwrites=0 accepted=0 skipped=0 retry
writes ← 2, accepted ← 0, skipped ← 0
5func main() {6 var writes→ 2 = 27 accepted→ 0 := 08 skipped→ 0 := 09 for i := 0; i < writes; i++ {for i := 0; i < writes; i++
pass 1 of 28skipped := 09for i0 := 0; i < writes2; i++ {10 if accepted == 0 {accepted ← 1
9for i := 0; i < writes; i++ {10 if accepted0 == 0 {11 accepted→ 1++12 } else {for i := 0; i < writes; i++
pass 2 of 28skipped := 09for i1 := 0; i < writes2; i++ {10 if accepted == 0 {skipped ← 1
11 accepted++12} else {13 skipped→ 1++14}action ← ""
15}16var action→ "" string17if accepted == 0 {action ← "skip"
18 action = "retry"19} else if skipped1 > 0 {20 action→ "skip" = "skip"21} else {fmt.Printf("writes=%d accepted=%d skipped=%d %s ", writes, accepted, s…
23 }24 fmt.Printf("writes=%d accepted=%d skipped=%d %s\n", writes2, accepted1, skipped1, action"skip")25}outputwrites=2 accepted=1 skipped=1 skip