broker + Go: the gateway offer carries its REGIONS and the rent honours the operator's pick — v2 founding's region picker has no live half #1375
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.
Dependencies
No dependencies set.
Reference
Matou/idss#1375
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?
The v2 founding page now lets the operator choose the rented gateway's region
(commit
e01c349a, Ben's ruling 2026-09-10: "i want the sydney option to be acoloured outlined box and i want to be able to click on it and choose the
location based on digital ocean droplet location options"). The renderer half is
built and the seam carries it. The Go and broker halves do not exist, so the
control is real only against the in-memory fake.
This ticket builds the live half.
What exists today (renderer only)
app/src/lib/founding.ts—RegionOption{slug,label},GatewayOffer.regions?: RegionOption[],RentRequest.region?: string;FakeFoundingClientoffersDigitalOcean's droplet regions and folds the pick into the Access summary.
app/src/components/founding/FoundingAccess.vue— S4a's read-only region spanbecame an accent-outlined
<select data-field="region" data-action="region">.It renders only when
offer.regionsis non-empty, so against a live broker(which sends no
regions) the screen falls back to today's read-only fact andnothing pretends to be choosable. That guard is deliberate and should stay.
What is missing
internal/founding/access.go—GatewayOfferhasRegion stringand noRegions;RentRequestis{PubKey}only, and its doc says outright"provider/region are the broker's own offer data, not chosen here".
internal/brokerclient/client.go—Offerdecodes the broker's offerJSON,
RentPOSTs{host, ssh_pubkey}. Neither carries a region.broker/internal/broker/rentals.go—Offer()returnsRegion: r.cfg.Region, a single string;Rentprovisions withRegion: r.cfg.Region(three sites: ~207, ~287, ~314).broker/internal/broker/http.go—GET /v1/gateways/offerreturns oneregion;POST /v1/gateways/rentaccepts{host, ssh_pubkey}only.broker/cmd/broker/main.go:102—Region: envOr("IDSS_GATEWAY_REGION", "syd1")is the whole region story on the deployed broker.
So today a live rent always lands in
syd1regardless of what the operator picks.The load-bearing constraint — DO snapshots are REGION-SCOPED
DigitalOcean.LatestImageIDresolves the newestidss-gateway-*snapshot,and
doSnapshot(provider_do.go:592) decodes only{id, name, created_at}. DOsnapshots exist only in the regions they have been transferred to; a droplet
create naming a snapshot absent from the target region fails with a 422 at
POST /v2/droplets— and per ADR 0047's no-half-rented invariant that surfacesas a
provision-stageBrokerErrorafter the operator has already committed.A region list the golden image cannot honour is worse than no picker. So the
offer's region list MUST be derived, not configured by hand:
which means
doSnapshotalso has to decoderegions []string. Expect the firsthonest answer to be one region (
syd1) until the image is transferred —which is fine and correct: the picker then simply does not render, exactly as the
renderer's guard intends. Getting the snapshot into more regions (a transfer step
in
scripts/gateway-image/build.sh, or a broker-side transfer-on-demand) isout of scope here and should be its own ticket once this one proves the wire.
Work
Broker (
broker/)doSnapshotdecodesregions []string;LatestImageIDreturns the idand its regions (or a sibling method does).
Providergains a regions lookup over DO/v2/regions(idempotent GET —use
doRetry, notdo).Rentals.Offer()returnsRegions []Region{Slug,Label}— the intersectionabove — alongside the existing
Region(which stays as the default/preselect).Rentals.Rentaccepts an optional region, validates it against that sameintersection (an unknown or untransferred slug is a loud
claim-stagerefusal, never a silent fall back to
cfg.Region), and passes it toCreateRequest.Region; the rental record +RentalRecord.Regionstore whatwas actually provisioned, not
cfg.Region.GET /v1/gateways/offergainsregions: [{slug,label}];POST /v1/gateways/rentaccepts an optionalregion.rentals_test.go/http_rent_test.go,including the refusal path and the empty-list (single-region) case.
App Go (
internal/)founding.GatewayOffergainsRegions []RegionOption;RegionOption{Slug,Label}.founding.RentRequestgainsRegion string; its doc comment is corrected(it currently states the opposite).
brokerclient.Offerdecodesregions;brokerclient.Rentsendsregion.Orchestrator.RentServerpasses it through; the Access summary line alreadyrenders
res.Region(access.go:449), which is now the chosen one.internal/founding/testing/fakes.gomirrors the new fields so the seamtests can drive a pick.
internal/founding/stdio.goneeds no new op —rent-serveralready carriesthe whole
RentRequest.Docs
s-2vcpu-4gb, regionsyd1… offered as
GatewayOfferdata". Region becomes an offer list theoperator picks from; preset stays broker data.
region". Provider stays read-only (ADR 0048: DigitalOcean only); region
becomes the one choosable offer fact. Note the intersection rule as the
reason the list is sometimes a list of one.
STATUS.mdin the same commit.docs/GOTCHAS.mdentry for the snapshot-region 422 if the build hits it.Acceptance
carries a single-entry (or empty)
regionsand S4a shows the read-only fact —no picker, no behaviour change from today.
preselects the broker's own
region, and a rent provisions the droplet in thechosen region — the Access summary and the rental record both state it.
claimstage with a plain-language message; no droplet is created (ADR 0047).
go test ./...green in both trees;internal/brokerclientround-trip testpins the new wire fields.
Out of scope
e01c349a.Notes for whoever picks this up
broker/**is a deployed-service tree — once this lands on main it wantsdeploy-pendinguntil the installed sha carries it.rehearsal-rentfailhonesty leg must keep working unchanged.Ruled by agent under ADR 0174 — veto anytime.
Triage outcome —
enhancement+ready-for-agentCodebase verification (not already implemented; claim holds — with one correction)
Confirmed the Go + broker half genuinely does not exist, exactly as the ticket states:
internal/founding/access.go:114—GatewayOffer{… Region string …}, noRegions;RentRequest(:134) is{PubKey}only.internal/brokerclient/client.go:116—RentPOSTs{host, ssh_pubkey};Offerdecodes a singleregion.broker/internal/broker/rentals.go—Offer()(:203) returnsRegion: r.cfg.Region;Rentprovisions withcfg.Regionat ~:287/:314.broker/cmd/broker/main.go:102—Region: envOr("IDSS_GATEWAY_REGION", "syd1").broker/internal/broker/provider_do.go:593—doSnapshotdecodes only{id,name,created_at}, noregions.CreateRequest.Regionalready exists (broker/internal/broker/provider.go:30), so the rent path has a slot to fill. ADR 0189 and DDR 0190 both exist and are the correct amendment targets. No.out-of-scope/prior rejection resembles this.⚠️ One correction to the ticket's premise — flag, not a blocker
The ticket says "The renderer half is built and the seam carries it … The renderer: already landed in
e01c349a." That commit does not exist in this repository —git cat-file -t e01c349afails, no branch contains it, and history has never held aRegionOptiontype or a region<select>. Onmain(32f7db2a)FoundingAccess.vuestill renders the read-only region span (lines 63–69, still citing the pre-amendment ADR 0189/DDR 0190), andapp/src/lib/founding.ts:153carries a singleregion: string. The renderer half is almost certainly sitting unpushed on Ben's machine (ticket authored the same day).Ruled a non-blocker for this ticket. The Work this ticket defines is the Go tree (
internal/) + the broker tree (broker/); neither imports the TypeScript renderer, and the Go-side seam tests (internal/founding/testing/fakes.go) are self-contained Go. The wire is provable end-to-end without the renderer, and AC1's guard means the missing UI is safe: with noregionson the wire, S4a falls back to the read-only fact and nothing pretends to be choosable. Follow-up owed: confirme01c349areachesmain(or file the renderer as its own ticket) before the picker can actually render live — but that does not gate the backend wire.Why this is a two-way door (ADR 0174)
The whole defined scope is revertible by a later commit and provable by an existing/new test:
claim-stage refusal, no droplet), and AC4 (go test ./...both trees + theinternal/brokerclientround-trip) are unit-provable with the fakedProvider.CreateRequest.Regionand intoRentalRecord.Region) is provable with a request-recording fake. Only the live multi-region droplet is unprovable now — and the ticket already scopes the snapshot transfer out until its own ticket, so the honest answer stays a single-region (syd1) offer.None of the one-way-door residue is touched: no personal credentials, no security-posture widening (the region intersection only narrows what can be provisioned), no member-facing trust accept, no data destruction, no non-routine spend (all DO calls sit behind the
Providerseam and are faked; no droplet is created in the buildable/provable scope). So a swarm worker can land and prove this without any live-infrastructure standing — henceready-for-agent, notready-for-session.Agent brief
Goal: build the live Go + broker half of the S4a region picker so a rent honours the operator's chosen region, derived from what the golden snapshot can actually serve. The full checklist, the load-bearing snapshot-region constraint, the intersection rule, and the acceptance criteria are in the issue body — follow them verbatim. Highlights:
doSnapshotto decoderegions []string; haveLatestImageID(or a sibling) return the snapshot's regions; add a DO/v2/regionslookup viadoRetry(idempotent GET, notdo);Offer()returns the intersection (available:true∩ snapshot regions) asRegions []Region{Slug,Label}whileRegionstays the preselect;Rentaccepts an optional region, validates it against that same intersection (unknown/untransferred slug → loudclaim-stage refusal, never a silent fall back tocfg.Region), passes it toCreateRequest.Region, and stores the actual provisioned region onRentalRecord. Cover offer/rent/validation + the refusal path + the empty/single-region case inrentals_test.go/http_rent_test.go.GatewayOffergainsRegions []RegionOption{Slug,Label};RentRequestgainsRegion string(fix its doc comment — it currently states the opposite);brokerclient.Offerdecodesregions,Rentsendsregion;Orchestrator.RentServerthreads it through (the Access summary ataccess.go:449already rendersres.Region); mirror the new fields ininternal/founding/testing/fakes.go. No newstdio.goop.STATUS.md; add adocs/GOTCHAS.mdentry if the snapshot-region 422 is hit.Definition of done:
go test ./...green in both trees; theinternal/brokerclientround-trip test pins the new wire fields; therehearsal-rentfailhonesty leg still passes unchanged.Post-merge:
broker/**is a deployed-service tree — once this lands onmainthe executor swaps a drive blocker in and moves the ticket todeploy-pendinguntil the installed sha carries it (do not close on unit tests alone for the broker half).Watch out for:
offer.regionstypes exist on the app/TS side; you are building the Go seam, not the Vue.FoundingAccess.vue's non-empty-regionsrender guard intact (it is the safety that makes a live single-region broker a no-op).POST /v2/droplets422 after the operator commits (ADR 0047's no-half-rented invariant) — that is why the offer list must be derived, never hand-configured.swarm-claim host=matou-dev-server-01 run=21407
(automated multi-host claim — lowest live claim id works this ticket)
close-report for #1375 — status
success✅ close-report gates passed — every claim verified against main; issue closed.
envelope