05ae530442
Install current verified harness releases inside Docker, preserve persistent accounts and settings, and provide separate interactive and pipeline model defaults with terminal onboarding and fuzzy pickers. Add Docker-aware authoring transport, Pi stage execution, bounded workflow controls, reliable final-result readback and usage settlement, and finite short-lived CLI pipe draining. Keep dated installation evidence and packaged authoring guidance consistent. Verified with a real Docker installation, both harness stages and interactive authors, the built-in plan/implement/review starter, independent host race/vet checks, installer tests, and packaged skill tests. Generated release receipts stay ignored in clean checkouts.
48 lines
1.9 KiB
Go
48 lines
1.9 KiB
Go
package buildinfo
|
|
|
|
import (
|
|
"encoding/json"
|
|
"runtime/debug"
|
|
"testing"
|
|
)
|
|
|
|
func TestBuildIdentity(t *testing.T) {
|
|
build := &debug.BuildInfo{Main: debug.Module{Version: "(devel)"}, Settings: []debug.BuildSetting{
|
|
{Key: "vcs.revision", Value: "0123456789abcdef"}, {Key: "vcs.modified", Value: "true"},
|
|
}}
|
|
for _, tc := range []struct {
|
|
name string
|
|
build *debug.BuildInfo
|
|
version, commit, dirty, wantVersion, wantCommit string
|
|
wantDirty *bool
|
|
}{
|
|
{"native", build, "", "", "", "0123456789ab-dirty", "0123456789abcdef", boolPtr(true)},
|
|
{"docker", build, "v1.2", "fedcba", "false", "v1.2", "fedcba", boolPtr(false)},
|
|
{"dirty docker", nil, "0123456789ab-dirty", "0123456789abcdef", "true", "0123456789ab-dirty", "0123456789abcdef", boolPtr(true)},
|
|
{"unknown", nil, "", "", "", "dev", "unknown", nil},
|
|
{"unstamped docker", nil, "dev", "unknown", "unknown", "dev", "unknown", nil},
|
|
{"module version", &debug.BuildInfo{Main: debug.Module{Version: "v1.2.3"}}, "", "", "", "v1.2.3", "unknown", nil},
|
|
{"Go dirty version", build, "v0.0.0-20261010195542-0123456789ab+dirty", "", "", "v0.0.0-20261010195542-0123456789ab-dirty", "0123456789abcdef", boolPtr(true)},
|
|
} {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
got := resolve(tc.build, tc.version, tc.commit, tc.dirty)
|
|
if got.Version != tc.wantVersion || got.Commit != tc.wantCommit || (got.Dirty == nil) != (tc.wantDirty == nil) || (got.Dirty != nil && *got.Dirty != *tc.wantDirty) {
|
|
t.Fatalf("unexpected identity: %+v", got)
|
|
}
|
|
data, err := json.Marshal(got)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var roundtrip Info
|
|
if err := json.Unmarshal(data, &roundtrip); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if (roundtrip.Dirty == nil) != (got.Dirty == nil) {
|
|
t.Fatal("lost unknown dirty state")
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func boolPtr(value bool) *bool { return &value }
|