[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/store/RFC.md fully. Find features d... #62
3 changed files with 7 additions and 16 deletions
2
store.go
2
store.go
|
|
@ -146,7 +146,6 @@ func NewConfigured(config StoreConfig) (*Store, error) {
|
|||
}
|
||||
|
||||
storeInstance.startBackgroundPurge()
|
||||
storeInstance.discardRecoveredOrphans(defaultWorkspaceStateDirectory)
|
||||
return storeInstance, nil
|
||||
}
|
||||
|
||||
|
|
@ -162,7 +161,6 @@ func New(databasePath string, options ...StoreOption) (*Store, error) {
|
|||
}
|
||||
}
|
||||
storeInstance.startBackgroundPurge()
|
||||
storeInstance.discardRecoveredOrphans(defaultWorkspaceStateDirectory)
|
||||
return storeInstance, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
11
workspace.go
11
workspace.go
|
|
@ -169,17 +169,6 @@ func (storeInstance *Store) RecoverOrphans(stateDirectory string) []*Workspace {
|
|||
return orphanWorkspaces
|
||||
}
|
||||
|
||||
func (storeInstance *Store) discardRecoveredOrphans(stateDirectory string) {
|
||||
if storeInstance == nil {
|
||||
return
|
||||
}
|
||||
|
||||
for _, orphanWorkspace := range storeInstance.RecoverOrphans(stateDirectory) {
|
||||
_ = orphanWorkspace.Aggregate()
|
||||
orphanWorkspace.Discard()
|
||||
}
|
||||
}
|
||||
|
||||
// Usage example: `err := workspace.Put("like", map[string]any{"user": "@alice", "post": "video_123"})`
|
||||
func (workspace *Workspace) Put(kind string, data map[string]any) error {
|
||||
if err := workspace.ensureReady("store.Workspace.Put"); err != nil {
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ func TestWorkspace_RecoverOrphans_Good(t *testing.T) {
|
|||
assert.False(t, testFilesystem().Exists(workspaceFilePath(stateDirectory, "orphan-session")))
|
||||
}
|
||||
|
||||
func TestWorkspace_New_Good_CleansUpOrphanedWorkspaces(t *testing.T) {
|
||||
func TestWorkspace_New_Good_PreservesOrphanedWorkspacesUntilRecovered(t *testing.T) {
|
||||
stateDirectory := useWorkspaceStateDirectory(t)
|
||||
requireCoreOK(t, testFilesystem().EnsureDir(stateDirectory))
|
||||
|
||||
|
|
@ -197,7 +197,11 @@ func TestWorkspace_New_Good_CleansUpOrphanedWorkspaces(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
defer storeInstance.Close()
|
||||
|
||||
assert.True(t, testFilesystem().Exists(orphanDatabasePath))
|
||||
|
||||
orphans := storeInstance.RecoverOrphans(stateDirectory)
|
||||
require.Len(t, orphans, 1)
|
||||
orphans[0].Discard()
|
||||
|
||||
assert.False(t, testFilesystem().Exists(orphanDatabasePath))
|
||||
assert.False(t, testFilesystem().Exists(orphanDatabasePath+"-wal"))
|
||||
assert.False(t, testFilesystem().Exists(orphanDatabasePath+"-shm"))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue