Clarify managed session storage and excluded native histories
This commit is contained in:
@@ -15,6 +15,8 @@ import (
|
||||
)
|
||||
|
||||
const storageInterval = time.Hour
|
||||
|
||||
const storageScopeNotice = "Native Claude, Codex and OpenCode histories outside Pipelines data and known project directories are not included."
|
||||
const storagePreviewLifetime = 10 * time.Minute
|
||||
|
||||
type storagePreview struct {
|
||||
@@ -143,7 +145,7 @@ func (m *storageManager) overview(ctx context.Context) (*protocol.StorageOvervie
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result := &protocol.StorageOverview{Measurement: "logical_file_bytes", TotalBytes: inventory.TotalBytes, Policy: policy, MeasuredAt: time.Now().UTC().Format(time.RFC3339), Partial: inventory.Partial, Warnings: inventory.Errors, AutomaticIntervalSeconds: int(storageInterval / time.Second), Categories: []protocol.StorageCategory{}}
|
||||
result := &protocol.StorageOverview{Measurement: "logical_file_bytes", TotalBytes: inventory.TotalBytes, Policy: policy, MeasuredAt: time.Now().UTC().Format(time.RFC3339), Partial: inventory.Partial, Warnings: append([]string{storageScopeNotice}, inventory.Errors...), AutomaticIntervalSeconds: int(storageInterval / time.Second), Categories: []protocol.StorageCategory{}}
|
||||
for _, c := range inventory.Categories {
|
||||
result.Categories = append(result.Categories, protocol.StorageCategory{ID: c.ID, Label: c.Label, Path: c.Path, Bytes: c.Bytes, Files: c.Files, Partial: c.Partial, Error: c.Error})
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ func inspectStorage(ctx context.Context, config storageInventoryConfig) (storage
|
||||
}
|
||||
add(storageCategory{ID: "artifacts", Label: "Run artifacts and exports", Path: config.ArtifactsRoot}, config.ArtifactsRoot)
|
||||
add(storageCategory{ID: "attachments", Label: "Chat attachments", Path: config.AttachmentsRoot}, config.AttachmentsRoot)
|
||||
add(storageCategory{ID: "sessions", Label: "Harness session files", Path: config.SessionsRoot}, config.SessionsRoot)
|
||||
add(storageCategory{ID: "sessions", Label: "Managed Pi session files", Path: config.SessionsRoot}, config.SessionsRoot)
|
||||
add(storageCategory{ID: "other_data", Label: "Other server data", Path: config.DataRoot}, config.DataRoot)
|
||||
category := storageCategory{ID: "worktrees", Label: "Linked worktrees"}
|
||||
// Nested linked trees are attributed before their parents.
|
||||
|
||||
@@ -202,6 +202,30 @@ func TestStorageWebsocketProtocolAndNoStartupCleanup(t *testing.T) {
|
||||
if reply.Type != protocol.StorageReply || reply.ID != "storage" || reply.Storage == nil || !reply.Storage.Policy.Enabled {
|
||||
t.Fatalf("wire %+v", reply)
|
||||
}
|
||||
if reply.Storage.Partial {
|
||||
t.Fatal("a scope notice must not mark a complete inventory partial")
|
||||
}
|
||||
foundNotice := false
|
||||
for _, warning := range reply.Storage.Warnings {
|
||||
if warning == storageScopeNotice {
|
||||
foundNotice = true
|
||||
}
|
||||
}
|
||||
if !foundNotice {
|
||||
t.Fatalf("wire reply omitted inventory scope notice: %+v", reply.Storage.Warnings)
|
||||
}
|
||||
foundSessions := false
|
||||
for _, category := range reply.Storage.Categories {
|
||||
if category.ID == "sessions" {
|
||||
foundSessions = true
|
||||
if category.Label != "Managed Pi session files" {
|
||||
t.Fatalf("ambiguous session category: %q", category.Label)
|
||||
}
|
||||
}
|
||||
}
|
||||
if !foundSessions {
|
||||
t.Fatal("wire reply omitted managed Pi session category")
|
||||
}
|
||||
if _, err := f.m.store.GetRun(ctx, id); err != nil {
|
||||
t.Fatal("startup pruned run", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user