host: pin the moves owners' refusal of a second C8 provider (Task 8 fix round 1, item 3)
platform-1e asked to confirm bindClaimMovesFiles refuses a second provider, with a test. It does (moveswakesource.go, bindClaimFiles), and TestRegisteredSourceOpensTheMovesOwnersWithTheClaimsFiles already pinned it through openClaimFilesManifest. TestBindClaimMovesFilesRefusesASecondProvider pins it directly: the same provider again is a no-op, another is refused and never swapped in, and a binding with no owners or no provider does nothing. With the refusal removed, both tests fail.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+28
−0
internal/host/moveswakesource_test.go+28 −0
diff --git a/internal/host/moveswakesource_test.go b/internal/host/moveswakesource_test.go| index 948b9ca1f..364470790 100644 |
| --- a/internal/host/moveswakesource_test.go |
| +++ b/internal/host/moveswakesource_test.go |
| @@ -479,3 +479,31 @@ func TestMovesSourceOpenRefusalIsLoggedOnce(t *testing.T) { |
| t.Fatalf("logged %q, want the cause once", lines) |
| } |
| } |
| + |
| +// TestBindClaimMovesFilesRefusesASecondProvider (Task 8 fix round 1, |
| +// platform-1e): the claim's C8 provider binds the moves owners once; the |
| +// same provider again changes nothing, and another is refused and never |
| +// swapped in. A binding without moves owners, or without a provider, does |
| +// nothing. |
| +func TestBindClaimMovesFilesRefusesASecondProvider(t *testing.T) { |
| + m := &movesProbeOwners{} |
| + first, second := &movesFiles{Box: "first"}, &movesFiles{Box: "second"} |
| + out := ClaimOwnerBindings{Moves: m.MovesOwners(&movesProbeAttempts{})} |
| + out.Serving.Files = first |
| + if err := bindClaimMovesFiles(&out); err != nil || m.Files != ClaimFilesManifest(first) { |
| + t.Fatalf("the first provider: %v, files %v", err, m.Files) |
| + } |
| + if err := bindClaimMovesFiles(&out); err != nil || m.Files != ClaimFilesManifest(first) { |
| + t.Fatalf("the same provider again: %v", err) |
| + } |
| + out.Serving.Files = second |
| + if err := bindClaimMovesFiles(&out); !errors.Is(err, hostwrite.ErrUnavailable) || m.Files != ClaimFilesManifest(first) { |
| + t.Fatalf("a second provider: %v, files %v", err, m.Files) |
| + } |
| + if err := bindClaimMovesFiles(&ClaimOwnerBindings{Serving: ClaimServingSources{Files: second}}); err != nil { |
| + t.Fatalf("no moves owners: %v", err) |
| + } |
| + if err := bindClaimMovesFiles(&ClaimOwnerBindings{Moves: out.Moves}); err != nil || m.Files != ClaimFilesManifest(first) { |
| + t.Fatalf("no provider: %v", err) |
| + } |
| +} |