FA-691 / Replication / Open access
Delete a write-ahead log segment: Garbage collection deletes a segment still accepting writes · case 01
The wal retention operation is admitted even though garbage collection deletes a segment still accepting writes.
ROOT CAUSE
The admission path omits the segment sealed invariant while validating the other operation preconditions.
VERIFIED REPAIR
Require r['segment_sealed'] is True together with every other stated precondition before accepting the operation.
Unsuccessful approach: Adding the segment sealed check repairs the reported defect, but replacing the adjacent recovery floor check loses that independent invariant.
Case contract
Return a Boolean admission decision for delete a write-ahead log segment. The record r must satisfy all of: r['slowest_replica'][0] < min(r['slowest_replica'][1]); r['backup_pin'][0] not in r['backup_pin'][1]; r['archive_confirmed'] is True; r['segment_sealed'] is True; r['recovery_floor'][0] < r['recovery_floor'][1]. Extra tracing fields are ignored; validation does not mutate the record.
Why this case matters
A deterministic local contract for replication. Each negative fixture violates exactly one invariant. No transport timing, persistence, cryptographic verification, or full protocol implementation is claimed.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(r):
return (r['slowest_replica'][0] < min(r['slowest_replica'][1])) and (r['backup_pin'][0] not in r['backup_pin'][1]) and (r['archive_confirmed'] is True) and (r['recovery_floor'][0] < r['recovery_floor'][1])
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {'slowest_replica': [9, [10, 12]], 'backup_pin': [9, [10, 11]], 'archive_confirmed': True, 'segment_sealed': True, 'recovery_floor': [7, 8]}
check('valid operation', solve(r), True)
check('Deletion removes the next segment needed by a lagging replica', solve(dict(r, **{'slowest_replica': [10, [10, 12]]})), False)
check('A backup still needs the selected log segment', solve(dict(r, **{'backup_pin': [10, [10, 11]]})), False)
check('The only recoverable copy is deleted before archival', solve(dict(r, **{'archive_confirmed': False})), False)
check('Garbage collection deletes a segment still accepting writes', solve(dict(r, **{'segment_sealed': False})), False)
check('Deletion crosses the crash recovery replay floor', solve(dict(r, **{'recovery_floor': [8, 8]})), False)
check('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)
check('repeat validation is pure', solve(r), True)
invalid = {'slowest_replica': [10, [10, 12]], 'backup_pin': [10, [10, 11]], 'archive_confirmed': False, 'segment_sealed': False, 'recovery_floor': [8, 8]}
keys = list(invalid)
pair = {keys[N % len(keys)]: invalid[keys[N % len(keys)]], keys[(N+1) % len(keys)]: invalid[keys[(N+1) % len(keys)]]}
check('two independent violations in variant', solve(dict(r, **pair)), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| valid operation | True | True | Passed |
| Deletion removes the next segment needed by a lagging replica | False | False | Passed |
| A backup still needs the selected log segment | False | False | Passed |
| The only recoverable copy is deleted before archival | False | False | Passed |
| Garbage collection deletes a segment still accepting writes | True | False | Failed |
| Deletion crosses the crash recovery replay floor | False | False | Passed |
| unrelated tracing metadata | True | True | Passed |
| repeat validation is pure | True | True | Passed |
| two independent violations in variant | False | False | Passed |
SHA-256 / 354752881f257bc8ae3114d2c6275f8c948835f2ab71bf72a7b728fbb59bc79a
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(r):
return (r['slowest_replica'][0] < min(r['slowest_replica'][1])) and (r['backup_pin'][0] not in r['backup_pin'][1]) and (r['archive_confirmed'] is True) and (r['segment_sealed'] is True)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {'slowest_replica': [9, [10, 12]], 'backup_pin': [9, [10, 11]], 'archive_confirmed': True, 'segment_sealed': True, 'recovery_floor': [7, 8]}
check('valid operation', solve(r), True)
check('Deletion removes the next segment needed by a lagging replica', solve(dict(r, **{'slowest_replica': [10, [10, 12]]})), False)
check('A backup still needs the selected log segment', solve(dict(r, **{'backup_pin': [10, [10, 11]]})), False)
check('The only recoverable copy is deleted before archival', solve(dict(r, **{'archive_confirmed': False})), False)
check('Garbage collection deletes a segment still accepting writes', solve(dict(r, **{'segment_sealed': False})), False)
check('Deletion crosses the crash recovery replay floor', solve(dict(r, **{'recovery_floor': [8, 8]})), False)
check('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)
check('repeat validation is pure', solve(r), True)
invalid = {'slowest_replica': [10, [10, 12]], 'backup_pin': [10, [10, 11]], 'archive_confirmed': False, 'segment_sealed': False, 'recovery_floor': [8, 8]}
keys = list(invalid)
pair = {keys[N % len(keys)]: invalid[keys[N % len(keys)]], keys[(N+1) % len(keys)]: invalid[keys[(N+1) % len(keys)]]}
check('two independent violations in variant', solve(dict(r, **pair)), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| valid operation | True | True | Passed |
| Deletion removes the next segment needed by a lagging replica | False | False | Passed |
| A backup still needs the selected log segment | False | False | Passed |
| The only recoverable copy is deleted before archival | False | False | Passed |
| Garbage collection deletes a segment still accepting writes | False | False | Passed |
| Deletion crosses the crash recovery replay floor | True | False | Failed |
| unrelated tracing metadata | True | True | Passed |
| repeat validation is pure | True | True | Passed |
| two independent violations in variant | False | False | Passed |
SHA-256 / e74eb975b262aa5a990e7dcc61a0dd63c07f405728de6bd7ef7edaea2a108ef5
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(r):
return (r['slowest_replica'][0] < min(r['slowest_replica'][1])) and (r['backup_pin'][0] not in r['backup_pin'][1]) and (r['archive_confirmed'] is True) and (r['segment_sealed'] is True) and (r['recovery_floor'][0] < r['recovery_floor'][1])
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {'slowest_replica': [9, [10, 12]], 'backup_pin': [9, [10, 11]], 'archive_confirmed': True, 'segment_sealed': True, 'recovery_floor': [7, 8]}
check('valid operation', solve(r), True)
check('Deletion removes the next segment needed by a lagging replica', solve(dict(r, **{'slowest_replica': [10, [10, 12]]})), False)
check('A backup still needs the selected log segment', solve(dict(r, **{'backup_pin': [10, [10, 11]]})), False)
check('The only recoverable copy is deleted before archival', solve(dict(r, **{'archive_confirmed': False})), False)
check('Garbage collection deletes a segment still accepting writes', solve(dict(r, **{'segment_sealed': False})), False)
check('Deletion crosses the crash recovery replay floor', solve(dict(r, **{'recovery_floor': [8, 8]})), False)
check('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)
check('repeat validation is pure', solve(r), True)
invalid = {'slowest_replica': [10, [10, 12]], 'backup_pin': [10, [10, 11]], 'archive_confirmed': False, 'segment_sealed': False, 'recovery_floor': [8, 8]}
keys = list(invalid)
pair = {keys[N % len(keys)]: invalid[keys[N % len(keys)]], keys[(N+1) % len(keys)]: invalid[keys[(N+1) % len(keys)]]}
check('two independent violations in variant', solve(dict(r, **pair)), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| valid operation | True | True | Passed |
| Deletion removes the next segment needed by a lagging replica | False | False | Passed |
| A backup still needs the selected log segment | False | False | Passed |
| The only recoverable copy is deleted before archival | False | False | Passed |
| Garbage collection deletes a segment still accepting writes | False | False | Passed |
| Deletion crosses the crash recovery replay floor | False | False | Passed |
| unrelated tracing metadata | True | True | Passed |
| repeat validation is pure | True | True | Passed |
| two independent violations in variant | False | False | Passed |
SHA-256 / 6409c47c634524496e8ce5493b9f7e6ad33bed4115ca9dc79df7814cd574c6dc
Verification & scope
This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:36:55.045733+00:00.
Case digest / d1cc411632672b5ef11eb92323cbc47c69235c2247e7368fc95d298509c94ca1