Stop persisting notification receipts
This commit is contained in:
@@ -169,12 +169,12 @@ func TestRunBatchDetailedExecutesRetainedReportsSequentially(t *testing.T) {
|
||||
t.Fatalf("output = %q, want %q", item.OutputPath, test.wantCopies[index])
|
||||
}
|
||||
assertBatchPathsExist(t, item.DataPackagePath, item.PreparationPath, item.ExecutionPath, item.LLMDebugPath, item.ReportPath, item.OutputPath, item.MetadataPath)
|
||||
managed, readErr := os.ReadFile(item.ReportPath)
|
||||
renderedReport, readErr := os.ReadFile(item.ReportPath)
|
||||
if readErr != nil {
|
||||
t.Fatalf("read managed report: %v", readErr)
|
||||
t.Fatalf("read rendered report: %v", readErr)
|
||||
}
|
||||
copied, readErr := os.ReadFile(item.OutputPath)
|
||||
if readErr != nil || !bytes.Equal(managed, copied) {
|
||||
if readErr != nil || !bytes.Equal(renderedReport, copied) {
|
||||
t.Fatalf("output mismatch/error = %v", readErr)
|
||||
}
|
||||
}
|
||||
@@ -263,15 +263,12 @@ func TestRunBatchDetailedNotificationLifecycle(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("RunBatchDetailed() error = %v", err)
|
||||
}
|
||||
if result.Failed != 0 || result.Notification == nil || result.Notification.Status != "succeeded" || result.Notification.Path == "" || len(notifier.reportRequests) != 0 || len(notifier.batchRequests) != 1 {
|
||||
if result.Failed != 0 || result.Notification == nil || result.Notification.Status != "succeeded" || len(notifier.reportRequests) != 0 || len(notifier.batchRequests) != 1 {
|
||||
t.Fatalf("notification result/requests = %#v/%d/%d", result.Notification, len(notifier.reportRequests), len(notifier.batchRequests))
|
||||
}
|
||||
outputPaths := make(map[string]struct{}, len(result.Reports))
|
||||
for _, item := range result.Reports {
|
||||
outputPaths[item.OutputPath] = struct{}{}
|
||||
if item.NotificationPath != "" {
|
||||
t.Fatalf("report item contains per-report notification path: %#v", item)
|
||||
}
|
||||
}
|
||||
request := notifier.batchRequests[0]
|
||||
if len(request.IncludedReports) != len(result.Reports) {
|
||||
@@ -282,10 +279,6 @@ func TestRunBatchDetailedNotificationLifecycle(t *testing.T) {
|
||||
t.Fatalf("notification file = %#v, want selected Markdown output source", file)
|
||||
}
|
||||
}
|
||||
artifact := readBatchNotificationArtifact(t, result.Notification.Path)
|
||||
if artifact.Status != "succeeded" || artifact.Upload == nil || artifact.Upload.RunID != "batch-notification-run" || artifact.RunStatus == nil || len(artifact.Reports) != len(result.Reports) {
|
||||
t.Fatalf("notification artifact = %#v", artifact)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("upload failure", func(t *testing.T) {
|
||||
@@ -299,7 +292,7 @@ func TestRunBatchDetailedNotificationLifecycle(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("RunBatchDetailed() error = %v", err)
|
||||
}
|
||||
if result.Succeeded != 2 || result.Failed != 1 || result.Notification == nil || result.Notification.Status != "failed" || result.Notification.Path == "" {
|
||||
if result.Succeeded != 2 || result.Failed != 1 || result.Notification == nil || result.Notification.Status != "failed" {
|
||||
t.Fatalf("result = %#v, want successful reports and failed notification", result)
|
||||
}
|
||||
for _, item := range result.Reports {
|
||||
@@ -307,9 +300,8 @@ func TestRunBatchDetailedNotificationLifecycle(t *testing.T) {
|
||||
t.Fatalf("report item = %#v, want success despite notification failure", item)
|
||||
}
|
||||
}
|
||||
artifact := readBatchNotificationArtifact(t, result.Notification.Path)
|
||||
if artifact.Status != "failed" || !strings.Contains(artifact.Error, "batch upload rejected") {
|
||||
t.Fatalf("notification artifact = %#v", artifact)
|
||||
if !strings.Contains(result.Notification.Error, "batch upload rejected") {
|
||||
t.Fatalf("notification error = %#v", result.Notification)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -324,12 +316,11 @@ func TestRunBatchDetailedNotificationLifecycle(t *testing.T) {
|
||||
Config: cfg, Batch: BatchEvening, Now: workflowTime("2026-05-29T18:00:00-05:00"), WorkingDir: t.TempDir(),
|
||||
Collector: &workflowCollector{result: &collect.Result{Bundle: &bundle}}, Executor: newAssembledBatchExecutor(), Notifier: notifier,
|
||||
})
|
||||
if err != nil || result.Failed != 0 || result.Notification == nil || result.Notification.Path == "" {
|
||||
if err != nil || result.Failed != 0 || result.Notification == nil {
|
||||
t.Fatalf("result/error = %#v/%v", result, err)
|
||||
}
|
||||
artifact := readBatchNotificationArtifact(t, result.Notification.Path)
|
||||
if artifact.StatusError != "status lookup unavailable" || artifact.RunStatus == nil || !bytes.Contains(artifact.RunStatus.Report, []byte("replace_older")) {
|
||||
t.Fatalf("notification artifact = %#v", artifact)
|
||||
if result.Notification.Status != "accepted" || result.Notification.RunID != "batch-notification-run" {
|
||||
t.Fatalf("notification = %#v", result.Notification)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -439,25 +430,11 @@ func assertBatchItemMatchesMetadata(t *testing.T, item BatchReportResult) {
|
||||
}
|
||||
if item.ReportID != metadata.ReportID || item.RunID != metadata.RunID ||
|
||||
item.DataPackagePath != metadata.DataPackagePath || item.PreparationPath != metadata.PreparationPath ||
|
||||
item.ExecutionPath != metadata.ExecutionPath || item.ReportPath != metadata.RenderedReportPath ||
|
||||
item.NotificationPath != metadata.NotificationPath {
|
||||
item.ExecutionPath != metadata.ExecutionPath || item.ReportPath != metadata.RenderedReportPath {
|
||||
t.Fatalf("batch item paths do not exactly match metadata: item=%#v metadata=%#v", item, metadata)
|
||||
}
|
||||
}
|
||||
|
||||
func readBatchNotificationArtifact(t *testing.T, path string) state.BatchDistributorNotificationArtifact {
|
||||
t.Helper()
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
t.Fatalf("read batch notification artifact: %v", err)
|
||||
}
|
||||
var artifact state.BatchDistributorNotificationArtifact
|
||||
if err := json.Unmarshal(data, &artifact); err != nil {
|
||||
t.Fatalf("decode batch notification artifact: %v", err)
|
||||
}
|
||||
return artifact
|
||||
}
|
||||
|
||||
func loadBatchDataPackage(t *testing.T, path string) promptinput.Package {
|
||||
t.Helper()
|
||||
data, err := os.ReadFile(path)
|
||||
|
||||
Reference in New Issue
Block a user