carlos / platform Public

host: the edges file's box_id is the box's label on every box, as the spec keeps it for boxes that predate region HA

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev bbb2bb616714b93653f010900909ff40f6db8530 parent 0ecc893
2 files changed, +5 −21
  • internal/host/edgesfile.go +5 −12
  • internal/host/edgesfile_test.go +0 −9
diff --git a/internal/host/edgesfile.go b/internal/host/edgesfile.go
index 3609e6813..f8861b37d 100644
--- a/internal/host/edgesfile.go
+++ b/internal/host/edgesfile.go
@@ -15,7 +15,6 @@ import (
"github.com/carlosframework/platform/internal/appconfig"
"github.com/carlosframework/platform/internal/registry"
"github.com/carlosframework/platform/internal/release"
- "github.com/carlosframework/platform/internal/status"
"github.com/carlosframework/platform/internal/domains"
)
@@ -155,14 +154,6 @@ type edgeHeadroom struct {
const capRegionHA1 = "region-ha-1"
-// edgesFileBoxID is the instance id on EC2 and the label everywhere else.
-func edgesFileBoxID(instanceID, label string) string {
- if instanceID != "" {
- return instanceID
- }
- return label
-}
-
// edgesFileCapabilities publishes region-ha-1 only when CARLOS_REGION_HA is
// set to something other than "" or "0".
func edgesFileCapabilities(getenv func(string) string) []string {
@@ -277,8 +268,10 @@ type edgesFile struct {
// R9). The console requires it to equal the fingerprint of its own
// CARLOS_SECRETS_PUBKEY before it places anything here automatically.
SecretsKeyFP string `json:"secrets_key_fp,omitempty"`
- // BoxID is the name claims use for this box (region HA spec 1 §2): the
- // EC2 instance id, or the label off EC2. It is NOT evidence of identity:
+ // BoxID is the name claims use for this box (region HA spec 1 §2).
+ // Today it is the box's label: every box predates region HA and keeps
+ // it. Plan 1b adds instance ids for Auto Scaling boxes, from a positive
+ // signal rather than from being on EC2. It is NOT evidence of identity:
// that is the box record (internal/boxid). A reader compares the two and
// treats a mismatch as an ineligible box.
BoxID string `json:"box_id,omitempty"`
@@ -738,7 +731,7 @@ func edgesFileLoop(reg *registry.Registry) {
ServesSharedPool: sharedPool,
AcceptsInbound: inbound,
SecretsKeyFP: edgesFileSecretsFP(os.Getenv),
- BoxID: edgesFileBoxID(status.InstanceID(), box),
+ BoxID: box,
Capabilities: edgesFileCapabilities(os.Getenv),
}
dataDir := provisionTickConfig(os.Getenv).DataDir
diff --git a/internal/host/edgesfile_test.go b/internal/host/edgesfile_test.go
index d12c23686..46c3ed26a 100644
--- a/internal/host/edgesfile_test.go
+++ b/internal/host/edgesfile_test.go
@@ -1327,15 +1327,6 @@ func TestEdgesFileSecretsKeyFingerprint(t *testing.T) {
}
}
-func TestEdgesFileBoxIDIsTheInstanceIDWhenThereIsOne(t *testing.T) {
- if got := edgesFileBoxID("i-0abc", "annie-welding"); got != "i-0abc" {
- t.Fatalf("on EC2: %q", got)
- }
- if got := edgesFileBoxID("", "annie-welding"); got != "annie-welding" {
- t.Fatalf("off EC2: %q", got)
- }
-}
-
func TestEdgesFileCapabilityFollowsTheFlag(t *testing.T) {
env := func(v string) func(string) string {
return func(k string) string {