console: the lost-claim policy race publishes box addresses before B's grant (#328)
TestClaimLostAfterResolutionWritesNothing's second half (Astra plan R4-1) has B grant racy2 an egress allow while A's create is paused. It was written against the door's checkEgressGrant stub; the grant-time fleet check (002fb34f, ruling 8) now refuses any grant while a box publishes no addrs, and the region fixture's edges files predate the field, so B's PUT got 409 and the race was never exercised. The refusal is right for an older box. The test now republishes ie-box and uk-box with addrs, as current boxes do, before the race; edgeJSON takes an addrs option.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+13
−0
internal/console/regioncandidates_test.go+4 −0internal/console/regionclaim_test.go+9 −0
CI failed — run details
diff --git a/internal/console/regioncandidates_test.go b/internal/console/regioncandidates_test.go| index c33f31773..c9b338bd1 100644 |
| --- a/internal/console/regioncandidates_test.go |
| +++ b/internal/console/regioncandidates_test.go |
| @@ -26,6 +26,7 @@ func bp(b bool) *bool { return &b } |
| type edgeOpts struct { |
| hib, shared, inbound *bool // nil = the writer predates the field |
| fp string |
| + addrs []string // nil = the writer predates addrs (#328) |
| } |
| var eligibleBox = edgeOpts{hib: bp(true), shared: bp(true), inbound: bp(true), fp: testKeyFP} |
| @@ -48,6 +49,9 @@ func edgeJSON(box, eip, awsRegion, placement string, o edgeOpts) string { |
| if o.fp != "" { |
| m["secrets_key_fp"] = o.fp |
| } |
| + if o.addrs != nil { |
| + m["addrs"] = o.addrs |
| + } |
| b, _ := json.Marshal(m) |
| return string(b) |
| } |
diff --git a/internal/console/regionclaim_test.go b/internal/console/regionclaim_test.go| index c3557cff1..a54c7ae95 100644 |
| --- a/internal/console/regionclaim_test.go |
| +++ b/internal/console/regionclaim_test.go |
| @@ -210,6 +210,15 @@ func TestClaimLostAfterResolutionWritesNothing(t *testing.T) { |
| // lock. A paused create (A, past its HasAppIn check) must not clear the |
| // policy an operator granted the app that took the name meanwhile (B). |
| // Fails if the clear runs on the stale existence check. |
| + // |
| + // B's grant passes the door's fleet check (ruling 8) only where every |
| + // box publishes its addresses, as a current box does; the region |
| + // fixture's files predate addrs, and an older box refuses every grant. |
| + current := eligibleBox |
| + current.addrs = []string{"5.6.7.8"} |
| + ie := edgeJSON("ie-box", "5.6.7.8", "eu-west-1", "", current) |
| + current.addrs = []string{"1.2.3.4"} |
| + setEdges(t, fx, map[string]string{"ie-box": ie, "uk-box": edgeJSON("uk-box", "1.2.3.4", "eu-west-2", "uk", current)}) |
| var ( |
| entered bool |
| wB []byte |