Correct artifact path bookkeeping
This commit is contained in:
@@ -182,9 +182,8 @@ func BuildPromptMetadataFromBriefingMetadata(resolved report.Resolved, briefingM
|
||||
Location: copyLocation(briefingMetadata.Location), SourceLocationID: briefingMetadata.SourceLocationID,
|
||||
SourceLocation: briefingMetadata.SourceLocation, Sources: briefingMetadata.Sources,
|
||||
SourceWarnings: briefingMetadata.SourceWarnings, ModuleSnapshotPath: paths.ModuleSnapshot,
|
||||
DataPackagePath: paths.DataPackage, RenderedReportPath: paths.RenderedReport,
|
||||
GeneratedTextSchemaID: resolved.Definition.GeneratedTextSchemaID, GeneratedTextRawPath: paths.GeneratedTextRaw,
|
||||
GeneratedTextPath: paths.GeneratedText, RenderContextPath: paths.RenderContext,
|
||||
DataPackagePath: paths.DataPackage,
|
||||
GeneratedTextSchemaID: resolved.Definition.GeneratedTextSchemaID,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
38
internal/state/metadata_reached_paths_test.go
Normal file
38
internal/state/metadata_reached_paths_test.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package state
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gitea.maximumdirect.net/eric/weatherreporter/internal/briefing"
|
||||
"gitea.maximumdirect.net/eric/weatherreporter/internal/report"
|
||||
)
|
||||
|
||||
func TestBuildPromptMetadataIncludesOnlyExistingArtifacts(t *testing.T) {
|
||||
resolved, err := report.DefaultRegistry().Resolve(report.Daily, report.ResolveRequest{
|
||||
Now: time.Date(2026, 5, 29, 12, 0, 0, 0, time.UTC),
|
||||
Date: time.Date(2026, 5, 29, 0, 0, 0, 0, time.UTC), Location: time.UTC,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("Resolve() error = %v", err)
|
||||
}
|
||||
metadata := BuildPromptMetadataFromBriefingMetadata(resolved, briefing.Metadata{}, ArtifactPaths{
|
||||
ModuleSnapshot: "/saved/modules.json",
|
||||
Metadata: "/destination/metadata.json",
|
||||
DataPackage: "/saved/data.yaml",
|
||||
Preparation: "/future/preparation.json",
|
||||
Execution: "/future/execution.json",
|
||||
Notification: "/future/notification.json",
|
||||
RenderedReport: "/future/report.md",
|
||||
GeneratedTextRaw: "/future/raw.json",
|
||||
GeneratedText: "/future/generated.json",
|
||||
RenderContext: "/future/context.json",
|
||||
})
|
||||
|
||||
if metadata.ModuleSnapshotPath != "/saved/modules.json" || metadata.DataPackagePath != "/saved/data.yaml" || metadata.MetadataPath != "/destination/metadata.json" {
|
||||
t.Fatalf("existing paths = %#v, want module, data package, and metadata destination", metadata)
|
||||
}
|
||||
if metadata.PreparationPath != "" || metadata.ExecutionPath != "" || metadata.NotificationPath != "" || metadata.RenderedReportPath != "" || metadata.GeneratedTextRawPath != "" || metadata.GeneratedTextPath != "" || metadata.RenderContextPath != "" {
|
||||
t.Fatalf("metadata includes paths for unreached artifacts: %#v", metadata)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user