Finish native completion and retire legacy command machinery
This commit is contained in:
@@ -38,7 +38,7 @@ func TestAssembledFullRunUsesCanonicalOrder(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAssembledCanonicalAndAliasArtifactRegenerationRequestsMatch(t *testing.T) {
|
||||
func TestAssembledForcedRangeAndRegenerationRequestsMatch(t *testing.T) {
|
||||
workspaceRoot := t.TempDir()
|
||||
pipelinePath, campaignPath, sessionPath := writeValidConfigFilesWithScriptoriumArtifacts(t, workspaceRoot)
|
||||
type capturedRequest struct {
|
||||
@@ -55,23 +55,22 @@ func TestAssembledCanonicalAndAliasArtifactRegenerationRequestsMatch(t *testing.
|
||||
}
|
||||
base := []string{
|
||||
"2026-05-03", "--force", "--from", "extract", "--through", "analyze",
|
||||
"--config", pipelinePath, "--campaign-file", campaignPath, "--session", sessionPath,
|
||||
"--config", pipelinePath, "--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
}
|
||||
deps := fakeCommandDependencies(&storage.FakeBackend{}, nil)
|
||||
if err := runWithDependencies(context.Background(), base, &bytes.Buffer{}, executor, deps); err != nil {
|
||||
if err := invokeNativeCommandWith(context.Background(), append([]string{"run"}, base...), &bytes.Buffer{}, executor, deps); err != nil {
|
||||
t.Fatalf("canonical unselected Run() error = %v", err)
|
||||
}
|
||||
selected := append(append([]string(nil), base...), "--artifacts", "session_recap")
|
||||
if err := runWithDependencies(context.Background(), selected, &bytes.Buffer{}, executor, deps); err != nil {
|
||||
if err := invokeNativeCommandWith(context.Background(), append([]string{"run"}, selected...), &bytes.Buffer{}, executor, deps); err != nil {
|
||||
t.Fatalf("canonical selected Run() error = %v", err)
|
||||
}
|
||||
var stdout, stderr bytes.Buffer
|
||||
alias := []string{
|
||||
"regenerate-artifacts", "2026-05-03", "--artifacts", "session_recap",
|
||||
"--config", pipelinePath, "--campaign-file", campaignPath, "--session", sessionPath,
|
||||
regeneration := []string{"artifacts", "regenerate", "2026-05-03", "--artifacts", "session_recap",
|
||||
"--config", pipelinePath, "--campaign-file", campaignPath, "--session-file", sessionPath,
|
||||
}
|
||||
if code := executeWithDependencies(alias, &stdout, &stderr, deps, executor); code != 0 {
|
||||
t.Fatalf("alias exit=%d stderr=%q", code, stderr.String())
|
||||
if code := executeWithDependencies(regeneration, &stdout, &stderr, deps, executor); code != 0 {
|
||||
t.Fatalf("regeneration exit=%d stderr=%q", code, stderr.String())
|
||||
}
|
||||
if len(captured) != 3 {
|
||||
t.Fatalf("captured requests = %#v", captured)
|
||||
@@ -82,7 +81,7 @@ func TestAssembledCanonicalAndAliasArtifactRegenerationRequestsMatch(t *testing.
|
||||
}
|
||||
if !reflect.DeepEqual(captured[1], captured[2]) || !reflect.DeepEqual(captured[1].stages, wantStages) ||
|
||||
!reflect.DeepEqual(captured[1].artifacts, []string{"session_recap"}) || !captured[1].force {
|
||||
t.Fatalf("canonical=%#v alias=%#v, want identical bounded request", captured[1], captured[2])
|
||||
t.Fatalf("forced range=%#v regeneration=%#v, want identical bounded request", captured[1], captured[2])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,6 +150,7 @@ func TestAssembledLegacyAnalyzeTransitionPublishesOnlyCurrentRecords(t *testing.
|
||||
{Source: artifacts.ConfiguredArtifactSourceID("session_recap"), Dest: "artifacts/session_recap.md", Required: boolPtr(true)},
|
||||
},
|
||||
}
|
||||
cfg.ArtifactCatalog.PublishOutputs = cfg.Pipeline.Publish.Outputs
|
||||
paths, err := artifacts.NewLocalStore(cfg.Pipeline.Workspace.Root).EnsureLayoutFor(cfg.Session.Campaign, cfg.Session.SessionID)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -261,15 +261,14 @@ func TestAssembledSplitBundleCommandsUseOneEffectiveFamilyConfiguration(t *testi
|
||||
}
|
||||
|
||||
common := []string{
|
||||
"2026-05-03", "--config", pipelinePath, "--campaign-file", campaignPath,
|
||||
"--session", sessionPath, "--overlay", "testing",
|
||||
"2026-05-03", "--config", pipelinePath, "--campaign-file", campaignPath, "--session-file", sessionPath, "--overlay", "testing",
|
||||
}
|
||||
var planned bytes.Buffer
|
||||
if err := Plan(context.Background(), common, &planned); err != nil {
|
||||
if err := invokeNativeCommand(context.Background(), append([]string{"session", "plan"}, common...), &planned); err != nil {
|
||||
t.Fatalf("plan testing bundle: %v", err)
|
||||
}
|
||||
if !strings.Contains(planned.String(), "overlay=testing") {
|
||||
t.Fatalf("plan output = %q, want testing provenance", planned.String())
|
||||
if report := decodeNativeReport[sessionPlanReport](t, planned.Bytes()); report.Campaign != "sample-campaign" || len(report.Stages) != len(canonicalStageNames()) {
|
||||
t.Fatalf("plan=%#v", report)
|
||||
}
|
||||
|
||||
var capturedCfg *config.Config
|
||||
@@ -283,7 +282,7 @@ func TestAssembledSplitBundleCommandsUseOneEffectiveFamilyConfiguration(t *testi
|
||||
}
|
||||
runArgs := append(append([]string(nil), common...), "--from", "analyze", "--through", "analyze", "--artifacts", "character_items_arannis")
|
||||
var runOut bytes.Buffer
|
||||
if err := runWithPipelineExecutor(context.Background(), runArgs, &runOut, executor); err != nil {
|
||||
if err := invokeNativeCommandWith(context.Background(), append([]string{"run"}, runArgs...), &runOut, executor, commandDependencies{}); err != nil {
|
||||
t.Fatalf("bounded family run: %v", err)
|
||||
}
|
||||
if !reflect.DeepEqual(capturedPlan.Names(), []string{"analyze"}) {
|
||||
@@ -292,7 +291,7 @@ func TestAssembledSplitBundleCommandsUseOneEffectiveFamilyConfiguration(t *testi
|
||||
if profile, ok := config.SelectedPipelineOverlay(capturedCfg.Pipeline); !ok || profile.Name != "testing" {
|
||||
t.Fatalf("captured profile = %#v, selected=%t", profile, ok)
|
||||
}
|
||||
if digest := config.EffectivePipelineDigest(capturedCfg.Pipeline); digest == "" || !strings.Contains(runOut.String(), "digest="+digest) {
|
||||
if digest := config.EffectivePipelineDigest(capturedCfg.Pipeline); digest == "" {
|
||||
t.Fatalf("run output = %q, want effective digest %q", runOut.String(), digest)
|
||||
}
|
||||
if got := capturedOptions.EffectiveArtifacts.Keys(); !reflect.DeepEqual(got, []string{"character_items_arannis"}) {
|
||||
|
||||
Reference in New Issue
Block a user