Skip to main content
← 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, makes readWriterLeaseRecords throw a generic Error. Every acquire, inspect, swamp datastore lock status and swamp datastore lock release --force then fails, and no swamp command can clear it. Only deleting the file by hand recovers.
  • Unpadded keys alias padded ones. fence-5 and fence-000000000005 parse to the same fence but are different keys, so putIfAbsent on 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-1000000000000 file is ignored: acquire takes the next fence after the real highest one, and lock status and lock release --force still work.
  • Unpadded key ignored. A fence-5 file neither counts as fence 5 nor blocks the real fence-000000000005.
  • Run on both stores. Both cases run on the filesystem and in-memory remote stores in writer_lease_adapters_test.ts.
02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 5 MOREREVIEW+ 7 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

10/13/2026, 10:08:09 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack7210/13/2026, 7:57:59 PM

Sign in to post a ripple.