Carry dependencies through operator commands

This commit is contained in:
2026-09-05 18:00:50 +00:00
parent dd905c4daa
commit f51b9bb046
17 changed files with 182 additions and 172 deletions

View File

@@ -232,7 +232,7 @@ func TestExecuteSessionSubcommandsAcceptPositionalSessionID(t *testing.T) {
fake.SeedObject(storage.FakeObject{Key: runIDKey, Data: []byte("20260519T010203Z-a1b2c3d4\n")})
fake.SeedObject(storage.FakeObject{Key: manifestKey, Data: restoreManifestJSON(t, "2026-05-03", "sample-campaign")})
var storeInitCalls int
restoreAppConfigTestGlobals(t, fake, &storeInitCalls, []string{sessionPath})
deps := fakeCommandDependencies(fake, &storeInitCalls)
tests := []struct {
name string
@@ -270,7 +270,7 @@ func TestExecuteSessionSubcommandsAcceptPositionalSessionID(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
var stdout bytes.Buffer
var stderr bytes.Buffer
code := Execute(tt.args, &stdout, &stderr)
code := executeWithDependencies(tt.args, &stdout, &stderr, deps, executePlan)
if code != 0 {
t.Fatalf("exit code = %d, want 0; stdout=%q stderr=%q", code, stdout.String(), stderr.String())
}
@@ -311,17 +311,17 @@ func TestExecuteSessionLocksMutationAcceptsPositionalSessionID(t *testing.T) {
pipelinePath, campaignPath, sessionPath := writeValidConfigFiles(t, workspaceRoot)
fake := &storage.FakeBackend{}
var storeInitCalls int
restoreAppConfigTestGlobals(t, fake, &storeInitCalls, []string{sessionPath})
deps := fakeCommandDependencies(fake, &storeInitCalls)
var stdout bytes.Buffer
var stderr bytes.Buffer
code := Execute([]string{
code := executeWithDependencies([]string{
"session", "locks", "add", "2026-05-03", "narratio.transcript.final_trimmed",
"--config", pipelinePath,
"--campaign-file", campaignPath,
"--session", sessionPath,
"--reason", "review",
}, &stdout, &stderr)
}, &stdout, &stderr, deps, executePlan)
if code != 0 {
t.Fatalf("locks add exit code = %d, want 0; stderr=%q", code, stderr.String())
}
@@ -336,12 +336,12 @@ func TestExecuteSessionLocksMutationAcceptsPositionalSessionID(t *testing.T) {
stdout.Reset()
stderr.Reset()
code = Execute([]string{
code = executeWithDependencies([]string{
"session", "locks", "remove", "2026-05-03", "narratio.transcript.final_trimmed",
"--config", pipelinePath,
"--campaign-file", campaignPath,
"--session", sessionPath,
}, &stdout, &stderr)
}, &stdout, &stderr, deps, executePlan)
if code != 0 {
t.Fatalf("locks remove exit code = %d, want 0; stderr=%q", code, stderr.String())
}