carlos / platform Public

region HA: take test counts the take's lock requests, not replication's

TestTakeTheNamedMarker failed on CI (736908c8) with "LIST <host>/0009/"
after the lock's GET and PUT. Those listings are litestream's compaction
and snapshot monitors, which the woken replica's store starts in its own
goroutines; each lists its level once, whenever it is scheduled. They are
not the take, not a restore and not a lock read: they land before or after
the assertion depending on the scheduler (9 of 20 local runs failed).

lockReqs counted every LIST under the host's prefix. It now drops the
replica's level listings, as the wake budget test already does
(wakePathRequests, harelease_test.go), so the take's budget is exactly
the acquire's 1 GET + 1 PUT (spec 25.10). The second take's "no store
request" check drops them the same way; it flaked for the same reason.
No production code changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 68b459f1ead8e3f36c993c4b3ba7ee32275c7bc7 parent 887f204
1 file changed, +12 −6
  • internal/activator/hatake_test.go +12 −6

Intent

Human

<task-notification> <task-id>a480ce66c5cf08171</task-id> <tool-use-id>toolu_01XLMjcLRUXvYyVKAfjy53Xo</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/283be278-5c6a-4a71-a8d6-b3d32c668985/tasks/a480ce66c5cf08171.output</output-file> <status>completed</status> <summary>Agent "Implement Task 8: integration+spec" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Status: DONE (fix round 1). All three findings are addressed with test-only changes. Commit: `887f2042`, on top of `cc8c08a1`, `1a1c585e`, `9ec7c79c` and `736908c8`. - **P2-1:** the witness now has a real born-HA worker, provisioned by the records pass and woken on A by the duty rule. No child process was needed: an HA worker starts through root's control seam, as the activator's own HA worker tests do. The drain releases it with a clean marker naming A, the report lists it as a released worker, it is never begun or taken, and B never starts it. - **P2-2:** the sleeps are gone. The test waits until the direct request and the replayable hop are both observed holding at A. Each hold then ends taken, naming B, and the hop is replayed once to B. The lost-lease test waits on its hold and on the move being left. - **P3:** the driver's calls are checked as ordered sequences, each line exactly once, seven calls in all. Tests: both witnesses at `-race -count=10`, three runs, 60 of 60 pass with no races. Six of seven mutations are caught, including a new one where client requests skip the hold. The loss-latch mutation survives as an equivalent mutant, as in round 1. The census is unchanged. gofmt and vet are clean. Concerns: 1. An HA worker must be the hibernate-flagged kind, because the registry only keeps duties for that shape. So the witness's worker is that kind, not literally "always-on". 2. The connection-drain server registration is still not exercised. 3. The HA acquire still uses one identity per process. 4. Other processes' git lock warnings continue; the commits land. Report (fix round appended): /home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-held-build/.superpowers/sdd/2026-11-08-region-ha-held-requests/task-8-report.md</result> <usage><subagent_tokens>494644</subagent_tokens><tool_uses>41</tool_uses><duration_ms>2215069</duration_ms></usage> </task-notification>

Attributed to this commit: 8.41 g CO₂e (1,079,199 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on region-ha-held-build, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/internal/activator/hatake_test.go b/internal/activator/hatake_test.go
index 9daf14cc1..0a5ee7532 100644
--- a/internal/activator/hatake_test.go
+++ b/internal/activator/hatake_test.go
@@ -41,10 +41,13 @@ func heldLock(t *testing.T, owner string, gen int64, expires time.Time) []byte {
return body
}
-// lockReqs is every fixture request about s's host's lock, in order.
+// lockReqs is every fixture request about s's host's lock, in order: its
+// reads and writes and any listing of the host's prefix, but not the
+// replica's level listings, which are replication's requests and land
+// whenever the store's monitors are scheduled (wakePathRequests).
func (s *haSvc) lockReqs() []string {
var out []string
- for _, r := range s.fx.Requests() {
+ for _, r := range s.wakePathRequests(s.fx.Requests()) {
if strings.HasSuffix(r, " "+lockKeyOf(s.b, s.rt)) || strings.HasPrefix(r, "LIST "+s.b.Cfg.hibernatePrefix(s.rt.Host)) {
out = append(out, r)
}
@@ -72,7 +75,8 @@ func (s *haSvc) lifetime() string { return haFixOf(s.b).lifetime }
// The marker the take names: this box acquires it through the HA acquire,
// wakes the host, and names itself at the generation it wrote. One take
-// costs exactly one lock GET and one conditional PUT, and no record read.
+// costs exactly one lock GET and one conditional PUT, and no record read
+// (§25.10); the woken replica's own level listings are replication's.
func TestTakeTheNamedMarker(t *testing.T) {
s := haService(t, "shop.example.com")
putLockFor(t, s.b, s.rt, takeMarker(t, s.lifetime(), 6))
@@ -116,12 +120,14 @@ func TestTakeTheNamedMarker(t *testing.T) {
s.a.mu.Unlock()
clk := &fakeClock{t: time.Now().Add(time.Hour)}
s.a.now = clk.now
- before := len(s.fx.Requests())
+ // The replica's level listings may land in this window too: they are
+ // replication's, not the take's (wakePathRequests).
+ before := len(s.wakePathRequests(s.fx.Requests()))
if again := s.a.TakeHost(context.Background(), s.rt, s.lifetime(), 6); again != ans {
t.Fatalf("a second take: %+v, want %+v", again, ans)
}
- if n := len(s.fx.Requests()) - before; n != 0 {
- t.Fatalf("a second take made %d store requests, want 0", n)
+ if got := s.wakePathRequests(s.fx.Requests())[before:]; len(got) != 0 {
+ t.Fatalf("a second take made store requests %v, want none", got)
}
s.a.mu.Lock()
after := e.lastActive