Merge pull request '[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/store/RFC.md fully. Find features d...' (#86) from agent/read---spec-code-core-go-store-rfc-md-fu into dev
This commit is contained in:
commit
ff29823f37
2 changed files with 23 additions and 1 deletions
10
workspace.go
10
workspace.go
|
|
@ -32,7 +32,7 @@ FROM workspace_entries`
|
|||
|
||||
var defaultWorkspaceStateDirectory = ".core/state"
|
||||
|
||||
// Workspace buffers mutable work-in-progress in a temporary SQLite file.
|
||||
// Workspace buffers mutable work-in-progress in a temporary database file.
|
||||
//
|
||||
// Usage example: `workspace, err := storeInstance.NewWorkspace("scroll-session-2026-03-30"); if err != nil { return }; defer workspace.Discard()`
|
||||
type Workspace struct {
|
||||
|
|
@ -54,6 +54,14 @@ func (workspace *Workspace) Name() string {
|
|||
return workspace.name
|
||||
}
|
||||
|
||||
// Usage example: `workspacePath := workspace.DatabasePath(); fmt.Println(workspacePath)`
|
||||
func (workspace *Workspace) DatabasePath() string {
|
||||
if workspace == nil {
|
||||
return ""
|
||||
}
|
||||
return workspace.databasePath
|
||||
}
|
||||
|
||||
func (workspace *Workspace) ensureReady(operation string) error {
|
||||
if workspace == nil {
|
||||
return core.E(operation, "workspace is nil", nil)
|
||||
|
|
|
|||
|
|
@ -40,6 +40,20 @@ func TestWorkspace_NewWorkspace_Good_CreatePutAggregateQuery(t *testing.T) {
|
|||
assert.Equal(t, int64(1), rows[1]["entry_count"])
|
||||
}
|
||||
|
||||
func TestWorkspace_DatabasePath_Good(t *testing.T) {
|
||||
stateDirectory := useWorkspaceStateDirectory(t)
|
||||
|
||||
storeInstance, err := New(":memory:")
|
||||
require.NoError(t, err)
|
||||
defer storeInstance.Close()
|
||||
|
||||
workspace, err := storeInstance.NewWorkspace("scroll-session")
|
||||
require.NoError(t, err)
|
||||
defer workspace.Discard()
|
||||
|
||||
assert.Equal(t, workspaceFilePath(stateDirectory, "scroll-session"), workspace.DatabasePath())
|
||||
}
|
||||
|
||||
func TestWorkspace_Query_Good_RFCEntriesView(t *testing.T) {
|
||||
useWorkspaceStateDirectory(t)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue