package inventory import ( "reflect" "testing" "time" "github.com/novox/mesh-controller/internal/chain" ) // **A request is the build record in state asked, under the id its outcome will carry** (ADR 0408 ยง1, issue 1091): the // whole ask is in it, with a path trimmed as the table kept it. func TestABuildRequestIsTheBuildRecordInStateAsked(t *testing.T) { at := time.Date(2026, 10, 18, 3, 0, 0, 0, time.UTC) ask := BuildRequest{ID: "build-1", Repository: "https://forge.invalid/notes.git", Seat: "", Path: "/modules/notes/", Ref: "main", Commit: "c1", For: "merge", NotAsked: "", OutcomeUnknown: "", At: at, AtTerminal: true} record := askedRecord(ask) if record.State != chain.BuildAsked || record.ID != "build-1" || record.Path != "modules/notes" || !record.Asked.Equal(at) { t.Fatalf("the request is %+v", record) } if got := fromRequest(record.ID, *record.Request); !reflect.DeepEqual(got, BuildRequest{ID: "build-1", Repository: ask.Repository, Path: "modules/notes", Ref: "main", Commit: "c1", For: "merge", At: at, AtTerminal: true}) { t.Fatalf("the request reads back as %+v", got) } }