Follow-up to crayonlu's commit (Grok Build sessions deletable, their
session_search.sqlite rows dropped first). Review of that commit:
Sound: the delete is scoped to the session's own folders (updates.jsonl's
dir, plus its subagents' sibling folders grokFiles already folds in); the
cwd's prompt_history.jsonl and other sessions stay. The index is opened by
a normal connection with a 5 s busy timeout and BEGIN IMMEDIATE, so it
works beside a running Grok Build (WAL, the file's journal mode is left as
it is); a file that can't be opened or read stops the delete before
anything moves (failed read = unknown); no index or no tables deletes as
before. Nothing touches the network, no new dependency, no .github/site.
Checked against Grok Build 1.0.67 itself (its binary's SQL and the index
it wrote on this machine, copied, never opened live): session_docs has
session_id, cwd, updated_at, title, content, content_hash, over
session_docs_fts with the _ai/_ad/_au triggers; there is no
DELETE FROM session_docs in the binary, so Grok has no delete of its own
to match.
Wrong or thin: Restore did not put the index row back, and Grok Build's
bootstrap is stamped in meta.last_bootstrap_at, so nothing says it indexes a
restored folder again; a move that failed after the rows were gone
left the session whole but unindexed. Now grokSearchRowsDrop returns the
rows, every column by name (so a Grok Build that adds a column keeps it),
and Delete keeps them in the trash entry's grok_search.json (not in the
note the Trash page lists). Restore INSERT OR IGNOREs them (a row Grok
wrote again meanwhile wins; an unwritable index doesn't stop a restore),
and a delete that stops after dropping them puts them back.
TestGrokDeleteRestore now checks the rows and FTS entries are back;
TestGrokSearchRowsComeBackWhole checks every column and the kept row.
Broken by hand: Restore without the put is red on "after the restore: 0
rows and 0 found".
Run (mote, worktree of this branch; full suite at rebased 0a37c9368 base,
go test -count=1 -timeout 45m ./..., log kept): every package ok except
internal/gateway (TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes, red on
a pristine origin/main 0a37c9368 too: #7117; a doneHold panic, #6505/#6690)
and internal/gui (TestGatewayPauseRollsBack, TestGatewayPauseFileUnreadable:
TempDir cleanup "directory not empty" only inside the parallel full run,
filed #7232; ./internal/gui alone is ok on origin/main 0a37c9368 (158 s) and
on this branch (174 s)). Neither touches sessions. gofmt -l clean; go vet
(darwin), GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...
clean. The Grok tests also pass on Windows (win-run) and WSL (wsl-run),
real SQLite files in WAL mode in all three. After the last rebase (onto
04e62892e; three library/gateway commits, none in sessions or gui) the
sessions/... (60.8 s) and gui (171.8 s) packages were run again at the
pushed head: ok.
Not tried: a real Grok Build deleting or re-indexing a session itself, and
the real index here was only read from a copy. Still not deletable on the
Sessions page (#4595 stays open for them): Hermes, Alma, OpenCode, ZCode,
Cline, Kimi Code and Claude Desktop (Cowork).