rehearsal-4: app side — brokerclient goes real, rent binds to the claim, release on reopen, heartbeat renews the TTL #648
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Blocks
Depends on
Reference
Matou/idss#648
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Arc: #183 rehearsal phase 4 — rented gateway (S4a). Spec:
docs/superpowers/specs/2026-08-21-183-phase-4-rented-gateway-rehearsal-design.md. Plan:docs/superpowers/plans/2026-08-21-183-phase-4-rented-gateway-rehearsal.md(read its Global Constraints first — they apply to this task). This ticket's body is the plan's task verbatim. Phase-3 precedent: #515–#523.Task 4: App side — real
brokerclientrent face, founding types, release on reopen, heartbeat renewFiles:
internal/founding/access.go(GatewayOffergainsTTL, Terms string;RentRequestbecomes{PubKey string}— Provider/Region/PaymentToken removed;RentResultgainsSSHUser, ServerID, Expires string;BrokerClientgainsRenewGateway(ctx, host, secret string) errorandReleaseGateway(ctx, host, secret string) error;Rent(ctx, req RentRequest, host, secret string)),RentServersignature staysRentServer(ctx, req RentRequest)— it reads host+secret from the draft's Address claim. Order change: rent needs the claim, so S4a must run AFTER S5's claim? No — ADR 0047/flow: S4a precedes S5. Resolution:RentServerclaims<slug>.idss.nzitself whend.Address == nilusingd.Details.Slug(the sameClaimSubdomainS5 would make; S5 then shows the already-claimed name as reserved). Record the claim on the draft exactly as S5 does (AddressChoice{Kind: AddressSubdomain, Host, Secret}).internal/brokerclient/client.go(OfferGETs/v1/gateways/offer;RentPOSTs/v1/gateways/rentwith bearer;RenewGateway,ReleaseGateway),client_test.go(retireTestClient_RentIsHonestlyUnavailableInAlpha; addTestClient_RentPostsPubKeyWithBearer,TestClient_RentProvisionErrorIsBrokerError,TestClient_OfferCarriesTermsNoPrice)internal/founding/testing/fakes.go(FakeBroker.Rentscripted:RentResultor*BrokerError; recordRenewGateway/ReleaseGatewaycalls)internal/founding/standup.goReopenAccess(when current Access isAccessRentedand a host+secret exist: callbroker.ReleaseGateway; recordAbandoned{Released: true}in the durable community state the DDR 0142 §4 marker already uses)internal/founding/access_test.go(rent happy path auto-fills IP + claims; rent failure leaves draft at S4 untouched; reopen-away releases)internal/heartbeat/heartbeat.go(Option WithRenewer(Renewer);Renewer interface{ Renew(ctx) error }; Tick calls it after a successful pass — failure logs + setsDetail, never changesState),heartbeat_test.go(renew called on every healthy tick; renew error does not flip state)control-plane/cmd/control-plane/main.goproductionAddressHeartbeat(whenIDSS_ACCESS_KIND=="rented"wireRenewerFunc(func(ctx) error { return client.RenewGateway(ctx, apex, secret) }));internal/clangateway facts exportIDSS_ACCESS_KIND(find whereIDSS_CLAIM_SECRETis exported —publicGatewayFacts→ the gateway env file — and add the kind beside it)app/src/lib/founding.tstypes (mirror Go),STATUS.mdInterfaces:
Consumes: Task 3's routes + bodies.
Produces:
founding.BrokerClientwithOffer/Rent/RenewGateway/ReleaseGateway/ClaimSubdomain/PointSubdomain/...;RentRequest{PubKey};RentResult{IP, Provider, Region, Price, SSHUser, ServerID, Expires};Draft.Access = {Kind: AccessRented, IP, Summary: "Rented gateway — <provider> · <region> · free while alpha · <ip>"}andDraft.Addressalready claimed afterRentServer.Step 1: Write the three
client_test.gotests (failing) with the existingdoerFuncharness: assert method/path/body{"host":..,"ssh_pubkey":..}andAuthorization: Bearer s; a 502{error, stage}→*founding.BrokerError{Stage:"provision"}; offer decode withPrice==""andTerms!="".Step 2: Run
go test ./internal/brokerclient -run 'Rent|Offer' -v→ FAIL.Step 3: Implement the client methods (reuse
postJSON; add agetJSON), delete the alpha test.Step 4: Run → PASS.
Step 5: Write the founding tests (failing):
TestRentServer_ClaimsNameThenRentsAndAutoFillsIP,TestRentServer_BrokerErrorLeavesDraftUntouched,TestReopenAccess_AwayFromRentedReleases.Step 6: Implement
RentServer(claim-if-needed →Rent(ctx, req, host, secret)→ set Access + advance),ReopenAccessrelease, fakes.Step 7: Run
go test ./internal/founding/...→ PASS.Step 8: Heartbeat renew — tests first (
TestTick_RenewsOnHealthyPass,TestTick_RenewFailureDoesNotFlipState), implement, wire in control-plane main + theIDSS_ACCESS_KINDfact export (add a seam assertion to the existing gateway-facts test that the env file carriesIDSS_ACCESS_KIND=rentedon a rented draft).Step 9: Run
go build ./... && go vet ./... && go test ./...→ PASS;gofmt -l .empty;pnpm -r typecheckPASS.Step 10: Commit —
git commit -m "rehearsal-4: brokerclient goes real — rent binds to the claim, pubkey in, release on reopen, heartbeat renews the TTL (#648)".swarm-claim host=elitebook-distributed-server-03 run=8634
(automated multi-host claim — lowest live claim id works this ticket)
close-report for #648 — status
success✅ close-report gates passed — every claim verified against main; closing.
envelope