Define canonical session workspace paths

This commit is contained in:
2026-11-29 23:59:15 +00:00
parent 816453b444
commit f923d75562
11 changed files with 110 additions and 64 deletions

View File

@@ -147,7 +147,7 @@ func absoluteExtractSnapshotPaths(paths artifacts.SessionPaths) (artifacts.Sessi
if err != nil {
return paths, fmt.Errorf("resolve snapshot session root: %w", err)
}
paths.CacheDir, err = filepath.Abs(paths.CacheDir)
paths.ReferencesDir, err = filepath.Abs(paths.ReferencesDir)
if err != nil {
return paths, fmt.Errorf("resolve snapshot cache root: %w", err)
}

View File

@@ -103,7 +103,8 @@ func runLocalPathForCanonical(layout runStageLayout, sessionPaths artifacts.Sess
if err != nil {
return "", fmt.Errorf("derive session-relative path for %q: %w", cleanCanonical, err)
}
if rel == config.PathPreviousDirSegment || strings.HasPrefix(rel, config.PathPreviousDirSegment+"/") {
previous := config.PathInputsDirSegment + "/" + config.PathPreviousDirSegment
if rel == previous || strings.HasPrefix(rel, previous+"/") {
return cleanCanonical, nil
}
localPath, err := pathsafe.JoinSlashRelativeUnderRoot(layout.OutputsDir, rel)

View File

@@ -45,7 +45,7 @@ func TestRunLocalPathForCanonicalKeepsPreviousStateSessionDurable(t *testing.T)
t.Fatalf("mkdir outputs dir: %v", err)
}
canonical := filepath.Join(sessionRoot, "previous", "artifacts", "session_recap.md")
canonical := filepath.Join(sessionRoot, "inputs", "previous", "artifacts", "session_recap.md")
got, err := runLocalPathForCanonical(layout, artifacts.SessionPaths{Root: sessionRoot}, canonical)
if err != nil {
t.Fatalf("runLocalPathForCanonical() error = %v", err)