Archive Audita reports as polish diagnostics
This commit is contained in:
@@ -274,6 +274,28 @@ inputs:
|
||||
if !strings.Contains(stdout.String(), "stage=polish executed=1 skipped=0") {
|
||||
t.Fatalf("stdout = %q, want polish execution", stdout.String())
|
||||
}
|
||||
recorded, err := (&manifest.LocalStore{}).Load(context.Background(), filepath.Join(workRoot, "manifest.json"))
|
||||
if err != nil {
|
||||
t.Fatalf("load polished manifest: %v", err)
|
||||
}
|
||||
polish := recorded.Stages["polish"]
|
||||
if polish == nil || len(polish.Outputs) != 1 || polish.Outputs[0].Kind != "transcript_polished" {
|
||||
t.Fatalf("polish outputs = %#v, want only canonical transcript", polish)
|
||||
}
|
||||
if len(polish.Logs) != 5 || len(polish.GeneratedConfigs) != 1 {
|
||||
t.Fatalf("polish diagnostics = %#v, want logs, reports, and invocation", polish)
|
||||
}
|
||||
for _, name := range []string{"errors.yml", "recoveries.yml", "report.md"} {
|
||||
found := false
|
||||
for _, path := range polish.Logs {
|
||||
if filepath.Base(path) == name {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Fatalf("report %q absent from manifest diagnostics: %#v", name, polish.Logs)
|
||||
}
|
||||
}
|
||||
foundReference := false
|
||||
if err := filepath.WalkDir(workRoot, func(path string, entry os.DirEntry, walkErr error) error {
|
||||
if walkErr != nil || entry.IsDir() {
|
||||
|
||||
@@ -44,6 +44,28 @@ func TestCommittedRestorePlanUsesOnlyDeclaredObjects(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommittedRestoreDoesNotRequirePolishRunDiagnostics(t *testing.T) {
|
||||
cfg := restorePlanConfig(t)
|
||||
fake := &storage.FakeBackend{}
|
||||
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{
|
||||
"transcripts/full.json": []byte(`{"segments":[]}`),
|
||||
})
|
||||
diagnostic := filepath.Join(cfg.Pipeline.Workspace.Root, "runs", current.RunID, "polish", "outputs", "transcripts", "errors.yml")
|
||||
current.Manifest.Stages["polish"] = &manifest.StageRecord{
|
||||
Name: "polish", Status: manifest.StatusSucceeded,
|
||||
Logs: []string{diagnostic},
|
||||
}
|
||||
plan, err := buildRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("buildRestorePlan() error = %v", err)
|
||||
}
|
||||
for _, action := range plan.Actions {
|
||||
if strings.Contains(action.LocalRelativePath, "errors.yml") {
|
||||
t.Fatalf("diagnostic became a required restore target: %#v", action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommittedRestoreDownloadsCarriedOutputFromDeclaredRun(t *testing.T) {
|
||||
cfg := restorePlanConfig(t)
|
||||
fake := &storage.FakeBackend{}
|
||||
|
||||
Reference in New Issue
Block a user