Unify analysis product path identity
This commit is contained in:
@@ -77,6 +77,26 @@ func TestCommittedRestoreInstallsPreparedInputsAndFlatProducts(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommittedRestoreUsesAbsoluteConfiguredProductDestination(t *testing.T) {
|
||||
cfg := restorePlanConfig(t)
|
||||
root := artifacts.SessionWorkDirForCampaign(cfg.Pipeline.Workspace.Root, cfg.Session.Campaign, cfg.Session.SessionID)
|
||||
cfg.ArtifactCatalog = &config.ArtifactCatalog{Artifacts: map[string]config.ScriptoriumArtifactConfig{
|
||||
"session_recap": {Enabled: true, OutputPath: filepath.Join(root, "artifacts", "session_recap.md")},
|
||||
}}
|
||||
fake := &storage.FakeBackend{}
|
||||
current := seedCommittedRestoreSnapshot(t, cfg, fake, "20260519T010203Z-a1b2c3d4", map[string][]byte{
|
||||
"artifacts/session_recap.md": []byte("recap"),
|
||||
})
|
||||
plan, err := buildRestorePlan(context.Background(), cfg, current, fake, RestorePlanOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := executeRestorePlan(context.Background(), cfg, current, plan, nil, fake); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
mustReadEquals(t, filepath.Join(root, "artifacts", "session_recap.md"), "recap")
|
||||
}
|
||||
|
||||
func TestCommittedRestoreDoesNotRequirePolishRunDiagnostics(t *testing.T) {
|
||||
cfg := restorePlanConfig(t)
|
||||
fake := &storage.FakeBackend{}
|
||||
|
||||
@@ -253,7 +253,11 @@ func restoreProductRelativePath(cfg *config.Config, m *manifest.Manifest, destin
|
||||
return "", err
|
||||
}
|
||||
if entry, ok := catalog.Lookup(source); ok {
|
||||
result = filepath.ToSlash(entry.CanonicalRelPath)
|
||||
relative, err := artifacts.ProductRelativePath(destinationRoot, entry.CanonicalRelPath)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
result = relative
|
||||
parts := strings.Split(result, "/")
|
||||
if len(parts) != 2 || (parts[0] != config.PathArtifactsDirSegment && parts[0] != config.PathTranscriptsSegment) || parts[1] == "" || parts[1] == "." || parts[1] == ".." {
|
||||
return "", fmt.Errorf("configured product path %q is not flat", result)
|
||||
|
||||
Reference in New Issue
Block a user