[agent/codex:gpt-5.4-mini] Read docs/RFC-STORE.md and docs/specs/core/go/RFC.md fully. ... #161

Merged
Virgil merged 1 commit from agent/read-docs-rfc-store-md-and-docs-specs-co into dev 2026-04-04 19:02:48 +00:00
2 changed files with 26 additions and 2 deletions

View file

@ -419,7 +419,7 @@ func (workspace *Workspace) closeAndCleanup(removeFiles bool) error {
if workspace == nil {
return nil
}
if workspace.sqliteDatabase == nil || workspace.filesystem == nil {
if workspace.sqliteDatabase == nil {
return nil
}
@ -435,7 +435,7 @@ func (workspace *Workspace) closeAndCleanup(removeFiles bool) error {
return core.E("store.Workspace.closeAndCleanup", "close workspace database", err)
}
}
if !removeFiles {
if !removeFiles || workspace.filesystem == nil {
return nil
}
for _, path := range []string{workspace.databasePath, workspace.databasePath + "-wal", workspace.databasePath + "-shm"} {

View file

@ -226,6 +226,30 @@ func TestWorkspace_Close_Good_PreservesFileForRecovery(t *testing.T) {
assert.False(t, testFilesystem().Exists(workspace.databasePath))
}
func TestWorkspace_Close_Good_ClosesDatabaseWithoutFilesystem(t *testing.T) {
databasePath := testPath(t, "workspace-no-filesystem.duckdb")
sqliteDatabase, err := openWorkspaceDatabase(databasePath)
require.NoError(t, err)
workspace := &Workspace{
name: "partial-workspace",
sqliteDatabase: sqliteDatabase,
databasePath: databasePath,
}
require.NoError(t, workspace.Close())
_, execErr := sqliteDatabase.Exec("SELECT 1")
require.Error(t, execErr)
assert.Contains(t, execErr.Error(), "closed")
assert.True(t, testFilesystem().Exists(databasePath))
requireCoreOK(t, testFilesystem().Delete(databasePath))
_ = testFilesystem().Delete(databasePath + "-wal")
_ = testFilesystem().Delete(databasePath + "-shm")
}
func TestWorkspace_RecoverOrphans_Good(t *testing.T) {
stateDirectory := useWorkspaceStateDirectory(t)