Define canonical session workspace paths
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user