diff --git a/seaweed-block/core/host/master/observation_revision_test.go b/seaweed-block/core/host/master/observation_revision_test.go index 01ec35ee08..ee3fe867a8 100644 --- a/seaweed-block/core/host/master/observation_revision_test.go +++ b/seaweed-block/core/host/master/observation_revision_test.go @@ -15,7 +15,7 @@ func TestGetClusterStatusReportsBuildRevision(t *testing.T) { if err != nil { t.Fatal(err) } - want := strings.TrimPrefix(strings.Fields(buildinfo.Version("blockmaster"))[1], "revision=") + want := strings.TrimPrefix(buildinfo.Version("blockmaster"), "blockmaster revision=") if resp.GetProductRevision() == "" || resp.GetProductRevision() != want { t.Fatalf("master product_revision=%q; --version revision=%q", resp.GetProductRevision(), want) } diff --git a/seaweed-block/core/host/volume/status_revision_test.go b/seaweed-block/core/host/volume/status_revision_test.go index 526dc9036a..691bd8705c 100644 --- a/seaweed-block/core/host/volume/status_revision_test.go +++ b/seaweed-block/core/host/volume/status_revision_test.go @@ -37,7 +37,7 @@ func TestStatusReportsComparableBuildRevision(t *testing.T) { if err = json.NewDecoder(resp.Body).Decode(&body); err != nil { t.Fatal(err) } - want := strings.TrimPrefix(strings.Fields(buildinfo.Version("blockvolume"))[1], "revision=") + want := strings.TrimPrefix(buildinfo.Version("blockvolume"), "blockvolume revision=") if body.Version == "" || body.Version != want || body.VolumeID != "v1" { t.Fatalf("holder /status=%+v; --version revision=%q", body, want) } diff --git a/seaweed-block/core/host/volume/status_server.go b/seaweed-block/core/host/volume/status_server.go index 0e99af2b7b..6a0a5dfb8c 100644 --- a/seaweed-block/core/host/volume/status_server.go +++ b/seaweed-block/core/host/volume/status_server.go @@ -189,7 +189,7 @@ const ( // replica readiness from authority movement. type StatusProjection struct { frontend.Projection - // Version is the build revision, in the same form as master product_revision. + // Version is the build revision plus modified flag, matching master product_revision. // Unknown provenance does not prove that two builds are equal. Version string // Memory is the process's memory use at the time of the request. diff --git a/seaweed-block/docs/standalone-deployment.md b/seaweed-block/docs/standalone-deployment.md index 4bcda2b1f9..6fdc85355d 100644 --- a/seaweed-block/docs/standalone-deployment.md +++ b/seaweed-block/docs/standalone-deployment.md @@ -772,4 +772,4 @@ A restore makes a new volume from a snapshot. The new volume reads every chunk i ### Comparing master and holder revisions -`ClusterEvidenceService.GetClusterStatus.product_revision` and the holder's local `GET /status?volume=` field `Version` both report the component-independent VCS revision from buildinfo. Compare these values to check for different source revisions; the holder field is read on its host through the existing loopback status endpoint. Neither value is carried in `HeartbeatReport`. An absent or `unknown` value means provenance is unavailable: even two `unknown` values do not establish equal builds. A matching revision does not prove byte-identical binaries or a clean working tree; the daemon's `--version` also reports whether its source was modified. These fields are diagnostic and do not affect readiness, leases or admissions. +`ClusterEvidenceService.GetClusterStatus.product_revision` and the holder's local `GET /status?volume=` field `Version` both report component-independent buildinfo provenance as ` modified=`. The modified flag is appended so clean and modified source trees do not compare equal. Compare these values to check for different source revisions; the holder field is read on its host through the existing loopback status endpoint. Neither value is carried in `HeartbeatReport`. An absent value or `unknown` revision/modified field means provenance is unavailable: even matching unknown values do not establish equal builds. Matching provenance does not prove byte-identical binaries, and two dirty trees can differ despite matching revision/modified fields; the daemon's `--version` reports these same fields with its component name. These fields are diagnostic and do not affect readiness, leases or admissions. diff --git a/seaweed-block/docs/status-schema.md b/seaweed-block/docs/status-schema.md index b25abcae3d..19acb9e629 100644 --- a/seaweed-block/docs/status-schema.md +++ b/seaweed-block/docs/status-schema.md @@ -19,6 +19,7 @@ The volume's authority and health projection. Go type `volume.StatusProjection`. | `Epoch` | uint64 | the authority epoch of the current assignment | | `EndpointVersion` | uint64 | the assignment's endpoint version within the epoch | | `Healthy` | bool | the replica may serve I/O at this epoch | +| `Version` | string | Component-independent build provenance in ` modified=` form, matching master `product_revision`; missing revision is `unknown`. Unknown never establishes equal builds. Diagnostic only. | | `Memory` | object | Memory is the process's memory use at the time of the request. | | `Memory.HeapAllocBytes` | uint64 | Go heap bytes in live objects (runtime.MemStats.HeapAlloc) | | `Memory.HeapInuseBytes` | uint64 | Go heap bytes in in-use spans (HeapInuse) | diff --git a/seaweed-block/internal/buildinfo/buildinfo.go b/seaweed-block/internal/buildinfo/buildinfo.go index a17b9d02ae..408a6b9bdf 100644 --- a/seaweed-block/internal/buildinfo/buildinfo.go +++ b/seaweed-block/internal/buildinfo/buildinfo.go @@ -7,31 +7,26 @@ import ( // Version returns a compact provenance string suitable for lab artifacts. func Version(component string) string { - revision := Revision() - modified := "unknown" - if info, ok := debug.ReadBuildInfo(); ok { - for _, setting := range info.Settings { - switch setting.Key { - case "vcs.modified": - if setting.Value != "" { - modified = setting.Value - } - } - } - } - return fmt.Sprintf("%s revision=%s modified=%s", component, revision, modified) + return fmt.Sprintf("%s revision=%s", component, Revision()) } -// Revision is the component-independent VCS revision, or "unknown" when -// build provenance is unavailable. It is diagnostic, never an identity or -// admission fact; two unknown revisions do not establish equal builds. +// Revision is the component-independent VCS revision and modified flag. +// Unavailable build metadata is explicit; unknown never proves equal builds. +// This is diagnostic, never an identity or admission fact. func Revision() string { + revision, modified := "unknown", "unknown" if info, ok := debug.ReadBuildInfo(); ok { for _, setting := range info.Settings { - if setting.Key == "vcs.revision" && setting.Value != "" { - return setting.Value + if setting.Value == "" { + continue + } + switch setting.Key { + case "vcs.revision": + revision = setting.Value + case "vcs.modified": + modified = setting.Value } } } - return "unknown" + return fmt.Sprintf("%s modified=%s", revision, modified) }