package checks import ( "bytes" "context" "encoding/json" "io" "os" "os/exec" "path/filepath" "slices" "strings" "sync" "testing" "time" "amadan.net/oficina/equipo/internal/equipo/team" "amadan.net/oficina/equipo/internal/runner/provider" ) func must(t *testing.T, err error) { t.Helper() if err != nil { t.Fatal(err) } } func put(t *testing.T, root, name, content string) { t.Helper() must(t, os.MkdirAll(filepath.Dir(filepath.Join(root, name)), 0700)) must(t, os.WriteFile(filepath.Join(root, name), []byte(content), 0600)) } func raw(v any) []byte { b, _ := json.Marshal(v); return b } const baseID = "1111111111111111111111111111111111111111" const fixID = "2222222222222222222222222222222222222222" const repoID = "https://example.test/team/repo" const bugTest = `package fixture import "testing" func TestBug(t *testing.T) { if Value()!=2 {t.Fatal("wrong value")} } ` const oldTest = `package fixture import "testing" func TestOld(t *testing.T) {t.Run("child",func(t *testing.T){})} ` type localSandbox struct{} func (localSandbox) Run(ctx context.Context, c Command, w string, _ provider.ReadPolicy, out, errout io.Writer) (int, error) { cmd := exec.CommandContext(ctx, c.Argv[0], c.Argv[1:]...) cmd.Dir = filepath.Join(w, c.Dir) cmd.Env = testEnv() cmd.Stdout = out cmd.Stderr = errout err := cmd.Run() if x, ok := err.(*exec.ExitError); ok { return x.ExitCode(), nil } return 0, err } func testEnv() []string { return append(os.Environ(), "CGO_ENABLED=0", "GOWORK=off", "GOFLAGS=", "GOTOOLCHAIN=local", "GOPROXY=off") } type fixture struct { e *Executor d Definition r Reproduction base, candidate string c team.GitCandidate hash string } var fixtureBaseline struct { sync.Once value TestBaseline err error } func newFixture(t *testing.T) fixture { t.Helper() b := t.TempDir() c := t.TempDir() for _, root := range []string{b, c} { put(t, root, "go.mod", "module fixture\n\ngo 1.26\n") put(t, root, "old_test.go", oldTest) } put(t, b, "value.go", "package fixture\nfunc Value() int {return 1}\n") put(t, c, "value.go", "package fixture\nfunc Value() int {return 2}\n") command := Command{Argv: []string{"go", "test", "-json", "-count=1", "./..."}, Dir: ".", Parser: "go-test-json", TimeoutSeconds: 30} d, err := ParseDefinition(context.Background(), raw(Definition{Version: 1, Repository: repoID, Base: baseID, Commands: []Command{command}, Reproduction: command}), repoID, baseID) must(t, err) d, err = FreezeMaterial(context.Background(), d, b) must(t, err) r := Reproduction{ExpectedSymptom: "wrong value", Files: []File{{Path: "bug_test.go", Bytes: []byte(bugTest)}}, TestNames: []TestIdentity{{Package: "fixture", Name: "TestBug"}}} cand := team.GitCandidate{Repository: repoID, BaseCommit: baseID, Commit: fixID, Tree: strings.Repeat("3", 40)} cfg := Config{ResolveCandidate: func(_ context.Context, hash string) (team.GitCandidate, error) { if hash != CandidateHash(cand) { return team.GitCandidate{}, provider.ErrIdentity } return cand, nil }, Reproduction: func(context.Context, string) (Reproduction, error) { return r, nil }, ScratchRoot: t.TempDir(), Scope: team.Scope{Account: "team", Job: 1}, Handle: team.Handle{Attempt: 1, Fence: 1, Runner: "runner"}, Deadline: time.Now().Add(time.Minute), Policy: provider.ReadPolicy{ConfigHash: "policy", DeniedPaths: []string{t.TempDir()}}, Export: func(ctx context.Context, commit, dest string) error { src := c if commit == baseID { src = b } return copyTree(src, dest) }, Isolation: func(context.Context) (team.IsolationSnapshot, error) { return team.IsolationSnapshot{Status: "confined", RunnerTainted: true, AcknowledgementIDs: []string{"ack"}, ObservedTuples: []team.IsolationTuple{{Provider: "codex"}}}, nil }} e, err := newExecutor(cfg, localSandbox{}) must(t, err) e.SetAttestationStore(durableFixture{}) fixtureBaseline.Do(func() { fixtureBaseline.value, fixtureBaseline.err = e.CaptureBaseline(context.Background(), d) }) must(t, fixtureBaseline.err) d.Baseline = fixtureBaseline.value d.Baseline.Names = slices.Clone(fixtureBaseline.value.Names) e.cfg.DefinitionHash = Digest(raw(d)) e.cfg.ReproductionHash = Digest(raw(r)) return fixture{e, d, r, b, c, cand, CandidateHash(cand)} } func TestFrozenReproduction(t *testing.T) { f := newFixture(t) base, err := f.e.Reproduce(context.Background(), f.d, f.r, baseID, "") must(t, err) if base.Outcome != team.CheckFail || base.SubjectHash != baseID || base.TestsRun < 1 || base.TestsFailed < 1 || !base.CollisionChecked { t.Fatalf("bad base evidence: %+v", base) } log, err := f.e.Log(context.Background(), base.LogHash) must(t, err) if Digest(log) != base.LogHash { t.Fatal("log digest mismatch") } pass, err := f.e.Reproduce(context.Background(), f.d, f.r, fixID, f.hash) must(t, err) if pass.Outcome != team.CheckPass || pass.SubjectHash != f.hash || pass.OverlayHash != base.OverlayHash { t.Fatalf("bad candidate evidence: %+v", pass) } for _, change := range []string{"bytes", "symptom", "names", "command", "definition_command", "definition_bytes", "hash", "base"} { t.Run(change, func(t *testing.T) { d := f.d r := f.r r.Files = append([]File(nil), r.Files...) subject := fixID hash := f.hash switch change { case "bytes": r.Files[0].Bytes = []byte("changed") case "symptom": r.ExpectedSymptom = "other" case "names": r.TestNames = nil case "definition_command": d.Commands = append([]Command(nil), d.Commands...) d.Commands[0].TimeoutSeconds-- d.Reproduction.TimeoutSeconds-- case "definition_bytes": d.Files = append([]File(nil), d.Files...) d.Files[0].Bytes = []byte("changed frozen file") case "command": d.Reproduction.Argv = []string{"true"} case "hash": hash = "" case "base": subject = "bad" } if _, err := f.e.Reproduce(context.Background(), d, r, subject, hash); err == nil { t.Fatal("changed frozen evidence accepted") } }) } entries, err := os.ReadDir(f.e.cfg.ScratchRoot) must(t, err) if len(entries) != 0 { t.Fatal("scratch retained") } } func TestTrustedBaseCheckDefinitions(t *testing.T) { f := newFixture(t) for _, change := range []string{"wrong_base", "unknown", "duplicate", "no_test", "timeout", "parser", "traversal", "filter", "baseline", "platform", "tags"} { t.Run(change, func(t *testing.T) { d := f.d d.Commands = append([]Command(nil), d.Commands...) b := raw(d) switch change { case "baseline": d.Baseline.Hash = strings.Repeat("a", 64) case "platform": d.GOOS = "other" case "tags": d.Reproduction.Argv = append(append([]string(nil), d.Reproduction.Argv...), "-tags=other") case "wrong_base": d.Base = fixID case "unknown": b = append([]byte(`{"bogus":1,`), b[1:]...) case "duplicate": b = append([]byte(`{"version":1,`), b[1:]...) case "no_test": d.Commands = nil case "timeout": d.Commands[0].TimeoutSeconds = 1201 case "parser": d.Commands[0].Parser = "exit" case "traversal": d.Commands[0].Dir = "../" case "filter": d.Commands[0].Argv = []string{"go", "test", "-json", "-run=TestOld"} } if change != "unknown" && change != "duplicate" { b = raw(d) } if _, err := ParseDefinition(context.Background(), b, repoID, baseID); err == nil { t.Fatal("unsafe definition accepted") } }) } put(t, f.base, "scripts/gate.sh", "echo trusted\n") trusted := f.d trusted.TrustedPaths = []string{"scripts"} d, err := FreezeMaterial(context.Background(), trusted, f.base) must(t, err) if len(d.Files) < 2 { t.Fatal("transitive material not frozen") } } func TestReproductionOverlayCollision(t *testing.T) { for _, kind := range []string{"edited", "traversal", "absolute", "symlink", "duplicate", "non_test", "unchanged", "frozen"} { t.Run(kind, func(t *testing.T) { f := newFixture(t) r := f.r switch kind { case "edited": put(t, f.candidate, "bug_test.go", "candidate fix") case "traversal": r.Files[0].Path = "../bad_test.go" case "absolute": r.Files[0].Path = "/bad_test.go" case "symlink": must(t, os.Symlink(f.base, filepath.Join(f.candidate, "link"))) r.Files[0].Path = "link/bug_test.go" case "duplicate": r.Files = append(r.Files, r.Files[0]) case "non_test": r.Files[0].Path = "value.go" case "unchanged": put(t, f.base, "bug_test.go", "package fixture\n") put(t, f.candidate, "bug_test.go", "package fixture\n") case "frozen": put(t, f.candidate, "bug_test.go", bugTest) } f.e.cfg.ReproductionHash = Digest(raw(r)) _, err := f.e.Reproduce(context.Background(), f.d, r, fixID, f.hash) if kind == "unchanged" || kind == "frozen" { must(t, err) } else if err == nil { t.Fatal("unsafe overlay accepted") } if kind == "edited" { b, err := os.ReadFile(filepath.Join(f.candidate, "bug_test.go")) must(t, err) if string(b) != "candidate fix" { t.Fatal("fix overwritten") } } }) } } func TestRepositoryTestSetSuperset(t *testing.T) { f := newFixture(t) put(t, f.candidate, "extra_test.go", "package fixture\nimport \"testing\"\nfunc TestExtra(t *testing.T){}\n") result, err := f.e.RepositoryChecks(context.Background(), f.d, f.c, f.hash) must(t, err) if result.Outcome != team.CheckPass || result.ObservedTestSetHash == result.BaselineTestSetHash || len(result.ObservedNames) < 4 { t.Fatalf("extra tests rejected: %+v", result) } if !result.Isolation.RunnerTainted || result.Isolation.Status != "unconfined" { t.Fatal("repository checks lost runner taint") } spec := team.ArtifactSpec{Role: team.RoleRepositoryChecks, Payload: raw(result)} _, err = f.e.ValidateEvidence(context.Background(), nil, f.e.cfg.Scope, f.e.cfg.Handle, spec) must(t, err) result.Isolation.RunnerTainted = false spec.Payload = raw(result) if _, err = f.e.ValidateEvidence(context.Background(), nil, f.e.cfg.Scope, f.e.cfg.Handle, spec); err == nil { t.Fatal("stripped repository taint registered") } put(t, f.candidate, "old_test.go", strings.ReplaceAll(oldTest, "TestOld", "TestRenamed")) if _, err = f.e.RepositoryChecks(context.Background(), f.d, f.c, f.hash); err == nil { t.Fatal("renamed baseline accepted") } } func TestRepositoryDeletedTestFile(t *testing.T) { f := newFixture(t) must(t, os.Remove(filepath.Join(f.candidate, "old_test.go"))) put(t, f.candidate, "renamed_test.go", oldTest) if _, err := f.e.RepositoryChecks(context.Background(), f.d, f.c, f.hash); err == nil { t.Fatal("deleted test file accepted") } } func TestRepositoryTSkipRejected(t *testing.T) { f := newFixture(t) put(t, f.candidate, "old_test.go", strings.ReplaceAll(oldTest, "func(t *testing.T){}", "func(t *testing.T){t.Skip(\"skip\")}")) if _, err := f.e.RepositoryChecks(context.Background(), f.d, f.c, f.hash); err == nil { t.Fatal("skipped subtest accepted") } } func TestExecutorEvidenceOutcomes(t *testing.T) { f := newFixture(t) for _, kind := range []string{"compile", "skip", "zero", "symptom"} { t.Run(kind, func(t *testing.T) { r := f.r r.Files = append([]File(nil), r.Files...) switch kind { case "compile": r.Files[0].Bytes = []byte("bad go") case "skip": r.Files[0].Bytes = []byte(strings.ReplaceAll(bugTest, "t.Fatal(\"wrong value\")", "t.Skip(\"wrong value\")")) case "zero": r.Files[0].Bytes = []byte("package fixture") case "symptom": r.ExpectedSymptom = "different symptom" } f.e.cfg.ReproductionHash = Digest(raw(r)) if _, err := f.e.Reproduce(context.Background(), f.d, r, baseID, ""); err == nil { t.Fatal("invalid evidence accepted") } }) } f.e.cfg.ReproductionHash = Digest(raw(f.r)) r, err := f.e.Reproduce(context.Background(), f.d, f.r, baseID, "") must(t, err) if !r.Isolation.RunnerTainted || r.Isolation.Status != "unconfined" { t.Fatal("executor erased concurrent runner exposure") } spec := team.ArtifactSpec{Role: team.RoleBaseResult, Payload: raw(r)} _, err = f.e.ValidateEvidence(context.Background(), nil, f.e.cfg.Scope, f.e.cfg.Handle, spec) must(t, err) stale := f.e.cfg.Handle stale.Fence++ if _, err = f.e.ValidateEvidence(context.Background(), nil, f.e.cfg.Scope, stale, spec); err == nil { t.Fatal("executor attestation crossed current fence") } r.Isolation.RunnerTainted = false r.Isolation.Status = "confined" spec.Payload = raw(r) if _, err = f.e.ValidateEvidence(context.Background(), nil, f.e.cfg.Scope, f.e.cfg.Handle, spec); err == nil { t.Fatal("stripped taint registered") } spec.Payload = []byte(`{"outcome":"pass"}`) if _, err = f.e.ValidateEvidence(context.Background(), nil, f.e.cfg.Scope, f.e.cfg.Handle, spec); err == nil { t.Fatal("agent fabricated executor result") } } func TestExecutorStreaming(t *testing.T) { for _, kind := range []string{"complete", "incomplete", "truncated", "no_tests", "skip", "build", "timeout", "large"} { t.Run(kind, func(t *testing.T) { s := newGoResults() data := `{"Action":"start","Package":"p"}` + "\n" + `{"Action":"run","Package":"p","Test":"TestOne"}` + "\n" switch kind { case "no_tests": data = `{"Action":"start","Package":"p"}` + "\n" case "skip": data += `{"Action":"skip","Package":"p","Test":"TestOne"}` + "\n" case "build": data += `{"Action":"build-fail","Package":"p"}` + "\n" case "large": for range 1000 { data += `{"Action":"output","Package":"p","Test":"TestOne","Output":"` + strings.Repeat("x", 100) + `"}` + "\n" } } if kind == "incomplete" { data += `{"Action":"pass","Package":"p"}` + "\n" } else if kind == "no_tests" { data += `{"Action":"pass","Package":"p"}` + "\n" } else if kind != "incomplete" { data += `{"Action":"pass","Package":"p","Test":"TestOne"}` + "\n" + `{"Action":"pass","Package":"p"}` + "\n" } if kind == "truncated" { data += `{"Action":` } for _, chunk := range bytes.SplitAfter([]byte(data), []byte("\n")) { _, err := s.Write(chunk) must(t, err) } err := s.finish(0, nil) if kind == "complete" || kind == "large" { must(t, err) if len(s.log.Bytes()) > 65536 { t.Fatal("unbounded retained output") } } else if kind != "timeout" && err == nil { t.Fatal("invalid stream accepted") } if kind == "timeout" && s.finish(0, context.DeadlineExceeded) == nil { t.Fatal("timeout accepted") } }) } } func TestExecutorCandidateBinding(t *testing.T) { f := newFixture(t) if _, err := f.e.Reproduce(context.Background(), f.d, f.r, fixID, strings.Repeat("a", 64)); err == nil { t.Fatal("unverified candidate hash accepted") } if _, err := f.e.Reproduce(context.Background(), f.d, f.r, baseID, f.hash); err == nil { t.Fatal("candidate hash bound to wrong commit") } } func TestTrustedGateAndBaseline(t *testing.T) { f := newFixture(t) put(t, f.base, "gate.sh", "#!/bin/sh\nexit 1\n") put(t, f.candidate, "gate.sh", "#!/bin/sh\nexit 0\n") trusted := f.d trusted.TrustedPaths = []string{"gate.sh"} d, err := FreezeMaterial(context.Background(), trusted, f.base) must(t, err) d.Commands = append(d.Commands, Command{Argv: []string{"/bin/sh", "gate.sh"}, Dir: ".", Parser: "exit", TimeoutSeconds: 10}) f.e.cfg.DefinitionHash = Digest(raw(d)) if _, err = f.e.RepositoryChecks(context.Background(), d, f.c, f.hash); err == nil { t.Fatal("candidate replaced trusted gate") } put(t, f.base, "known_test.go", bugTest) d, err = FreezeMaterial(context.Background(), f.d, f.base) must(t, err) baseline, err := f.e.CaptureBaseline(context.Background(), d) must(t, err) if !superset(baseline.Names, []TestIdentity{{Package: "fixture", Name: "TestBug"}}) { t.Fatal("known failing test omitted from baseline") } put(t, f.base, "known_test.go", "invalid Go") if _, err = f.e.CaptureBaseline(context.Background(), d); err == nil { t.Fatal("incomplete baseline accepted") } } func TestTrustedBaseImmutableDefinition(t *testing.T) { root := t.TempDir() cmd := Command{Argv: []string{"go", "test", "-json", "-count=1", "./..."}, Dir: ".", Parser: "go-test-json", TimeoutSeconds: 30} put(t, root, ".equipo/checks.json", string(raw(map[string]any{"version": 1, "commands": []Command{cmd}, "reproduction": cmd}))) put(t, root, "go.mod", "module fixture\n\ngo 1.26\n") put(t, root, "old_test.go", oldTest) git := func(args ...string) string { t.Helper() c := exec.Command("git", args...) c.Dir = root c.Env = append(testEnv(), "GIT_CONFIG_NOSYSTEM=1", "GIT_CONFIG_GLOBAL=/dev/null") b, err := c.CombinedOutput() if err != nil { t.Fatalf("git %v: %s", args, b) } return strings.TrimSpace(string(b)) } git("init", "-q") git("add", ".") git("-c", "user.name=fixture", "-c", "user.email=fixture@example.test", "-c", "commit.gpgSign=false", "commit", "-qm", "fixture") commit := git("rev-parse", "HEAD") put(t, root, ".equipo/checks.json", "changed after base") d, err := LoadBaseDefinition(context.Background(), root, repoID, commit, t.TempDir()) must(t, err) if d.Base != commit || len(d.Commands) != 1 || len(d.TestFiles) != 1 { t.Fatal("definition was not read from base") } if _, err = LoadBaseDefinition(context.Background(), root, repoID, fixID, t.TempDir()); err == nil { t.Fatal("unknown base accepted") } must(t, os.Remove(filepath.Join(root, ".equipo/checks.json"))) put(t, root, ".amadan/ci", "go test ./...\n") git("add", ".") git("-c", "user.name=fixture", "-c", "user.email=fixture@example.test", "-c", "commit.gpgSign=false", "commit", "-qm", "no adapter") commit = git("rev-parse", "HEAD") if _, err = LoadBaseDefinition(context.Background(), root, repoID, commit, t.TempDir()); err == nil { t.Fatal("unreviewed CI adapter accepted") } } func TestTrustedGatesFreshCopies(t *testing.T) { f := newFixture(t) put(t, f.base, "gate.sh", "#!/bin/sh\ntest ! -f modified\n") put(t, f.base, "touch.sh", "touch modified\n") put(t, f.candidate, "gate.sh", "#!/bin/sh\nexit 0\n") trusted := f.d trusted.TrustedPaths = []string{"gate.sh", "touch.sh"} d, err := FreezeMaterial(context.Background(), trusted, f.base) must(t, err) d.Commands = append(d.Commands, Command{Argv: []string{"/bin/sh", "touch.sh"}, Dir: ".", Parser: "exit", TimeoutSeconds: 10}, Command{Argv: []string{"/bin/sh", "gate.sh"}, Dir: ".", Parser: "exit", TimeoutSeconds: 10}) f.e.cfg.DefinitionHash = Digest(raw(d)) if _, err = f.e.RepositoryChecks(context.Background(), d, f.c, f.hash); err != nil { t.Fatal("earlier command changed a later gate's workspace", err) } } func TestExecutorHistoricalExposure(t *testing.T) { f := newFixture(t) r, err := f.e.Reproduce(context.Background(), f.d, f.r, baseID, "") must(t, err) f.e.cfg.Isolation = func(context.Context) (team.IsolationSnapshot, error) { return team.IsolationSnapshot{Status: "confined", ObservedTuples: []team.IsolationTuple{{Provider: "claude"}}}, nil } again, err := f.e.Reproduce(context.Background(), f.d, f.r, baseID, "") must(t, err) if !again.Isolation.RunnerTainted || again.Isolation.Status != "unconfined" { t.Fatal("historical runner taint erased") } h := f.e.cfg.Handle h.Fence++ if _, err = f.e.ValidateEvidence(context.Background(), nil, f.e.cfg.Scope, h, team.ArtifactSpec{Role: team.RoleBaseResult, Payload: raw(r)}); err == nil { t.Fatal("attestation crossed fence") } } func TestReproductionOverlayPathValidation(t *testing.T) { root := t.TempDir() outside := t.TempDir() must(t, os.Symlink(outside, filepath.Join(root, "link"))) for _, path := range []string{"../escape_test.go", "/escape_test.go", "link/escape_test.go"} { if err := safePath(root, path, true); err == nil { t.Fatal("unsafe path accepted", path) } } if err := filesValid([]File{{Path: "same_test.go"}, {Path: "same_test.go"}}, true); err == nil { t.Fatal("duplicate overlay accepted") } } func TestExecutorCanonicalCandidateHash(t *testing.T) { f := newFixture(t) canonical := []byte(`{"base_commit":"1111111111111111111111111111111111111111","commit":"2222222222222222222222222222222222222222","repository":"https://example.test/team/repo","tree":"3333333333333333333333333333333333333333"}`) hash := Digest(canonical) f.e.cfg.ResolveCandidate = func(context.Context, string) (team.GitCandidate, error) { return f.c, nil } r, err := f.e.Reproduce(context.Background(), f.d, f.r, fixID, hash) must(t, err) if r.SubjectHash != hash { t.Fatal("candidate subject does not use canonical artifact hash") } if _, err = f.e.RepositoryChecks(context.Background(), f.d, f.c, hash); err != nil { t.Fatal("repository checks rejected canonical artifact", err) } } func TestExecutorProductionDependencies(t *testing.T) { f := newFixture(t) if _, err := New(f.e.cfg, &CodexSandbox{}); err == nil { t.Fatal("empty production sandbox accepted") } } func TestTrustedMaterialPreservesCandidateData(t *testing.T) { f := newFixture(t) put(t, f.base, "data.json", "old") put(t, f.candidate, "data.json", "fixed") put(t, f.candidate, "data_test.go", `package fixture import("testing";"os") func TestData(t *testing.T){b,e:=os.ReadFile("data.json");if e!=nil||string(b)!="fixed"{t.Fatal("candidate data was replaced")}} `) d, err := FreezeMaterial(context.Background(), f.d, f.base) must(t, err) f.e.cfg.DefinitionHash = Digest(raw(d)) if _, err = f.e.RepositoryChecks(context.Background(), d, f.c, f.hash); err != nil { t.Fatal("candidate data changed by trusted overlay", err) } } func TestTrustedMaterialDirectory(t *testing.T) { f := newFixture(t) put(t, f.base, "controls/helper.sh", "value=trusted\n") put(t, f.base, "controls/gate.sh", ". controls/helper.sh\ntest \"$value\" = trusted && test ! -e controls/extra.sh\n") put(t, f.candidate, "controls/helper.sh", "value=changed\n") put(t, f.candidate, "controls/extra.sh", "injected\n") d := f.d d.TrustedPaths = []string{"controls"} d, err := FreezeMaterial(context.Background(), d, f.base) must(t, err) d.Commands = append(d.Commands, Command{Argv: []string{"/bin/sh", "controls/gate.sh"}, Dir: ".", Parser: "exit", TimeoutSeconds: 10}) f.e.cfg.DefinitionHash = Digest(raw(d)) if _, err = f.e.RepositoryChecks(context.Background(), d, f.c, f.hash); err != nil { t.Fatal("trusted dependency tree was not restored", err) } } func TestTrustedUndeclaredScript(t *testing.T) { f := newFixture(t) d := f.d d.Commands = append(d.Commands, Command{Argv: []string{"/bin/sh", "gate.sh"}, Dir: ".", Parser: "exit", TimeoutSeconds: 10}) if _, err := ParseDefinition(context.Background(), raw(d), repoID, baseID); err == nil { t.Fatal("undeclared command material accepted") } }