Define canonical session workspace paths
This commit is contained in:
@@ -42,7 +42,7 @@ bundle path supplied by `internal/artifacts`. Exact physical paths belong in
|
|||||||
|
|
||||||
Prepared references delivered to Notarius use session-durable paths owned by
|
Prepared references delivered to Notarius use session-durable paths owned by
|
||||||
`internal/artifacts` beneath
|
`internal/artifacts` beneath
|
||||||
`cache/notarius/references/<sha256>/<prepared-basename>`. These verified
|
`inputs/references/<sha256>/<prepared-basename>`. These verified
|
||||||
content-addressed snapshots are outside run-local layout, survive ordinary
|
content-addressed snapshots are outside run-local layout, survive ordinary
|
||||||
published-run cleanup, and are excluded from publish and restore enumeration.
|
published-run cleanup, and are excluded from publish and restore enumeration.
|
||||||
|
|
||||||
|
|||||||
@@ -707,12 +707,12 @@ Durable session paths:
|
|||||||
- `audio/**`
|
- `audio/**`
|
||||||
- `transcripts/**`
|
- `transcripts/**`
|
||||||
- `artifacts/**`
|
- `artifacts/**`
|
||||||
- `previous/**`
|
- `inputs/previous/**`
|
||||||
- `reports/**`
|
- `reports/**`
|
||||||
- `logs/**`
|
- `logs/**`
|
||||||
- `config/**`
|
- `config/**`
|
||||||
- `runs/**`
|
- `runs/**`
|
||||||
- `cache/notarius/references/<sha256>/<prepared-basename>`
|
- `inputs/references/<sha256>/<prepared-basename>`
|
||||||
|
|
||||||
`manifest.json` is the versioned session-progress document. Narratio accepts
|
`manifest.json` is the versioned session-progress document. Narratio accepts
|
||||||
only `narratio.session-manifest.v2`. Do not edit unsupported session state to
|
only `narratio.session-manifest.v2`. Do not edit unsupported session state to
|
||||||
|
|||||||
@@ -153,6 +153,13 @@ runner and restore entry points, not just the version comparison function.
|
|||||||
|
|
||||||
## Stage 3 — Define the canonical workspace paths
|
## Stage 3 — Define the canonical workspace paths
|
||||||
|
|
||||||
|
**Complete.** Commit: `Define canonical session workspace paths`.
|
||||||
|
Verification: focused path-model, layout, reference-snapshot, and run-local tests
|
||||||
|
passed with Go 1.27.4. The broader `internal/stage` test run still has two
|
||||||
|
publication failures because previous-session publication enumeration uses the
|
||||||
|
old path; its migration belongs to Stage 18. Root reports/config paths remain
|
||||||
|
temporarily in use by producers until their routing changes in later stages.
|
||||||
|
|
||||||
**Read:** roadmap “Final layout and ownership”; [Workspace Internals](../internal/workspace.md).
|
**Read:** roadmap “Final layout and ownership”; [Workspace Internals](../internal/workspace.md).
|
||||||
Entry points: `internal/artifacts/paths.go`, layout creation in its local store,
|
Entry points: `internal/artifacts/paths.go`, layout creation in its local store,
|
||||||
`internal/config` path constants, and `internal/stage/run_local.go`.
|
`internal/config` path constants, and `internal/stage/run_local.go`.
|
||||||
|
|||||||
@@ -76,12 +76,10 @@ func (s *LocalStore) ensureLayout(paths SessionPaths) (SessionPaths, error) {
|
|||||||
paths.AudioDir,
|
paths.AudioDir,
|
||||||
paths.TranscriptsDir,
|
paths.TranscriptsDir,
|
||||||
paths.TranscriptsRawDir,
|
paths.TranscriptsRawDir,
|
||||||
paths.TranscriptsTrimmedDir,
|
|
||||||
paths.ArtifactsDir,
|
paths.ArtifactsDir,
|
||||||
paths.ReportsDir,
|
paths.ReportsDir,
|
||||||
paths.ConfigDir,
|
paths.ConfigDir,
|
||||||
paths.LogsDir,
|
paths.LogsDir,
|
||||||
paths.CurrentDir,
|
|
||||||
paths.RunsDir,
|
paths.RunsDir,
|
||||||
paths.PreviousDir,
|
paths.PreviousDir,
|
||||||
paths.PreviousArtifactsDir,
|
paths.PreviousArtifactsDir,
|
||||||
|
|||||||
@@ -23,12 +23,10 @@ func TestEnsureLayoutCreatesExpectedDirectories(t *testing.T) {
|
|||||||
checkDirExists(t, paths.AudioDir)
|
checkDirExists(t, paths.AudioDir)
|
||||||
checkDirExists(t, paths.TranscriptsDir)
|
checkDirExists(t, paths.TranscriptsDir)
|
||||||
checkDirExists(t, paths.TranscriptsRawDir)
|
checkDirExists(t, paths.TranscriptsRawDir)
|
||||||
checkDirExists(t, paths.TranscriptsTrimmedDir)
|
|
||||||
checkDirExists(t, paths.ArtifactsDir)
|
checkDirExists(t, paths.ArtifactsDir)
|
||||||
checkDirExists(t, paths.ReportsDir)
|
checkDirExists(t, paths.ReportsDir)
|
||||||
checkDirExists(t, paths.ConfigDir)
|
checkDirExists(t, paths.ConfigDir)
|
||||||
checkDirExists(t, paths.LogsDir)
|
checkDirExists(t, paths.LogsDir)
|
||||||
checkDirExists(t, paths.CurrentDir)
|
|
||||||
checkDirExists(t, paths.RunsDir)
|
checkDirExists(t, paths.RunsDir)
|
||||||
checkDirExists(t, paths.PreviousDir)
|
checkDirExists(t, paths.PreviousDir)
|
||||||
checkDirExists(t, paths.PreviousArtifactsDir)
|
checkDirExists(t, paths.PreviousArtifactsDir)
|
||||||
|
|||||||
@@ -14,28 +14,27 @@ const sha256HexLength = 64
|
|||||||
|
|
||||||
// SessionPaths contains canonical local paths for one session work directory.
|
// SessionPaths contains canonical local paths for one session work directory.
|
||||||
type SessionPaths struct {
|
type SessionPaths struct {
|
||||||
WorkspaceRoot string
|
WorkspaceRoot string
|
||||||
CampaignID string
|
CampaignID string
|
||||||
SessionID string
|
SessionID string
|
||||||
Root string
|
Root string
|
||||||
InputsDir string
|
InputsDir string
|
||||||
AudioDir string
|
AudioDir string
|
||||||
TranscriptsDir string
|
TranscriptsDir string
|
||||||
TranscriptsRawDir string
|
TranscriptsRawDir string
|
||||||
TranscriptsTrimmedDir string
|
ArtifactsDir string
|
||||||
ArtifactsDir string
|
ReportsDir string
|
||||||
ReportsDir string
|
ConfigDir string
|
||||||
ConfigDir string
|
LogsDir string
|
||||||
LogsDir string
|
DebugDir string
|
||||||
CurrentDir string
|
ReferencesDir string
|
||||||
RunsDir string
|
RunsDir string
|
||||||
PreviousDir string
|
PreviousDir string
|
||||||
CacheDir string
|
PreviousManifestPath string
|
||||||
PreviousManifestPath string
|
PreviousArtifactsDir string
|
||||||
PreviousArtifactsDir string
|
ManifestPath string
|
||||||
ManifestPath string
|
LockPath string
|
||||||
LockPath string
|
RestoreMarkerPath string
|
||||||
RestoreMarkerPath string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SessionValidationPolishDir identifies the temporary destination-probe namespace.
|
// SessionValidationPolishDir identifies the temporary destination-probe namespace.
|
||||||
@@ -66,7 +65,7 @@ func SessionRunsDirForCampaign(rootDir, campaign, sessionID string) string {
|
|||||||
|
|
||||||
// SessionPreviousDirForCampaign returns the canonical previous-session state directory.
|
// SessionPreviousDirForCampaign returns the canonical previous-session state directory.
|
||||||
func SessionPreviousDirForCampaign(rootDir, campaign, sessionID string) string {
|
func SessionPreviousDirForCampaign(rootDir, campaign, sessionID string) string {
|
||||||
return filepath.Join(SessionWorkDirForCampaign(rootDir, campaign, sessionID), config.PathPreviousDirSegment)
|
return filepath.Join(SessionWorkDirForCampaign(rootDir, campaign, sessionID), config.PathInputsDirSegment, config.PathPreviousDirSegment)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SessionPreviousManifestPathForCampaign returns the canonical previous-session manifest cache path.
|
// SessionPreviousManifestPathForCampaign returns the canonical previous-session manifest cache path.
|
||||||
@@ -101,6 +100,24 @@ func SessionRunStageDirForCampaign(rootDir, campaign, sessionID, runID, stageNam
|
|||||||
return filepath.Join(SessionRunRootForCampaign(rootDir, campaign, sessionID, runID), stageName)
|
return filepath.Join(SessionRunRootForCampaign(rootDir, campaign, sessionID, runID), stageName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SessionRunLogsDir and SessionRunDebugDir locate diagnostics for an attempt.
|
||||||
|
func SessionRunLogsDir(paths SessionPaths, runID, stageName string) string {
|
||||||
|
return filepath.Join(paths.RunsDir, runID, stageName, "logs")
|
||||||
|
}
|
||||||
|
|
||||||
|
func SessionRunDebugDir(paths SessionPaths, runID, stageName string) string {
|
||||||
|
return filepath.Join(paths.RunsDir, runID, stageName, "debug")
|
||||||
|
}
|
||||||
|
|
||||||
|
// SessionLatestLogsPath and SessionLatestDebugPath locate managed navigation views.
|
||||||
|
func SessionLatestLogsPath(paths SessionPaths, stageName string) string {
|
||||||
|
return filepath.Join(paths.LogsDir, stageName)
|
||||||
|
}
|
||||||
|
|
||||||
|
func SessionLatestDebugPath(paths SessionPaths, stageName string) string {
|
||||||
|
return filepath.Join(paths.DebugDir, stageName)
|
||||||
|
}
|
||||||
|
|
||||||
// SessionRunExtractDirForCampaign returns the invocation-local extraction directory.
|
// SessionRunExtractDirForCampaign returns the invocation-local extraction directory.
|
||||||
func SessionRunExtractDirForCampaign(rootDir, campaign, sessionID, runID string) string {
|
func SessionRunExtractDirForCampaign(rootDir, campaign, sessionID, runID string) string {
|
||||||
return SessionRunStageDirForCampaign(rootDir, campaign, sessionID, runID, "extract")
|
return SessionRunStageDirForCampaign(rootDir, campaign, sessionID, runID, "extract")
|
||||||
@@ -124,7 +141,7 @@ func SessionRunNotariusOutputRootForCampaign(rootDir, campaign, sessionID, runID
|
|||||||
// SessionNotariusReferenceCacheDir returns the stable cache root for verified
|
// SessionNotariusReferenceCacheDir returns the stable cache root for verified
|
||||||
// reference snapshots supplied to Notarius.
|
// reference snapshots supplied to Notarius.
|
||||||
func SessionNotariusReferenceCacheDir(paths SessionPaths) string {
|
func SessionNotariusReferenceCacheDir(paths SessionPaths) string {
|
||||||
return filepath.Join(paths.CacheDir, "notarius", "references")
|
return paths.ReferencesDir
|
||||||
}
|
}
|
||||||
|
|
||||||
// SessionNotariusReferenceSnapshotPath returns the content-addressed path for
|
// SessionNotariusReferenceSnapshotPath returns the content-addressed path for
|
||||||
@@ -280,27 +297,26 @@ func buildSessionPaths(workspaceRoot, campaign, sessionID string) SessionPaths {
|
|||||||
|
|
||||||
func buildSessionPathsFromRoot(workspaceRoot, campaign, sessionID, root string) SessionPaths {
|
func buildSessionPathsFromRoot(workspaceRoot, campaign, sessionID, root string) SessionPaths {
|
||||||
return SessionPaths{
|
return SessionPaths{
|
||||||
WorkspaceRoot: workspaceRoot,
|
WorkspaceRoot: workspaceRoot,
|
||||||
CampaignID: campaign,
|
CampaignID: campaign,
|
||||||
SessionID: sessionID,
|
SessionID: sessionID,
|
||||||
Root: root,
|
Root: root,
|
||||||
InputsDir: filepath.Join(root, config.PathInputsDirSegment),
|
InputsDir: filepath.Join(root, config.PathInputsDirSegment),
|
||||||
AudioDir: filepath.Join(root, config.PathAudioDirSegment),
|
AudioDir: filepath.Join(root, config.PathAudioDirSegment),
|
||||||
TranscriptsDir: filepath.Join(root, config.PathTranscriptsSegment),
|
TranscriptsDir: filepath.Join(root, config.PathTranscriptsSegment),
|
||||||
TranscriptsRawDir: filepath.Join(root, filepath.FromSlash(config.PathTranscriptsRaw)),
|
TranscriptsRawDir: filepath.Join(root, filepath.FromSlash(config.PathTranscriptsRaw)),
|
||||||
TranscriptsTrimmedDir: filepath.Join(root, filepath.FromSlash(config.PathTranscriptsTrimmed)),
|
ArtifactsDir: filepath.Join(root, config.PathArtifactsDirSegment),
|
||||||
ArtifactsDir: filepath.Join(root, config.PathArtifactsDirSegment),
|
ReportsDir: filepath.Join(root, config.PathReportsDirSegment),
|
||||||
ReportsDir: filepath.Join(root, config.PathReportsDirSegment),
|
ConfigDir: filepath.Join(root, config.PathConfigDirSegment),
|
||||||
ConfigDir: filepath.Join(root, config.PathConfigDirSegment),
|
LogsDir: filepath.Join(root, config.PathLogsDirSegment),
|
||||||
LogsDir: filepath.Join(root, config.PathLogsDirSegment),
|
DebugDir: filepath.Join(root, "debug"),
|
||||||
CurrentDir: filepath.Join(root, config.PathCurrentDirSegment),
|
ReferencesDir: filepath.Join(root, config.PathInputsDirSegment, "references"),
|
||||||
RunsDir: filepath.Join(root, config.PathRunsDirSegment),
|
RunsDir: filepath.Join(root, config.PathRunsDirSegment),
|
||||||
PreviousDir: filepath.Join(root, config.PathPreviousDirSegment),
|
PreviousDir: filepath.Join(root, config.PathInputsDirSegment, config.PathPreviousDirSegment),
|
||||||
CacheDir: filepath.Join(root, config.PathCacheDirSegment),
|
PreviousManifestPath: filepath.Join(root, config.PathInputsDirSegment, config.PathPreviousDirSegment, config.PathManifestFile),
|
||||||
PreviousManifestPath: filepath.Join(root, config.PathPreviousDirSegment, config.PathManifestFile),
|
PreviousArtifactsDir: filepath.Join(root, config.PathInputsDirSegment, config.PathPreviousDirSegment, config.PathArtifactsDirSegment),
|
||||||
PreviousArtifactsDir: filepath.Join(root, config.PathPreviousDirSegment, config.PathArtifactsDirSegment),
|
ManifestPath: filepath.Join(root, config.PathManifestFile),
|
||||||
ManifestPath: filepath.Join(root, config.PathManifestFile),
|
LockPath: filepath.Join(root, config.PathLockFile),
|
||||||
LockPath: filepath.Join(root, config.PathLockFile),
|
RestoreMarkerPath: filepath.Join(root, ".restore-incomplete.json"),
|
||||||
RestoreMarkerPath: filepath.Join(root, ".restore-incomplete.json"),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,40 @@
|
|||||||
package artifacts
|
package artifacts
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func TestCanonicalSessionLayout(t *testing.T) {
|
||||||
|
root := t.TempDir()
|
||||||
|
store := NewLocalStore(root)
|
||||||
|
paths, err := store.EnsureLayoutFor("campaign", "session")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
for name, got := range map[string]string{
|
||||||
|
"inputs": paths.InputsDir, "audio": paths.AudioDir, "transcripts": paths.TranscriptsDir,
|
||||||
|
"transcripts/raw": paths.TranscriptsRawDir, "artifacts": paths.ArtifactsDir,
|
||||||
|
"inputs/previous": paths.PreviousDir, "inputs/references": paths.ReferencesDir,
|
||||||
|
"logs": paths.LogsDir, "debug": paths.DebugDir, "runs": paths.RunsDir,
|
||||||
|
"logs/polish": SessionLatestLogsPath(paths, "polish"),
|
||||||
|
"debug/polish": SessionLatestDebugPath(paths, "polish"),
|
||||||
|
"runs/run/polish/logs": SessionRunLogsDir(paths, "run", "polish"),
|
||||||
|
"runs/run/polish/debug": SessionRunDebugDir(paths, "run", "polish"),
|
||||||
|
} {
|
||||||
|
if want := filepath.Join(paths.Root, filepath.FromSlash(name)); got != want {
|
||||||
|
t.Errorf("%s = %q, want %q", name, got, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, name := range []string{"transcripts/trimmed", "current", "runs/run", "logs/polish", "debug/polish"} {
|
||||||
|
if _, err := os.Lstat(filepath.Join(paths.Root, filepath.FromSlash(name))); !os.IsNotExist(err) {
|
||||||
|
t.Errorf("%s exists or inaccessible: %v", name, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestSessionWorkDirForCampaign(t *testing.T) {
|
func TestSessionWorkDirForCampaign(t *testing.T) {
|
||||||
root := "/tmp/workspace"
|
root := "/tmp/workspace"
|
||||||
got := SessionWorkDirForCampaign(root, "forsaken", "2026-04-19")
|
got := SessionWorkDirForCampaign(root, "forsaken", "2026-04-19")
|
||||||
@@ -74,7 +103,7 @@ func TestSessionNotariusReferenceSnapshotPath(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("SessionNotariusReferenceSnapshotPath() error = %v", err)
|
t.Fatalf("SessionNotariusReferenceSnapshotPath() error = %v", err)
|
||||||
}
|
}
|
||||||
wantRoot := filepath.Join(paths.Root, "cache", "notarius", "references")
|
wantRoot := filepath.Join(paths.Root, "inputs", "references")
|
||||||
if root := SessionNotariusReferenceCacheDir(paths); root != wantRoot {
|
if root := SessionNotariusReferenceCacheDir(paths); root != wantRoot {
|
||||||
t.Fatalf("SessionNotariusReferenceCacheDir() = %q, want %q", root, wantRoot)
|
t.Fatalf("SessionNotariusReferenceCacheDir() = %q, want %q", root, wantRoot)
|
||||||
}
|
}
|
||||||
@@ -107,25 +136,25 @@ func TestSessionNotariusReferenceSnapshotPathRejectsUnsafeIdentity(t *testing.T)
|
|||||||
func TestSessionPreviousPathsForCampaign(t *testing.T) {
|
func TestSessionPreviousPathsForCampaign(t *testing.T) {
|
||||||
root := "/tmp/workspace"
|
root := "/tmp/workspace"
|
||||||
previousDir := SessionPreviousDirForCampaign(root, "forsaken", "2026-04-19")
|
previousDir := SessionPreviousDirForCampaign(root, "forsaken", "2026-04-19")
|
||||||
wantPreviousDir := filepath.Join(root, "work", "forsaken", "2026-04-19", "previous")
|
wantPreviousDir := filepath.Join(root, "work", "forsaken", "2026-04-19", "inputs", "previous")
|
||||||
if previousDir != wantPreviousDir {
|
if previousDir != wantPreviousDir {
|
||||||
t.Fatalf("SessionPreviousDirForCampaign() = %q, want %q", previousDir, wantPreviousDir)
|
t.Fatalf("SessionPreviousDirForCampaign() = %q, want %q", previousDir, wantPreviousDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
manifestPath := SessionPreviousManifestPathForCampaign(root, "forsaken", "2026-04-19")
|
manifestPath := SessionPreviousManifestPathForCampaign(root, "forsaken", "2026-04-19")
|
||||||
wantManifestPath := filepath.Join(root, "work", "forsaken", "2026-04-19", "previous", "manifest.json")
|
wantManifestPath := filepath.Join(root, "work", "forsaken", "2026-04-19", "inputs", "previous", "manifest.json")
|
||||||
if manifestPath != wantManifestPath {
|
if manifestPath != wantManifestPath {
|
||||||
t.Fatalf("SessionPreviousManifestPathForCampaign() = %q, want %q", manifestPath, wantManifestPath)
|
t.Fatalf("SessionPreviousManifestPathForCampaign() = %q, want %q", manifestPath, wantManifestPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
artifactsDir := SessionPreviousArtifactsDirForCampaign(root, "forsaken", "2026-04-19")
|
artifactsDir := SessionPreviousArtifactsDirForCampaign(root, "forsaken", "2026-04-19")
|
||||||
wantArtifactsDir := filepath.Join(root, "work", "forsaken", "2026-04-19", "previous", "artifacts")
|
wantArtifactsDir := filepath.Join(root, "work", "forsaken", "2026-04-19", "inputs", "previous", "artifacts")
|
||||||
if artifactsDir != wantArtifactsDir {
|
if artifactsDir != wantArtifactsDir {
|
||||||
t.Fatalf("SessionPreviousArtifactsDirForCampaign() = %q, want %q", artifactsDir, wantArtifactsDir)
|
t.Fatalf("SessionPreviousArtifactsDirForCampaign() = %q, want %q", artifactsDir, wantArtifactsDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
artifactPath := mustSessionPreviousArtifactPathForCampaign(t, root, "forsaken", "2026-04-19", "session_recap.md")
|
artifactPath := mustSessionPreviousArtifactPathForCampaign(t, root, "forsaken", "2026-04-19", "session_recap.md")
|
||||||
wantArtifactPath := filepath.Join(root, "work", "forsaken", "2026-04-19", "previous", "artifacts", "session_recap.md")
|
wantArtifactPath := filepath.Join(root, "work", "forsaken", "2026-04-19", "inputs", "previous", "artifacts", "session_recap.md")
|
||||||
if artifactPath != wantArtifactPath {
|
if artifactPath != wantArtifactPath {
|
||||||
t.Fatalf("mustSessionPreviousArtifactPathForCampaign(t, ) = %q, want %q", artifactPath, wantArtifactPath)
|
t.Fatalf("mustSessionPreviousArtifactPathForCampaign(t, ) = %q, want %q", artifactPath, wantArtifactPath)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,15 +67,12 @@ const (
|
|||||||
PathAudioDirSegment = "audio"
|
PathAudioDirSegment = "audio"
|
||||||
PathTranscriptsSegment = "transcripts"
|
PathTranscriptsSegment = "transcripts"
|
||||||
PathTranscriptsRaw = "transcripts/raw"
|
PathTranscriptsRaw = "transcripts/raw"
|
||||||
PathTranscriptsTrimmed = "transcripts/trimmed"
|
|
||||||
PathArtifactsDirSegment = "artifacts"
|
PathArtifactsDirSegment = "artifacts"
|
||||||
PathReportsDirSegment = "reports"
|
PathReportsDirSegment = "reports"
|
||||||
PathConfigDirSegment = "config"
|
PathConfigDirSegment = "config"
|
||||||
PathLogsDirSegment = "logs"
|
PathLogsDirSegment = "logs"
|
||||||
PathCurrentDirSegment = "current"
|
|
||||||
PathRunsDirSegment = "runs"
|
PathRunsDirSegment = "runs"
|
||||||
PathPreviousDirSegment = "previous"
|
PathPreviousDirSegment = "previous"
|
||||||
PathCacheDirSegment = "cache"
|
|
||||||
PathManifestFile = "manifest.json"
|
PathManifestFile = "manifest.json"
|
||||||
PathLockFile = ".lock"
|
PathLockFile = ".lock"
|
||||||
PathTranscriptBase = artifactmodel.TranscriptPathBase
|
PathTranscriptBase = artifactmodel.TranscriptPathBase
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ func absoluteExtractSnapshotPaths(paths artifacts.SessionPaths) (artifacts.Sessi
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return paths, fmt.Errorf("resolve snapshot session root: %w", err)
|
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 {
|
if err != nil {
|
||||||
return paths, fmt.Errorf("resolve snapshot cache root: %w", err)
|
return paths, fmt.Errorf("resolve snapshot cache root: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,8 @@ func runLocalPathForCanonical(layout runStageLayout, sessionPaths artifacts.Sess
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("derive session-relative path for %q: %w", cleanCanonical, err)
|
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
|
return cleanCanonical, nil
|
||||||
}
|
}
|
||||||
localPath, err := pathsafe.JoinSlashRelativeUnderRoot(layout.OutputsDir, rel)
|
localPath, err := pathsafe.JoinSlashRelativeUnderRoot(layout.OutputsDir, rel)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ func TestRunLocalPathForCanonicalKeepsPreviousStateSessionDurable(t *testing.T)
|
|||||||
t.Fatalf("mkdir outputs dir: %v", err)
|
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)
|
got, err := runLocalPathForCanonical(layout, artifacts.SessionPaths{Root: sessionRoot}, canonical)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("runLocalPathForCanonical() error = %v", err)
|
t.Fatalf("runLocalPathForCanonical() error = %v", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user