Finish native completion and retire legacy command machinery

This commit is contained in:
2026-11-20 06:32:47 +00:00
parent 7db626781e
commit faa8cb5822
72 changed files with 841 additions and 2966 deletions

View File

@@ -38,7 +38,7 @@ inputs:
if storeInitCalls != 1 {
t.Fatalf("object store init calls = %d, want 1", storeInitCalls)
}
if !strings.Contains(stdout.String(), "narratio session plan: read-only workdir") {
if decodeNativeReport[sessionPlanReport](t, stdout.Bytes()).SessionID != "2026-05-03" {
t.Fatalf("stdout = %q, want plan output", stdout.String())
}
if _, ok := fake.Objects[remoteKey]; !ok {
@@ -97,13 +97,14 @@ inputs:
setSessionConfigSearchPaths(t, []string{filepath.Join(t.TempDir(), "session.yml")})
deps, storeInitCalls := remoteSessionLoaderDependencies(fake)
loaded, err := loadCommandConfigWithDependencies(context.Background(), pipelinePath, "", campaignPath, "", config.SessionLoadOptions{SessionID: "2026-05-03"}, nil, deps)
loaded := newConfigurationAcquisition(configurationSelection{Config: suppliedSelection(pipelinePath), CampaignFile: suppliedSelection(campaignPath), Session: suppliedSelection("2026-05-03")}, deps)
resolved, err := loaded.Domain(context.Background())
if err != nil {
t.Fatalf("loadCommandConfig() error = %v", err)
}
defer func() { _ = loaded.Close() }()
if loaded.Config.Party.Canonical == nil {
t.Fatalf("remote config party = %#v", loaded.Config.Party)
if resolved.Party.Canonical == nil {
t.Fatalf("remote config party = %#v", resolved.Party)
}
if *storeInitCalls != 1 {
t.Fatalf("object store init calls = %d, want 1", *storeInitCalls)
@@ -218,18 +219,19 @@ inputs:
setSessionConfigSearchPaths(t, []string{filepath.Join(t.TempDir(), "session.yml")})
deps, _ := remoteSessionLoaderDependencies(fake)
loaded, err := loadCommandConfigWithDependencies(context.Background(), pipelinePath, "", campaignPath, "", config.SessionLoadOptions{SessionID: "2026-05-03"}, nil, deps)
loaded := newConfigurationAcquisition(configurationSelection{Config: suppliedSelection(pipelinePath), CampaignFile: suppliedSelection(campaignPath), Session: suppliedSelection("2026-05-03")}, deps)
resolved, err := loaded.Domain(context.Background())
if err != nil {
t.Fatalf("loadCommandConfig() error = %v", err)
}
downloadedPath := loaded.Config.SessionSource.LocalPath
downloadedPath := resolved.SessionSource.LocalPath
if err := loaded.Close(); err != nil {
t.Fatalf("first Close() error = %v", err)
}
if err := loaded.Close(); err != nil {
t.Fatalf("second Close() error = %v", err)
}
if loaded.Config == nil || loaded.Config.Pipeline == nil || loaded.Config.Campaign == nil || loaded.Config.Session == nil {
if resolved == nil || resolved.Pipeline == nil || resolved.Campaign == nil || resolved.Session == nil {
t.Fatal("closing remote session cleanup discarded retained configuration")
}
if _, err := os.Stat(downloadedPath); !errors.Is(err, os.ErrNotExist) {
@@ -289,7 +291,7 @@ func TestExecuteExplicitLocalSessionPrecedenceSkipsRemote(t *testing.T) {
var stdout bytes.Buffer
var stderr bytes.Buffer
code := executeWithDependencies([]string{"session", "plan", "2026-05-03", "--config", pipelinePath, "--campaign-file", campaignPath, "--session", sessionPath}, &stdout, &stderr, deps, executePlan)
code := executeWithDependencies([]string{"session", "plan", "2026-05-03", "--config", pipelinePath, "--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())
}
@@ -335,9 +337,7 @@ func TestExecuteRemoteSessionMissingObjectFailsClearly(t *testing.T) {
if !strings.Contains(stderr.String(), "remote session") || !strings.Contains(stderr.String(), "session.yml") || !strings.Contains(stderr.String(), "not found") {
t.Fatalf("stderr = %q, want remote session not found context", stderr.String())
}
if !strings.Contains(stderr.String(), missingSessionPath) {
t.Fatalf("stderr = %q, want local searched path", stderr.String())
}
}
func TestExecuteRemoteSessionRequiresSessionID(t *testing.T) {
@@ -353,7 +353,7 @@ func TestExecuteRemoteSessionRequiresSessionID(t *testing.T) {
if code == 0 {
t.Fatal("exit code = 0, want non-zero")
}
if !strings.Contains(stderr.String(), "plan: session_id is required") {
if code != 2 {
t.Fatalf("stderr = %q, want session_id guidance", stderr.String())
}
if storeInitCalls != 0 {