console: the relabel worker no longer writes first labels (D2)
relabelFleet no longer calls planFirstLabelling, and the function is gone. An unlabelled record stays unlabelled whatever its binding says; moves off lost, draining and detached boxes are unchanged. This is the last task of release A, the slice's rollback floor. readFleetBinding and fleetBinding stay for the next merge's labelling door, and labelActive stays for creates. TestFirstLabellingIsOff replaces TestFirstLabellingFollowsBindings, and TestTwoBoxFleetEndToEnd_RealNoAutomaticFirstLabel replaces TestTwoBoxFleetEndToEnd_RealFirstLabelling. Tests that used the worker to get a labelled record now label it with labelOn (the production registry mark and SetRecordFleetBox). The placement race and the detach-before-lock race are witnessed on the move path. TestFirstLabellingSkipsAnUnboundRecord is removed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
internal/console/fleetrelabel.go+15 −50internal/console/fleetrelabel_test.go+75 −56internal/console/jobs_test.go+1 −1internal/host/fleettwobox_e2e_test.go+24 −40
Intent
<task-notification> <task-id>ac3c579b891c0b0f9</task-id> <tool-use-id>toolu_01A8oPJcJNThRnhZB7E7Vfwh</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ac77363b-5830-422c-9f38-d7f2540dd398/tasks/ac3c579b891c0b0f9.output</output-file> <status>completed</status> <summary>Agent "Implement Task 3: R3 stateless drain" 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_WITH_CONCERNS - **Commit:** 660d7ee0 console: relabel and drain verify always-on stateless records (R3) - **Tests:** The 4 new console tests failed as expected before the change (the record stayed on pi-1) and pass after it. The brief's `TestLostBoxMovesToTheSurvivor|TestDrain` run passes. The activator pin, `TestLabelledStatelessRowStartsOnTheNewBox`, passes with no activator code changed. The `GOOS=darwin` build and `go vet` are clean. I ran the go commands with the sandbox off because the default GOCACHE is read-only inside it; GOCACHE and GOTMPDIR are still at their defaults. - **Concerns:** 1. I changed one existing test the brief did not mention. `TestReplicaLegacyDrainAndDiscoveryAfterDecrease` asserted that drain strands a one-copy always-on stateless record, which is the behaviour R3 removes. It now asserts the drain moves the record and still checks that the stale SQL marker doesn't decide the outcome. Please confirm that ruling. 2. The activator pin is weaker than it looks. The test backend is not `ExecBackend`, so the moved-row empty-start refusal in `startrule.go` never runs. The pin also uses a rootfs row, not a binary one. Its first red ("maintenance fence active") came from my own test record not matching the rig's record. 3. A manifest that can't be verified is logged but does not fail the FleetRelabel job, the same as an unmovable record today. Making it fail the job is one line if you want that. - **Report:** /home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-record-labels/.superpowers/sdd/2026-11-14-fleet-record-labels/task-3-report.md</result> <usage><subagent_tokens>129275</subagent_tokens><tool_uses>46</tool_uses><duration_ms>1220708</duration_ms></usage> </task-notification>
Attributed to this commit: 7.00 g CO₂e (812,829 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-fleet-record-labels, 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/console/fleetrelabel.go b/internal/console/fleetrelabel.go| index f764399cb..36adf70d1 100644 |
| --- a/internal/console/fleetrelabel.go |
| +++ b/internal/console/fleetrelabel.go |
| @@ -32,13 +32,11 @@ import ( |
| // longer an active box of the fleet moves to chooseDestination(rootfs, |
| // its box) (rules 4 and 5). Moving needs no open activation gate |
| // (controller ruling 1). |
| -// - And when the activation gate is open (labelActive): an unlabelled |
| -// record is labelled to the box its binding |
| -// (fleets/<f>/bindings/<host>.json) names, when that binding was |
| -// written for this record and the box is a valid destination. A record |
| -// with no such binding stays unlabelled: the console never picks a box |
| -// for an existing record, since a box that never served it would start |
| -// it empty (rule 6, controller ruling 5). |
| +// - The worker never writes a first label (fleet record labels spec §6 |
| +// D2): an unlabelled record stays unlabelled, whatever its binding |
| +// says. A first label is written at create, never by this worker, |
| +// which would label with no owner's say; a console without D2 is |
| +// below this slice's rollback floor. |
| // |
| // Every read comes first and any read that is not whole means no write for |
| // the fleet. Every write is SetRecordFleetBox, conditional on the region, |
| @@ -141,9 +139,10 @@ type relabel struct { |
| } |
| // relabelFleet is one fleet's pass, from v (read under the fleet's lock by |
| -// the caller), as of now. moved counts the records written. err is a read |
| -// that was not whole, which writes nothing; a write that fails is logged |
| -// and the others still run. |
| +// the caller), as of now. moved counts the records written. err is nil |
| +// since the first labelling, whose binding reads could fail the pass, went |
| +// (D2); a manifest that cannot be verified leaves its record, and a write |
| +// that fails is logged and the others still run. |
| func (s *Server) relabelFleet(ctx context.Context, fleet string, v fleetView, now time.Time) (moved int, err error) { |
| if box, rel := v.labelsPausedBy(); box != "" { |
| log.Printf("console: ERROR fleet %s: box %s reports release %s, below the label floor %s: relabelling is paused until it is updated", |
| @@ -153,17 +152,9 @@ func (s *Server) relabelFleet(ctx context.Context, fleet string, v fleetView, no |
| if !v.Active { |
| return 0, nil |
| } |
| + // No first labelling here (D2): only records that already carry a |
| + // label are moved. |
| var plan []relabel |
| - if v.labelActive() { |
| - first, err := s.planFirstLabelling(ctx, fleet, v) |
| - if err != nil { |
| - return 0, err |
| - } |
| - for _, p := range first { |
| - v.Load[p.to]++ |
| - } |
| - plan = append(plan, first...) |
| - } |
| for _, rec := range v.Records { |
| if rec.ReplicaAssignment != nil || !fleetLabelsRecord(rec) || rec.FleetBox == "" { |
| continue |
| @@ -193,34 +184,6 @@ func (s *Server) relabelFleet(ctx context.Context, fleet string, v fleetView, no |
| return s.writeRelabels(ctx, fleet, plan, now), nil |
| } |
| -// planFirstLabelling is the first labelling's plan: each unlabelled record |
| -// whose binding names a valid destination, labelled there. A binding that |
| -// cannot be read is an error, and the pass writes nothing. |
| -func (s *Server) planFirstLabelling(ctx context.Context, fleet string, v fleetView) ([]relabel, error) { |
| - var plan []relabel |
| - for _, rec := range v.Records { |
| - if rec.ReplicaAssignment != nil || !fleetLabelsRecord(rec) || rec.FleetBox != "" || !movable(rec) { |
| - continue |
| - } |
| - b, ok, err := s.readFleetBinding(ctx, fleet, rec.Host) |
| - if err != nil { |
| - return nil, fmt.Errorf("binding of %s: %w", rec.Host, err) |
| - } |
| - // The binding must be this record's: written by a box of this |
| - // fleet, for this host, after the record was created (a binding |
| - // left by an earlier record at the same host names a box that |
| - // served other data). |
| - if !ok || b.Fleet != fleet || b.Host != rec.Host || b.BoundAt < rec.CreatedAt.UnixMilli() { |
| - continue |
| - } |
| - if !v.validDestination(b.Box, rec.Runtime == provision.RuntimeRootfsV1) { |
| - continue |
| - } |
| - plan = append(plan, relabel{rec: rec, to: b.Box, reason: "binding"}) |
| - } |
| - return plan, nil |
| -} |
| - |
| // writeRelabels makes plan's writes, each marking its box labelled first, |
| // and answers how many records were written. |
| func (s *Server) writeRelabels(ctx context.Context, fleet string, plan []relabel, now time.Time) int { |
| @@ -341,8 +304,10 @@ func (v fleetView) labelsPausedBy() (box, rel string) { |
| } |
| // fleetBinding is the part of a box's binding object (internal/host's |
| -// FleetBinding, written by the box that won the host's lease) the first |
| -// labelling reads. |
| +// FleetBinding, written by the box that won the host's lease) the console |
| +// reads. The relabel worker no longer reads it (D2); it is kept for the |
| +// labelling door of the next merge, which reads bindings through |
| +// readFleetBinding. |
| type fleetBinding struct { |
| Host string `json:"host"` |
| Fleet string `json:"fleet"` |
diff --git a/internal/console/fleetrelabel_test.go b/internal/console/fleetrelabel_test.go| index b5b028cb4..9ebe0ea13 100644 |
| --- a/internal/console/fleetrelabel_test.go |
| +++ b/internal/console/fleetrelabel_test.go |
| @@ -19,8 +19,9 @@ import ( |
| "github.com/carlosframework/platform/internal/status" |
| ) |
| -// Managed fleets 1b, Task 6: the relabel worker (first labelling from |
| -// bindings, moves off lost and draining boxes, the pause below the floor), |
| +// Managed fleets 1b, Task 6: the relabel worker (moves off lost and |
| +// draining boxes, the pause below the floor; since D2 of the fleet record |
| +// labels spec it writes no first label), |
| // the drain, and the removal rule both detach doors ask (a box that has |
| // run instances is detached only with its machine's termination |
| // confirmed). App shop |
| @@ -37,6 +38,23 @@ func bindTo(t *testing.T, fx *consoleFixture, h, box string, at time.Time) { |
| } |
| } |
| +// labelOn names box on shop's unlabelled record of h as the console's |
| +// labelling writes do (writeRelabels' order): the box is marked labelled in |
| +// the registry, then the record's label is written. The relabel worker no |
| +// longer writes a first label (D2), so a test that needs a labelled record |
| +// labels it here. |
| +func labelOn(t *testing.T, fx *consoleFixture, reg *registry.Registry, h, box string) { |
| + t.Helper() |
| + rec := shopRec(t, fx, h) |
| + if err := reg.MarkFleetBoxLabelled("pi", box, time.Now().UnixNano()); err != nil { |
| + t.Fatal(err) |
| + } |
| + want := provision.FleetBoxExpect{Region: rec.Region, Label: rec.FleetBox, CreatedAt: rec.CreatedAt} |
| + if err := provision.SetRecordFleetBox(context.Background(), fx.rel, fx.sqid, "shop", h, want, box, time.Now()); err != nil { |
| + t.Fatal(err) |
| + } |
| +} |
| + |
| // shopRec reads shop's record of h. |
| func shopRec(t *testing.T, fx *consoleFixture, h string) *provision.Record { |
| t.Helper() |
| @@ -85,45 +103,44 @@ func beat(t *testing.T, fx *consoleFixture, box string, at time.Time, mut func(* |
| } |
| } |
| -func TestFirstLabellingFollowsBindings(t *testing.T) { |
| - fx, _, reg := fleetBoxWorld(t, "code-rl-first", "pi-1", "pi-2") |
| - for h, box := range map[string]string{"a.example.com": "pi-1", "b.example.com": "pi-1", "c.example.com": "pi-2"} { |
| +// TestFirstLabellingIsOff pins D2 (fleet record labels spec §6): the |
| +// worker never writes a first label. The fleet is gated open and each |
| +// record has a binding a box wrote for it after it was created, which is |
| +// what the removed first labelling followed; the records stay unlabelled |
| +// across three passes at explicit times, and no box is marked labelled. |
| +func TestFirstLabellingIsOff(t *testing.T) { |
| + fx, _, reg := fleetBoxWorld(t, "code-rl-first-off", "pi-1", "pi-2") |
| + base := time.Now() |
| + hosts := map[string]string{"a.example.com": "pi-1", "b.example.com": "pi-1", "c.example.com": "pi-2"} |
| + for h, box := range hosts { |
| putFleetRecord(t, fx, "shop", h, nil) |
| - bindTo(t, fx, h, box, time.Now()) |
| + bindTo(t, fx, h, box, base.Add(time.Second)) |
| } |
| - relabelPass(t, fx) |
| - for h, box := range map[string]string{"a.example.com": "pi-1", "b.example.com": "pi-1", "c.example.com": "pi-2"} { |
| - wantLabel(t, shopRec(t, fx, h), box) |
| + v, err := fx.srv.loadFleetViewAt(context.Background(), "pi", base) |
| + if err != nil { |
| + t.Fatal(err) |
| } |
| - for _, l := range []string{"pi-1", "pi-2"} { |
| - if b := boxRow(t, reg, l); b.LabelledAt == 0 { |
| - t.Fatalf("%s was named on a record and not marked labelled", l) |
| + if !v.labelActive() { |
| + t.Fatalf("the fleet is not gated open, so the witness proves nothing: %+v", v) |
| + } |
| + cs := newCountStore(fx.rel) |
| + fx.srv.cfg.Releases = cs |
| + for i := 1; i <= 3; i++ { |
| + if err := fx.srv.fleetRelabelPass(context.Background(), base.Add(time.Duration(i)*time.Minute)); err != nil { |
| + t.Fatalf("pass %d: %v", i, err) |
| + } |
| + for h := range hosts { |
| + wantNoLabel(t, shopRec(t, fx, h)) |
| } |
| } |
| - // Nothing moves on the next pass. |
| - before := shopRec(t, fx, "a.example.com").FleetBoxAt |
| - relabelPass(t, fx) |
| - if r := shopRec(t, fx, "a.example.com"); r.FleetBox != "pi-1" || r.FleetBoxAt != before || r.FleetBoxMoved { |
| - t.Fatalf("a second pass changed a: %+v", r) |
| + if n := cs.recordPuts(); n != 0 { |
| + t.Fatalf("three passes wrote %d records", n) |
| } |
| -} |
| - |
| -func TestFirstLabellingSkipsAnUnboundRecord(t *testing.T) { |
| - fx, _, _ := fleetBoxWorld(t, "code-rl-unbound", "pi-1", "pi-2", "pi-3") |
| - putFleetRecord(t, fx, "shop", "free.example.com", nil) // no binding at all |
| - putFleetRecord(t, fx, "shop", "old.example.com", nil) // bound before this record was created |
| - bindTo(t, fx, "old.example.com", "pi-1", time.Now().Add(-time.Hour)) |
| - putFleetRecord(t, fx, "shop", "gone.example.com", nil) // bound to a box no longer fresh |
| - bindTo(t, fx, "gone.example.com", "pi-3", time.Now()) |
| - piBeat(t, fx, "pi-3", true, time.Now().Add(-time.Hour), release.FleetBoxLabelFloor) |
| - relabelPass(t, fx) |
| - for _, h := range []string{"free.example.com", "old.example.com", "gone.example.com"} { |
| - wantNoLabel(t, shopRec(t, fx, h)) |
| + for _, l := range []string{"pi-1", "pi-2"} { |
| + if b := boxRow(t, reg, l); b.LabelledAt != 0 { |
| + t.Fatalf("%s was marked labelled with no record named on it", l) |
| + } |
| } |
| - // Bound now: labelled to the box that serves it, never to a clean one. |
| - bindTo(t, fx, "free.example.com", "pi-2", time.Now()) |
| - relabelPass(t, fx) |
| - wantLabel(t, shopRec(t, fx, "free.example.com"), "pi-2") |
| } |
| func TestRelabelPassLeavesAnUngatedFleetAlone(t *testing.T) { |
| @@ -186,14 +203,16 @@ func TestLostBoxMovesToTheSurvivor(t *testing.T) { |
| } |
| } |
| +// A move off a lost box that the pass planned loses to a placement change |
| +// made after the pass read the record. |
| func TestRelabelLosesToAPlacementChange(t *testing.T) { |
| fx, _, _ := fleetBoxWorld(t, "code-rl-race", "pi-1", "pi-2") |
| - putFleetRecord(t, fx, "shop", "a.example.com", nil) |
| - bindTo(t, fx, "a.example.com", "pi-1", time.Now()) |
| + putFleetRecord(t, fx, "shop", "a.example.com", func(r *provision.Record) { r.FleetBox = "pi-1" }) |
| + piBeat(t, fx, "pi-1", true, time.Now().Add(-21*time.Minute), release.FleetBoxLabelFloor) // lost |
| ctx := context.Background() |
| v, err := fx.srv.loadFleetView(ctx, "pi") |
| - if err != nil || !v.labelActive() { |
| - t.Fatalf("view %+v, %v", v, err) |
| + if err != nil || !v.Active || v.boxGone("pi-1", time.Now()) == "" { |
| + t.Fatalf("view %+v, %v; want pi-1 lost on an active fleet", v, err) |
| } |
| // The app moves to another fleet after the pass read the record. |
| if err := provision.SetRecordRegion(ctx, fx.rel, fx.sqid, "shop", "a.example.com", "fleet/other"); err != nil { |
| @@ -204,7 +223,7 @@ func TestRelabelLosesToAPlacementChange(t *testing.T) { |
| t.Fatalf("relabelFleet = %d, %v; want nothing moved and no error", moved, err) |
| } |
| r := shopRec(t, fx, "a.example.com") |
| - wantNoLabel(t, r) |
| + wantNoLabel(t, r) // the region change cleared pi-1; the move did not land |
| if r.Region != "fleet/other" { |
| t.Fatalf("region %q; want the new fleet kept", r.Region) |
| } |
| @@ -229,11 +248,10 @@ func TestRelabelSkipsAnImportInFlight(t *testing.T) { |
| } |
| func TestBelowFloorBoxPausesAndAlerts(t *testing.T) { |
| - fx, token, _ := fleetBoxWorld(t, "code-rl-floor", "pi-1", "pi-2", "pi-3") |
| + fx, token, reg := fleetBoxWorld(t, "code-rl-floor", "pi-1", "pi-2", "pi-3") |
| putFleetRecord(t, fx, "shop", "a.example.com", func(r *provision.Record) { r.FleetBox = "pi-1" }) |
| putFleetRecord(t, fx, "shop", "b.example.com", nil) |
| - bindTo(t, fx, "b.example.com", "pi-2", time.Now()) |
| - relabelPass(t, fx) |
| + labelOn(t, fx, reg, "b.example.com", "pi-2") |
| wantLabel(t, shopRec(t, fx, "b.example.com"), "pi-2") // labels exist now |
| piBeat(t, fx, "pi-1", true, time.Now().Add(-21*time.Minute), release.FleetBoxLabelFloor) // lost |
| @@ -312,10 +330,9 @@ func (f failListStore) List(ctx context.Context, prefix string) ([]string, error |
| // listing that fails, both show unknown; a readable box below the floor |
| // still shows paused beside an unreadable one. |
| func TestLabelsPausedIsUnknownWhenReportsCannotBeRead(t *testing.T) { |
| - fx, token, _ := fleetBoxWorld(t, "code-rl-unknown", "pi-1", "pi-2", "pi-3") |
| + fx, token, reg := fleetBoxWorld(t, "code-rl-unknown", "pi-1", "pi-2", "pi-3") |
| putFleetRecord(t, fx, "shop", "a.example.com", nil) |
| - bindTo(t, fx, "a.example.com", "pi-1", time.Now()) |
| - relabelPass(t, fx) // pi-1 holds a label: the fleet has labels |
| + labelOn(t, fx, reg, "a.example.com", "pi-1") // pi-1 holds a label: the fleet has labels |
| if got := fleetListLabels(t, fx, token); got != "" { |
| t.Fatalf("a current fleet shows labels_paused %q; want it absent", got) |
| } |
| @@ -343,8 +360,7 @@ func TestLabelsPausedIsUnknownWhenReportsCannotBeRead(t *testing.T) { |
| func TestLabelsPausedIsUnknownWhenABoxHasNoReport(t *testing.T) { |
| fx, token, reg := fleetBoxWorld(t, "code-rl-unheard", "pi-1", "pi-2") |
| putFleetRecord(t, fx, "shop", "a.example.com", nil) |
| - bindTo(t, fx, "a.example.com", "pi-1", time.Now()) |
| - relabelPass(t, fx) // pi-1 holds a label: the fleet has labels |
| + labelOn(t, fx, reg, "a.example.com", "pi-1") // pi-1 holds a label: the fleet has labels |
| if got := fleetListLabels(t, fx, token); got != "" { |
| t.Fatalf("a current fleet shows labels_paused %q; want it absent", got) |
| } |
| @@ -365,8 +381,7 @@ func TestLabelsPausedIsUnknownWhenABoxHasNoReport(t *testing.T) { |
| func TestOneBoxLabelledFleetStillAlertsOnRollback(t *testing.T) { |
| fx, token, reg := fleetBoxWorld(t, "code-rl-onebox", "pi-1", "pi-2") |
| putFleetRecord(t, fx, "shop", "a.example.com", nil) |
| - bindTo(t, fx, "a.example.com", "pi-1", time.Now()) |
| - relabelPass(t, fx) |
| + labelOn(t, fx, reg, "a.example.com", "pi-1") |
| wantLabel(t, shopRec(t, fx, "a.example.com"), "pi-1") |
| // pi-2 never held a label: it detaches at once, leaving pi-1 alone. |
| if code, raw := detachAPI(t, fx, token, "pi-2", false); code != http.StatusOK { |
| @@ -488,8 +503,7 @@ func drainedPi1(t *testing.T, code string) (*consoleFixture, string, *registry.R |
| t.Helper() |
| fx, token, reg := fleetBoxWorld(t, code, "pi-1", "pi-2") |
| putFleetRecord(t, fx, "shop", "a.example.com", nil) |
| - bindTo(t, fx, "a.example.com", "pi-1", time.Now()) |
| - relabelPass(t, fx) |
| + labelOn(t, fx, reg, "a.example.com", "pi-1") |
| wantLabel(t, shopRec(t, fx, "a.example.com"), "pi-1") |
| if code, _, raw := rawReq(t, http.MethodPost, drainURL(fx, "pi-1"), token, `{}`); code != http.StatusOK { |
| t.Fatalf("drain = %d %s", code, raw) |
| @@ -609,8 +623,7 @@ func TestDetachRefusalSaysDrainThenTerminated(t *testing.T) { |
| func TestSilentBoxDetachesOnlyTerminated(t *testing.T) { |
| fx, token, reg := fleetBoxWorld(t, "code-rl-silent", "pi-1", "pi-2") |
| putFleetRecord(t, fx, "shop", "a.example.com", nil) |
| - bindTo(t, fx, "a.example.com", "pi-1", time.Now()) |
| - relabelPass(t, fx) |
| + labelOn(t, fx, reg, "a.example.com", "pi-1") |
| piBeat(t, fx, "pi-1", true, time.Now().Add(-21*time.Minute), release.FleetBoxLabelFloor) |
| relabelPass(t, fx) |
| if r := shopRec(t, fx, "a.example.com"); r.FleetBox != "pi-2" { |
| @@ -635,13 +648,17 @@ func TestSilentBoxDetachesOnlyTerminated(t *testing.T) { |
| // Review fix round 1, P1: a relabel that lands after the detach door is |
| // called and before it takes the fleet's lock names the box on a record. |
| -// The door must see that and ask for the confirmation, at both doors. |
| +// The door must see that and ask for the confirmation, at both doors. Since |
| +// D2 the worker's only relabel is a move: a is on pi-2, pi-2 is lost, and |
| +// the pass that lands before the lock moves a to pi-1, the box being |
| +// detached. |
| func TestDetachSeesARelabelThatLandsBeforeTheLock(t *testing.T) { |
| for _, door := range []string{"api", "page"} { |
| t.Run(door, func(t *testing.T) { |
| fx, token, reg := fleetBoxWorld(t, "code-rl-race-"+door, "pi-1", "pi-2") |
| putFleetRecord(t, fx, "shop", "a.example.com", nil) |
| - bindTo(t, fx, "a.example.com", "pi-1", time.Now()) |
| + labelOn(t, fx, reg, "a.example.com", "pi-2") |
| + piBeat(t, fx, "pi-2", true, time.Now().Add(-21*time.Minute), release.FleetBoxLabelFloor) // lost |
| if b := boxRow(t, reg, "pi-1"); b.LabelledAt != 0 { |
| t.Fatal("pi-1 is labelled before the race") |
| } |
| @@ -656,7 +673,9 @@ func TestDetachSeesARelabelThatLandsBeforeTheLock(t *testing.T) { |
| } else { |
| refused = strings.Contains(detachPage(t, fx, "pi-1", false), msgDetachNotDrainedPage("pi", "pi-1")) |
| } |
| - wantLabel(t, shopRec(t, fx, "a.example.com"), "pi-1") |
| + if r := shopRec(t, fx, "a.example.com"); r.FleetBox != "pi-1" || !r.FleetBoxMoved { |
| + t.Fatalf("record on %q (moved %v); want moved to pi-1 before the lock", r.FleetBox, r.FleetBoxMoved) |
| + } |
| if !refused { |
| t.Fatal("the detach passed on the box as it read it before the relabel") |
| } |
diff --git a/internal/console/jobs_test.go b/internal/console/jobs_test.go| index e5f79553e..75dd0f63c 100644 |
| --- a/internal/console/jobs_test.go |
| +++ b/internal/console/jobs_test.go |
| @@ -70,7 +70,7 @@ var jobPassFuncs = map[string][]string{ |
| "StartEgressReport": {"egressReportPass"}, |
| "ReportApexSquats": {"apexSquats"}, |
| "LogPlacementDiscrepancies": {"logPlacementDiscrepancies"}, |
| - "FleetRelabel": {"fleetRelabelPass", "relabelFleet", "planFirstLabelling", "writeRelabels"}, |
| + "FleetRelabel": {"fleetRelabelPass", "relabelFleet", "writeRelabels"}, |
| "ManagedFleets": {"managedFleetsPass", "stepManagedBox", "cleanupManagedBox"}, |
| "LinkSync": {"linkSyncPass", "syncLinkChannel"}, |
| } |
diff --git a/internal/host/fleettwobox_e2e_test.go b/internal/host/fleettwobox_e2e_test.go| index c7ffd2d92..3327fa3fa 100644 |
| --- a/internal/host/fleettwobox_e2e_test.go |
| +++ b/internal/host/fleettwobox_e2e_test.go |
| @@ -897,12 +897,13 @@ func TestTwoBoxFleetEndToEnd_Real(t *testing.T) { |
| pi1.mustStop(fleetB) |
| } |
| -// TestTwoBoxFleetEndToEnd_RealFirstLabelling is step 5: a fleet whose |
| -// instances were created and served unlabelled (its boxes below the label |
| -// floor) is labelled once every box is on the floor, each record to the |
| -// box its binding names. Nothing moves and nothing is lost: each box sets |
| -// its copy aside once and restores the same data. |
| -func TestTwoBoxFleetEndToEnd_RealFirstLabelling(t *testing.T) { |
| +// TestTwoBoxFleetEndToEnd_RealNoAutomaticFirstLabel is step 5: a fleet |
| +// whose instances were created and served unlabelled (its boxes below the |
| +// label floor) stays unlabelled once every box is on the floor. The relabel |
| +// worker never writes a first label (fleet record labels spec §6 D2), even |
| +// though each record has a binding its serving box wrote; both boxes keep |
| +// minting both records, as on main. |
| +func TestTwoBoxFleetEndToEnd_RealNoAutomaticFirstLabel(t *testing.T) { |
| w := newFleetWorld(t, fleetOpts{rel: "v0.32.9"}) |
| pi1, pi2 := w.pi1, w.pi2 |
| w.create(fleetA) |
| @@ -930,43 +931,26 @@ func TestTwoBoxFleetEndToEnd_RealFirstLabelling(t *testing.T) { |
| w.wantRecord(fleetA, "", false) |
| w.wantRecord(fleetB, "", false) |
| - // Both boxes reach the floor: the first labelling follows the bindings. |
| - w.advance(time.Minute) |
| - pi1.heartbeat(w.now) |
| - pi2.heartbeat(w.now) |
| - w.relabel() |
| - w.wantRecord(fleetA, "pi-1", false) |
| - w.wantRecord(fleetB, "pi-2", false) |
| - w.wantForwards(map[string]string{fleetA: "pi-1", fleetB: "pi-2"}) |
| + // Both boxes reach the floor: the pass still leaves both unlabelled, |
| + // on this pass and the next. |
| + for i := 0; i < 2; i++ { |
| + w.advance(time.Minute) |
| + pi1.heartbeat(w.now) |
| + pi2.heartbeat(w.now) |
| + w.relabel() |
| + w.wantRecord(fleetA, "", false) |
| + w.wantRecord(fleetB, "", false) |
| + } |
| + for _, l := range []string{"pi-1", "pi-2"} { |
| + if b := w.boxRow(l); b.LabelledAt != 0 { |
| + t.Fatalf("%s was marked labelled with no record named on it", l) |
| + } |
| + } |
| pi1.mustReconcile() |
| pi2.mustReconcile() |
| - wantOnly(t, pi1, fleetA) |
| - wantOnly(t, pi2, fleetB) |
| - for _, c := range []struct { |
| - b *fleetBox |
| - host, val string |
| - }{{pi1, fleetA, "1"}, {pi2, fleetB, "b1"}} { |
| - c.b.mustWake(c.host) |
| - if got := c.b.read(c.host); got != c.val { |
| - t.Fatalf("%s read %q from %s after the first labelling, want %s", c.b.label, got, c.host, c.val) |
| - } |
| - if n := len(c.b.setAside(c.host)); n != 1 { |
| - t.Fatalf("%s set aside %d copies of %s, want 1", c.b.label, n, c.host) |
| - } |
| - w.wantLock(c.host, c.b.label) |
| - c.b.write(c.host, c.val+"+") |
| - c.b.mustStop(c.host) |
| - // The next wake keeps the copy: it was kept under this assignment. |
| - c.b.mustWake(c.host) |
| - if got := c.b.read(c.host); got != c.val+"+" { |
| - t.Fatalf("%s read %q from %s on a warm wake, want %s+", c.b.label, got, c.host, c.val) |
| - } |
| - if n := len(c.b.setAside(c.host)); n != 1 { |
| - t.Fatalf("%s set aside %d copies of %s after a warm wake, want still 1", c.b.label, n, c.host) |
| - } |
| - c.b.mustStop(c.host) |
| - } |
| + wantOnly(t, pi1, fleetA, fleetB) |
| + wantOnly(t, pi2, fleetA, fleetB) |
| } |
| // TestTwoBoxFleetEndToEnd_RealLostBox is step 6: pi-1's agent dies with a |