From ebed84afc31ee6e15da539ee8490fcb56c98312d Mon Sep 17 00:00:00 2001 From: PJ Date: Sat, 15 Aug 2026 13:32:05 +0530 Subject: [PATCH] feat(campaign): record the label source in the manifest A finished sweep should say which cell it ran without anyone having to remember the invocation. Claude-Session: https://claude.ai/code/session_01A5KmftdEJ49A9z5mF5ESrX --- cmd/internal-tools/campaign/manifest.go | 2 ++ cmd/internal-tools/campaign/manifest_test.go | 24 ++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/cmd/internal-tools/campaign/manifest.go b/cmd/internal-tools/campaign/manifest.go index 244b453..98df917 100644 --- a/cmd/internal-tools/campaign/manifest.go +++ b/cmd/internal-tools/campaign/manifest.go @@ -21,6 +21,7 @@ const ( type manifest struct { Arm string `json:"arm"` Generator string `json:"generator"` + LabelSource string `json:"label_source"` Platform string `json:"platform"` SpecPath string `json:"spec_path"` BundleID string `json:"bundle_id"` @@ -44,6 +45,7 @@ func buildManifest(configuration config, host, binaryPath, version string, start return manifest{ Arm: configuration.arm, Generator: configuration.generator, + LabelSource: configuration.labelSource, Platform: configuration.platform, SpecPath: configuration.specPath, BundleID: configuration.bundleID, diff --git a/cmd/internal-tools/campaign/manifest_test.go b/cmd/internal-tools/campaign/manifest_test.go index 7d453da..7431dbd 100644 --- a/cmd/internal-tools/campaign/manifest_test.go +++ b/cmd/internal-tools/campaign/manifest_test.go @@ -41,6 +41,30 @@ func TestBuildManifest_RecordsIntendedRunsAndTemplate(t *testing.T) { } } +func TestWriteManifest_RecordsTheLabelSourceCell(t *testing.T) { + configuration, err := parseArguments(append(baseArguments(), "--label-source", "resource-id"), io.Discard) + if err != nil { + t.Fatal(err) + } + directory := t.TempDir() + if err := writeManifest(directory, buildManifest(configuration, "host", "sanderling", "dev", time.Now())); err != nil { + t.Fatal(err) + } + body, err := os.ReadFile(filepath.Join(directory, manifestFileName)) + if err != nil { + t.Fatal(err) + } + var decoded struct { + LabelSource string `json:"label_source"` + } + if err := json.Unmarshal(body, &decoded); err != nil { + t.Fatal(err) + } + if decoded.LabelSource != "resource-id" { + t.Errorf("label_source: got %q, want resource-id", decoded.LabelSource) + } +} + func TestBuildManifest_EmptyDeviceListSerializesAsArray(t *testing.T) { configuration, err := parseArguments(baseArguments(), io.Discard) if err != nil {