fix(session): preserve the starred flag in AddSession - #4182
Conversation
|
👋 Some commits in this PR are not signed and verified by GitHub. Please sign your commits with a GPG or SSH key registered in your GitHub account, then force-push. Commits that are not verified: See GitHub's guide on signing commits for setup instructions. I've added |
SQLiteSessionStore.AddSession built its own INSERT that omitted the starred column, while UpdateSession, addSessionTx and PersistCompaction all set it. Forking a starred session therefore dropped the star, since copySessionMetadata copies it and ForkSession persists via AddSession. The INSERT was otherwise identical to addSessionTx, so call that instead of maintaining a second column list that can drift again. Noticed while mapping the session schema for docker#4181.
63e8c0f to
fcab72f
Compare
|
Thanks — sorry for the noise. The signature was in place, but I registered the SSH signing key on my account about two minutes after the check ran, so I've since force-pushed (identical tree, re-signed): |
What
SQLiteSessionStore.AddSessionbuilt its ownINSERT INTO sessions (...)that omittedthe
starredcolumn, so the flag was silently dropped on insert.UpdateSession,addSessionTxandPersistCompactionall set it.The user-visible effect is on fork:
copySessionMetadatacopiesStarredto the newsession, and
ForkSessionpersists it throughAddSession— so forking a starredsession produces an unstarred fork. Reachable from
POST /api/sessions/:id/forkandfrom the TUI fork path. The in-memory store keeps the flag, so the two backends disagree.
Why this shape
AddSession's INSERT was otherwise byte-for-byte identical toaddSessionTx, whichalready inserts
starredcorrectly. Rather than adding the missing column to a secondlist that can drift again,
AddSessionnow callsaddSessionTx. Net -1 line.This is not a regression: the column list has been missing
starredsince the starringfeature was added in
875b4dd6(Jan 2026), and it survived both345b8aeed(
refactor(session): collapse duplicated session marshalling/SQL) and93b1673b1(
refactor(session): scan SQL columns into native Go types) untouched.Test
TestAddSession_PreservesStarredfails onmain(Should be true) and passes with thechange.
./pkg/session/...,./pkg/server/...,./pkg/acp/...,./pkg/evaluation/...and
./pkg/tui/...all pass;go vetis clean.Context
Noticed while mapping the session schema for #4181 (pluggable persistent session stores).
Happy to fold this into that work instead if you would rather keep it together.