← Back to list
01Issue
BugShippedSwamp CLIPublic
Assigneesstack72
Relationships
#3375 v3 writer lease: a stray or unpadded fence key under _control/writer/ wedges the lease
Opened by stack72 · 10/13/2026· Shipped 10/13/2026
Problem
The v3 writer lease (swamp-club#3359, PR #3066) reads its records under _control/writer/. parseWriterLeaseKey in src/domain/datastore_v3/writer_lease.ts accepts a fence of any number of digits, but fenceKey() refuses one above MAX_FENCE (10^12 - 1).
- A stray key wedges the lease. A file such as
_control/writer/fence-1000000000000, whether stray, hand-made, or copied into a shared datastore, makesreadWriterLeaseRecordsthrow a genericError. Everyacquire,inspect,swamp datastore lock statusandswamp datastore lock release --forcethen fails, and no swamp command can clear it. Only deleting the file by hand recovers. - Unpadded keys alias padded ones.
fence-5andfence-000000000005parse to the same fence but are different keys, soputIfAbsenton one does not exclude the other.
swamp itself only ever writes 12-digit, in-range keys, so this needs a key it did not write. It was found by CI's adversarial review on PR #3066 (Medium).
Fix
In parseWriterLeaseKey, accept only keys of exactly FENCE_DIGITS (12) digits whose fence is between 1 and MAX_FENCE. Any other key is ignored, as unrelated keys already are.
Tests
- Out-of-range key ignored. A
fence-1000000000000file is ignored: acquire takes the next fence after the real highest one, andlock statusandlock release --forcestill work. - Unpadded key ignored. A
fence-5file neither counts as fence 5 nor blocks the realfence-000000000005. - Run on both stores. Both cases run on the filesystem and in-memory remote stores in
writer_lease_adapters_test.ts.
02Bog Flow
Shipped
Click a lifecycle step above to view its details.
03Sludge Pulse
Sign in to post a ripple.