Finish native completion and retire legacy command machinery
This commit is contained in:
@@ -158,7 +158,7 @@ func TestExecuteSessionInitRequiresSessionID(t *testing.T) {
|
||||
if code == 0 {
|
||||
t.Fatal("exit code = 0, want non-zero")
|
||||
}
|
||||
if !strings.Contains(stderr.String(), "session init: session_id is required") {
|
||||
if code != 2 {
|
||||
t.Fatalf("stderr = %q, want session-id required error", stderr.String())
|
||||
}
|
||||
}
|
||||
@@ -454,14 +454,14 @@ inputs:
|
||||
|
||||
var stdout bytes.Buffer
|
||||
var stderr bytes.Buffer
|
||||
code := executeWithDependencies([]string{"session", "validate", "2026-05-03", "--config", pipelinePath, "--campaign-file", campaignPath, "--session", sessionPath, "--secrets-dir", secretsDir}, &stdout, &stderr, deps, executePlan)
|
||||
code := executeWithDependencies([]string{"session", "validate", "2026-05-03", "--config", pipelinePath, "--campaign-file", campaignPath, "--session-file", sessionPath, "--secrets-dir", secretsDir}, &stdout, &stderr, deps, executePlan)
|
||||
if code != 0 {
|
||||
t.Fatalf("exit code = %d, want 0; stdout=%q stderr=%q", code, stdout.String(), stderr.String())
|
||||
}
|
||||
if !strings.Contains(stdout.String(), "OK audio") {
|
||||
if !findingMatches(decodeNativeReport[sessionValidationReport](t, stdout.Bytes()).Findings, "OK", "audio", "") {
|
||||
t.Fatalf("stdout = %q, want OK audio", stdout.String())
|
||||
}
|
||||
if !strings.Contains(stdout.String(), "OK inputs players:") || !strings.Contains(stdout.String(), "OK inputs party:") {
|
||||
if !findingMatches(decodeNativeReport[sessionValidationReport](t, stdout.Bytes()).Findings, "OK", "inputs", "players:") || !findingMatches(decodeNativeReport[sessionValidationReport](t, stdout.Bytes()).Findings, "OK", "inputs", "party:") {
|
||||
t.Fatalf("stdout = %q, want players and party input findings", stdout.String())
|
||||
}
|
||||
}
|
||||
@@ -486,8 +486,7 @@ func TestOperatorCommandsReportConfiguredSpellCatalog(t *testing.T) {
|
||||
commonArgs := []string{
|
||||
"2026-05-03",
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
}
|
||||
|
||||
var stdout bytes.Buffer
|
||||
@@ -496,7 +495,7 @@ func TestOperatorCommandsReportConfiguredSpellCatalog(t *testing.T) {
|
||||
if code := executeWithDependencies(validateArgs, &stdout, &stderr, deps, executePlan); code != 0 {
|
||||
t.Fatalf("validate exit code = %d, want 0; stdout=%q stderr=%q", code, stdout.String(), stderr.String())
|
||||
}
|
||||
if !strings.Contains(stdout.String(), "OK inputs spell_catalog: "+spellPath) {
|
||||
if !findingMatches(decodeNativeReport[sessionValidationReport](t, stdout.Bytes()).Findings, "OK", "inputs", spellPath) {
|
||||
t.Fatalf("validate stdout = %q, want spell catalog finding", stdout.String())
|
||||
}
|
||||
|
||||
@@ -506,7 +505,7 @@ func TestOperatorCommandsReportConfiguredSpellCatalog(t *testing.T) {
|
||||
if code := executeWithDependencies(statusArgs, &stdout, &stderr, deps, executePlan); code != 0 {
|
||||
t.Fatalf("status exit code = %d, want 0; stdout=%q stderr=%q", code, stdout.String(), stderr.String())
|
||||
}
|
||||
if !strings.Contains(stdout.String(), "Stable input spell_catalog: "+spellPath) {
|
||||
if !findingMatches(decodeNativeReport[sessionStateReport](t, stdout.Bytes()).Findings, "INFO", "inputs", spellPath) {
|
||||
t.Fatalf("status stdout = %q, want spell catalog inventory", stdout.String())
|
||||
}
|
||||
|
||||
@@ -518,7 +517,7 @@ func TestOperatorCommandsReportConfiguredSpellCatalog(t *testing.T) {
|
||||
if code := executeWithDependencies(validateArgs, &stdout, &stderr, deps, executePlan); code == 0 {
|
||||
t.Fatalf("validate missing spell catalog exit code = 0; stdout=%q", stdout.String())
|
||||
}
|
||||
if !strings.Contains(stdout.String(), "ERROR inputs spell_catalog missing:") {
|
||||
if !findingMatches(decodeNativeReport[sessionValidationReport](t, stdout.Bytes()).Findings, "ERROR", "inputs", "spell_catalog") {
|
||||
t.Fatalf("validate stdout = %q, want missing spell catalog finding", stdout.String())
|
||||
}
|
||||
}
|
||||
@@ -535,8 +534,7 @@ func TestExecuteLocksAddListAndRemoveUseIndependentObjects(t *testing.T) {
|
||||
code := executeWithDependencies([]string{
|
||||
"session", "locks", "add", "2026-05-03", "narratio.transcript.final_trimmed",
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
"--reason", "manual edit",
|
||||
}, &stdout, &stderr, deps, executePlan)
|
||||
if code != 0 {
|
||||
@@ -558,15 +556,14 @@ func TestExecuteLocksAddListAndRemoveUseIndependentObjects(t *testing.T) {
|
||||
stdout.Reset()
|
||||
stderr.Reset()
|
||||
code = executeWithDependencies([]string{
|
||||
"session", "locks", "2026-05-03",
|
||||
"session", "locks", "list", "2026-05-03",
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
}, &stdout, &stderr, deps, executePlan)
|
||||
if code != 0 {
|
||||
t.Fatalf("locks list exit code = %d, want 0; stderr=%q", code, stderr.String())
|
||||
}
|
||||
if !strings.Contains(stdout.String(), "- narratio.transcript.final_trimmed published reason=manual edit created_at=") {
|
||||
if len(decodeNativeReport[lockCommandReport](t, stdout.Bytes()).Locks) != 1 || decodeNativeReport[lockCommandReport](t, stdout.Bytes()).Locks[0].Reason != "manual edit" {
|
||||
t.Fatalf("stdout = %q, want remote lock", stdout.String())
|
||||
}
|
||||
|
||||
@@ -575,8 +572,7 @@ func TestExecuteLocksAddListAndRemoveUseIndependentObjects(t *testing.T) {
|
||||
code = executeWithDependencies([]string{
|
||||
"session", "locks", "remove", "2026-05-03", "narratio.transcript.final_trimmed",
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
}, &stdout, &stderr, deps, executePlan)
|
||||
if code != 0 {
|
||||
t.Fatalf("locks remove exit code = %d, want 0; stderr=%q", code, stderr.String())
|
||||
@@ -589,10 +585,9 @@ func TestExecuteLocksAddListAndRemoveUseIndependentObjects(t *testing.T) {
|
||||
code = executeWithDependencies([]string{
|
||||
"session", "locks", "remove", "2026-05-03", "narratio.transcript.final_trimmed",
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
}, &stdout, &stderr, deps, executePlan)
|
||||
if code != 0 || !strings.Contains(stdout.String(), "was not locked") {
|
||||
if code != 0 || decodeNativeReport[lockCommandReport](t, stdout.Bytes()).Result != "not_locked" {
|
||||
t.Fatalf("idempotent remove exit code = %d, stdout=%q stderr=%q", code, stdout.String(), stderr.String())
|
||||
}
|
||||
if storeInitCalls != 4 {
|
||||
@@ -609,17 +604,16 @@ func TestExecuteLocksListIsSortedAndRejectsMalformedObjects(t *testing.T) {
|
||||
sessionPrefix := artifacts.S3SessionPrefix("dnd", "sample-campaign", "2026-05-03")
|
||||
seedOperatorRemoteLock(t, fake, sessionPrefix, "narratio.transcript.final_trimmed", "second")
|
||||
seedOperatorRemoteLock(t, fake, sessionPrefix, "narratio.transcript.final", "first")
|
||||
args := []string{"session", "locks", "2026-05-03", "--config", pipelinePath, "--campaign-file", campaignPath, "--session", sessionPath}
|
||||
args := []string{"session", "locks", "list", "2026-05-03", "--config", pipelinePath, "--campaign-file", campaignPath, "--session-file", sessionPath}
|
||||
|
||||
var stdout bytes.Buffer
|
||||
var stderr bytes.Buffer
|
||||
if code := executeWithDependencies(args, &stdout, &stderr, deps, executePlan); code != 0 {
|
||||
t.Fatalf("locks list exit code = %d; stderr=%q", code, stderr.String())
|
||||
}
|
||||
first := strings.Index(stdout.String(), "narratio.transcript.final ")
|
||||
second := strings.Index(stdout.String(), "narratio.transcript.final_trimmed ")
|
||||
if first < 0 || second < 0 || first >= second {
|
||||
t.Fatalf("locks list is not source sorted: %q", stdout.String())
|
||||
locks := decodeNativeReport[lockCommandReport](t, stdout.Bytes()).Locks
|
||||
if len(locks) != 2 || locks[0].Source != "narratio.transcript.final" || locks[1].Source != "narratio.transcript.final_trimmed" {
|
||||
t.Fatalf("locks not source sorted: %#v", locks)
|
||||
}
|
||||
|
||||
badKey, err := artifacts.RemoteLockKey(sessionPrefix, "narratio.transcript.base")
|
||||
@@ -646,8 +640,7 @@ func TestExecuteLocksAddDuplicateRequiresForce(t *testing.T) {
|
||||
code := executeWithDependencies([]string{
|
||||
"session", "locks", "add", "2026-05-03", "narratio.transcript.final_trimmed",
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
"--reason", "first",
|
||||
}, &stdout, &stderr, deps, executePlan)
|
||||
if code != 0 {
|
||||
@@ -659,8 +652,7 @@ func TestExecuteLocksAddDuplicateRequiresForce(t *testing.T) {
|
||||
code = executeWithDependencies([]string{
|
||||
"session", "locks", "add", "2026-05-03", "narratio.transcript.final_trimmed",
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
"--reason", "second",
|
||||
}, &stdout, &stderr, deps, executePlan)
|
||||
if code == 0 {
|
||||
@@ -675,8 +667,7 @@ func TestExecuteLocksAddDuplicateRequiresForce(t *testing.T) {
|
||||
code = executeWithDependencies([]string{
|
||||
"session", "locks", "add", "2026-05-03", "narratio.transcript.final_trimmed",
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
"--reason", "second",
|
||||
"--force",
|
||||
}, &stdout, &stderr, deps, executePlan)
|
||||
@@ -720,38 +711,13 @@ func TestExecuteLocksForceReportsConcurrentReplacement(t *testing.T) {
|
||||
var stderr bytes.Buffer
|
||||
code := executeWithDependencies([]string{
|
||||
"session", "locks", "add", "2026-05-03", "narratio.transcript.final_trimmed", "--force",
|
||||
"--config", pipelinePath, "--campaign-file", campaignPath, "--session", sessionPath,
|
||||
"--config", pipelinePath, "--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
}, &stdout, &stderr, deps, executePlan)
|
||||
if code == 0 || !strings.Contains(stderr.String(), "changed concurrently; retry") {
|
||||
t.Fatalf("forced conflict exit code = %d, stderr=%q", code, stderr.String())
|
||||
}
|
||||
}
|
||||
|
||||
func TestExecuteLocksRequireSessionID(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
args []string
|
||||
want string
|
||||
}{
|
||||
{"list", []string{"session", "locks"}, "locks: session_id is required"},
|
||||
{"add", []string{"session", "locks", "add", "narratio.transcript.final_trimmed"}, "locks add: expected session_id and source id"},
|
||||
{"remove", []string{"session", "locks", "remove", "narratio.transcript.final_trimmed"}, "locks remove: expected session_id and source id"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
var stdout bytes.Buffer
|
||||
var stderr bytes.Buffer
|
||||
code := executeForTest(tt.args, &stdout, &stderr)
|
||||
if code == 0 {
|
||||
t.Fatal("exit code = 0, want non-zero")
|
||||
}
|
||||
if !strings.Contains(stderr.String(), tt.want) {
|
||||
t.Fatalf("stderr = %q, want %q", stderr.String(), tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestExecuteLocksMutationRejectsSessionIDMismatch(t *testing.T) {
|
||||
workspaceRoot := t.TempDir()
|
||||
pipelinePath, campaignPath, sessionPath := writeValidConfigFiles(t, workspaceRoot)
|
||||
@@ -766,21 +732,19 @@ func TestExecuteLocksMutationRejectsSessionIDMismatch(t *testing.T) {
|
||||
{
|
||||
name: "add mismatch",
|
||||
args: []string{
|
||||
"session", "locks", "add", "2026-05-03", "narratio.transcript.final_trimmed",
|
||||
"--session-id", "2026-05-04",
|
||||
"session", "locks", "add", "2026-05-04", "narratio.transcript.final_trimmed",
|
||||
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "remove mismatch",
|
||||
args: []string{
|
||||
"session", "locks", "remove", "2026-05-03", "narratio.transcript.final_trimmed",
|
||||
"--session-id", "2026-05-04",
|
||||
"session", "locks", "remove", "2026-05-04", "narratio.transcript.final_trimmed",
|
||||
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -792,7 +756,7 @@ func TestExecuteLocksMutationRejectsSessionIDMismatch(t *testing.T) {
|
||||
if code == 0 {
|
||||
t.Fatal("exit code = 0, want non-zero")
|
||||
}
|
||||
if !strings.Contains(stderr.String(), "does not match expected session id") {
|
||||
if !strings.Contains(stderr.String(), "session_id mismatch") {
|
||||
t.Fatalf("stderr = %q, want session-id mismatch guidance", stderr.String())
|
||||
}
|
||||
})
|
||||
@@ -809,7 +773,7 @@ func TestExecuteTopLevelLockAndUnlockAreRemoved(t *testing.T) {
|
||||
if code == 0 {
|
||||
t.Fatal("exit code = 0, want non-zero")
|
||||
}
|
||||
if !strings.Contains(stderr.String(), `unknown command: "`+cmd+`"`) {
|
||||
if code != 2 {
|
||||
t.Fatalf("stderr = %q, want unknown command", stderr.String())
|
||||
}
|
||||
})
|
||||
@@ -927,14 +891,13 @@ func TestExecuteArtifactsListRemoteReportsPublishedAvailability(t *testing.T) {
|
||||
code := executeWithDependencies([]string{
|
||||
"session", "artifacts", "2026-05-03",
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
"--remote",
|
||||
}, &stdout, &stderr, deps, executePlan)
|
||||
if code != 0 {
|
||||
t.Fatalf("exit code = %d, want 0; stderr=%q", code, stderr.String())
|
||||
}
|
||||
if !strings.Contains(stdout.String(), "narratio.transcript.final_trimmed remote=published") {
|
||||
if publishedReportOutput(t, stdout.Bytes(), "narratio.transcript.final_trimmed").State != "published" {
|
||||
t.Fatalf("stdout = %q, want published remote availability", stdout.String())
|
||||
}
|
||||
}
|
||||
@@ -962,23 +925,18 @@ func TestExecuteArtifactsListReportsExtractionLifecycleWithoutPayload(t *testing
|
||||
code := executeWithDependencies([]string{
|
||||
"session", "artifacts", "2026-05-03",
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
"--remote",
|
||||
}, &stdout, &stderr, deps, executePlan)
|
||||
if code != 0 {
|
||||
t.Fatalf("exit code = %d, want 0; stderr=%q", code, stderr.String())
|
||||
}
|
||||
out := stdout.String()
|
||||
for _, want := range []string{
|
||||
"Extraction:",
|
||||
"narratio.extraction.encounters planned available provenance=manifest.current_extract_run",
|
||||
"narratio.extraction.encounters dest=artifacts/encounters.json remote=published",
|
||||
} {
|
||||
if !strings.Contains(out, want) {
|
||||
t.Fatalf("stdout = %q, want %q", out, want)
|
||||
}
|
||||
entry := localReportArtifact(t, stdout.Bytes(), "narratio.extraction.encounters")
|
||||
if entry.Availability != "available" || entry.Provenance != artifacts.ArtifactProvenanceCurrentExtractManifest || publishedReportOutput(t, stdout.Bytes(), entry.Source).Destination != "artifacts/encounters.json" || publishedReportOutput(t, stdout.Bytes(), entry.Source).State != "published" {
|
||||
t.Fatalf("extraction state=%#v", entry)
|
||||
}
|
||||
|
||||
if strings.Contains(out, "DO_NOT_PRINT") {
|
||||
t.Fatalf("operator output exposed extraction payload: %q", out)
|
||||
}
|
||||
@@ -991,13 +949,12 @@ func TestExecuteArtifactsListReportsExtractionLifecycleWithoutPayload(t *testing
|
||||
code = executeWithDependencies([]string{
|
||||
"session", "artifacts", "2026-05-03",
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
}, &stdout, &stderr, deps, executePlan)
|
||||
if code != 0 {
|
||||
t.Fatalf("unavailable exit code = %d, want 0; stderr=%q", code, stderr.String())
|
||||
}
|
||||
if !strings.Contains(stdout.String(), "narratio.extraction.encounters planned unavailable") {
|
||||
if localReportArtifact(t, stdout.Bytes(), "narratio.extraction.encounters").Availability != "unavailable" {
|
||||
t.Fatalf("stdout = %q, want unavailable extraction state", stdout.String())
|
||||
}
|
||||
}
|
||||
@@ -1027,28 +984,16 @@ func TestExecuteArtifactsListRemoteUsesPublishOutputDestinations(t *testing.T) {
|
||||
code := executeWithDependencies([]string{
|
||||
"session", "artifacts", "2026-05-03",
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
"--remote",
|
||||
}, &stdout, &stderr, deps, executePlan)
|
||||
if code != 0 {
|
||||
t.Fatalf("exit code = %d, want 0; stderr=%q", code, stderr.String())
|
||||
}
|
||||
out := stdout.String()
|
||||
for _, unwanted := range []string{
|
||||
"narratio.transcript.final remote=missing",
|
||||
"narratio.bounds.session remote=missing",
|
||||
} {
|
||||
if strings.Contains(out, unwanted) {
|
||||
t.Fatalf("stdout = %q, did not want catalog remote marker %q", out, unwanted)
|
||||
}
|
||||
}
|
||||
for _, want := range []string{
|
||||
"narratio.transcript.final dest=transcripts/full.json remote=published",
|
||||
"narratio.bounds.session dest=transcripts/bounds.json remote=published",
|
||||
} {
|
||||
if !strings.Contains(out, want) {
|
||||
t.Fatalf("stdout = %q, want %q", out, want)
|
||||
for source, dest := range map[string]string{"narratio.transcript.final": "transcripts/full.json", "narratio.bounds.session": "transcripts/bounds.json"} {
|
||||
output := publishedReportOutput(t, stdout.Bytes(), source)
|
||||
if output.Destination != dest || output.State != "published" {
|
||||
t.Fatalf("published output=%#v", output)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1080,35 +1025,18 @@ func TestExecuteStatusReportsRemoteArtifactCatalog(t *testing.T) {
|
||||
code := executeWithDependencies([]string{
|
||||
"session", "status", "2026-05-03",
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
}, &stdout, &stderr, deps, executePlan)
|
||||
if code != 0 {
|
||||
t.Fatalf("exit code = %d, want 0; stderr=%q", code, stderr.String())
|
||||
}
|
||||
out := stdout.String()
|
||||
for _, want := range []string{
|
||||
"Remote outputs:",
|
||||
"Built-in:",
|
||||
"Configured:",
|
||||
"Previous-session:",
|
||||
"Published:",
|
||||
"narratio.transcript.final_trimmed locked",
|
||||
"narratio.transcript.final_trimmed locked remote=published",
|
||||
"narratio.transcript.final dest=transcripts/full.json remote=published",
|
||||
"Stable input players:",
|
||||
"Stable input party:",
|
||||
} {
|
||||
if !strings.Contains(out, want) {
|
||||
t.Fatalf("stdout = %q, want %q", out, want)
|
||||
}
|
||||
}
|
||||
if strings.Contains(out, "narratio.transcript.base remote=missing") {
|
||||
t.Fatalf("stdout = %q, did not want catalog remote marker", out)
|
||||
report := decodeNativeReport[sessionStateReport](t, stdout.Bytes())
|
||||
if publishedReportOutput(t, stdout.Bytes(), "narratio.transcript.final_trimmed").State != "published" || !findingMatches(report.Findings, "INFO", "inputs", "players:") || !findingMatches(report.Findings, "INFO", "inputs", "party:") {
|
||||
t.Fatalf("status=%#v", report)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExecuteStatusReportsRemoteArtifactCatalogErrorsWithoutFailing(t *testing.T) {
|
||||
func TestExecuteStatusReportsRemoteArtifactCatalogErrorsWithPartialData(t *testing.T) {
|
||||
workspaceRoot := t.TempDir()
|
||||
pipelinePath, campaignPath, sessionPath := writeValidConfigFiles(t, workspaceRoot)
|
||||
addPublishOutputsToPipeline(t, pipelinePath, `
|
||||
@@ -1126,18 +1054,14 @@ func TestExecuteStatusReportsRemoteArtifactCatalogErrorsWithoutFailing(t *testin
|
||||
code := executeWithDependencies([]string{
|
||||
"session", "status", "2026-05-03",
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
}, &stdout, &stderr, deps, executePlan)
|
||||
if code != 0 {
|
||||
if code != 1 {
|
||||
t.Fatalf("exit code = %d, want 0; stderr=%q", code, stderr.String())
|
||||
}
|
||||
out := stdout.String()
|
||||
if !strings.Contains(out, "Remote publish: missing or unavailable:") {
|
||||
t.Fatalf("stdout = %q, want remote publish unavailable state", out)
|
||||
}
|
||||
if !strings.Contains(out, "Remote outputs:") || !strings.Contains(out, "narratio.transcript.final_trimmed remote=error") {
|
||||
t.Fatalf("stdout = %q, want remote output error state", out)
|
||||
report := decodeNativeReport[sessionStateReport](t, stdout.Bytes())
|
||||
if report.Remote == nil || report.Remote.State != "error" || publishedReportOutput(t, stdout.Bytes(), "narratio.transcript.final_trimmed").State != "error" {
|
||||
t.Fatalf("partial status=%#v", report)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1153,18 +1077,17 @@ func TestExecuteStatusReportsMissingRemoteCurrentStateWithoutFailing(t *testing.
|
||||
code := executeWithDependencies([]string{
|
||||
"session", "status", "2026-05-03",
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
}, &stdout, &stderr, deps, executePlan)
|
||||
if code != 0 {
|
||||
t.Fatalf("exit code = %d, want 0; stderr=%q", code, stderr.String())
|
||||
}
|
||||
if !strings.Contains(stdout.String(), "Remote publish: missing or unavailable: remote current commit pointer missing") {
|
||||
if decodeNativeReport[sessionStateReport](t, stdout.Bytes()).Remote.State != "missing" {
|
||||
t.Fatalf("stdout = %q, want missing remote current-state line", stdout.String())
|
||||
}
|
||||
}
|
||||
|
||||
func TestExecuteStatusReportsPreviousStateReadinessWithoutFailing(t *testing.T) {
|
||||
func TestExecuteStatusReportsPreviousStateReadinessFailure(t *testing.T) {
|
||||
workspaceRoot := t.TempDir()
|
||||
pipelinePath, campaignPath, sessionPath := writeValidConfigFilesWithScriptoriumArtifacts(t, workspaceRoot)
|
||||
replaceInFileOrFatal(t, pipelinePath, "source: narratio.artifact.session_recap", "source: narratio.previous_session.artifact.session_recap")
|
||||
@@ -1178,13 +1101,12 @@ func TestExecuteStatusReportsPreviousStateReadinessWithoutFailing(t *testing.T)
|
||||
code := executeWithDependencies([]string{
|
||||
"session", "status", "2026-05-03",
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
}, &stdout, &stderr, deps, executePlan)
|
||||
if code != 0 {
|
||||
if code != 1 {
|
||||
t.Fatalf("exit code = %d, want 0; stderr=%q", code, stderr.String())
|
||||
}
|
||||
if !strings.Contains(stdout.String(), "Previous-session artifacts: unavailable: remote current commit pointer missing") {
|
||||
if !findingMatches(decodeNativeReport[sessionStateReport](t, stdout.Bytes()).Findings, "ERROR", "previous", "pointer missing") {
|
||||
t.Fatalf("stdout = %q, want previous readiness unavailable line", stdout.String())
|
||||
}
|
||||
}
|
||||
@@ -1208,13 +1130,12 @@ func TestExecuteStatusDetectsMissingRequiredPreviousArtifact(t *testing.T) {
|
||||
code := executeWithDependencies([]string{
|
||||
"session", "status", "2026-05-03",
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
}, &stdout, &stderr, deps, executePlan)
|
||||
if code != 0 {
|
||||
if code != 1 {
|
||||
t.Fatalf("exit code = %d, want 0; stderr=%q", code, stderr.String())
|
||||
}
|
||||
if !strings.Contains(stdout.String(), `Previous-session artifacts: unavailable: remote required previous-session artifact "session_recap" is not declared`) {
|
||||
if !findingMatches(decodeNativeReport[sessionStateReport](t, stdout.Bytes()).Findings, "ERROR", "previous", "not declared") {
|
||||
t.Fatalf("stdout = %q, want missing required previous artifact", stdout.String())
|
||||
}
|
||||
}
|
||||
@@ -1233,19 +1154,18 @@ func TestExecuteSessionValidateReportsPreviousStateFindingAndReturnsFindingError
|
||||
code := executeWithDependencies([]string{
|
||||
"session", "validate", "2026-05-03",
|
||||
"--config", pipelinePath,
|
||||
"--campaign-file", campaignPath,
|
||||
"--session", sessionPath,
|
||||
"--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
}, &stdout, &stderr, deps, executePlan)
|
||||
if code == 0 {
|
||||
t.Fatal("exit code = 0, want non-zero")
|
||||
}
|
||||
if !strings.Contains(stdout.String(), "ERROR previous") {
|
||||
if !findingMatches(decodeNativeReport[sessionValidationReport](t, stdout.Bytes()).Findings, "ERROR", "previous", "") {
|
||||
t.Fatalf("stdout = %q, want previous finding error", stdout.String())
|
||||
}
|
||||
if !strings.Contains(stdout.String(), "remote current commit pointer missing") {
|
||||
t.Fatalf("stdout = %q, want missing commit pointer finding", stdout.String())
|
||||
}
|
||||
if !strings.Contains(stderr.String(), "validation error(s)") {
|
||||
if !strings.Contains(stderr.String(), "remote current commit pointer missing") {
|
||||
t.Fatalf("stderr = %q, want finding error summary", stderr.String())
|
||||
}
|
||||
}
|
||||
@@ -1288,9 +1208,9 @@ func TestExecutePublishIgnoresRetiredSharedLockObject(t *testing.T) {
|
||||
|
||||
var stdout bytes.Buffer
|
||||
var storeInitCalls int
|
||||
err = runStageWithPipelineExecutor(
|
||||
err = invokeNativeCommandWith(
|
||||
context.Background(),
|
||||
[]string{"publish", "2026-05-03", "--config", pipelinePath, "--campaign-file", campaignPath, "--session", sessionPath, "--force"},
|
||||
[]string{"run", "--stage", "publish", "2026-05-03", "--config", pipelinePath, "--campaign-file", campaignPath, "--session-file", sessionPath, "--force"},
|
||||
&stdout,
|
||||
func(ctx context.Context, cfg *config.Config, plan BoundedPlan, opts RunOptions) (*RunSummary, error) {
|
||||
return executePlanWithDependencies(ctx, cfg, plan, opts, invocationDependencies{
|
||||
@@ -1299,7 +1219,7 @@ func TestExecutePublishIgnoresRetiredSharedLockObject(t *testing.T) {
|
||||
return fake, nil
|
||||
},
|
||||
})
|
||||
},
|
||||
}, commandDependencies{},
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("runStageWithPipelineExecutor() error = %v", err)
|
||||
|
||||
Reference in New Issue
Block a user