526c19fc21
- Persist chat stars in the operator-session registry (chat_star) so every browser/device shows the same Starred group; migrate old local stars once. - Add a compact pipeline graph shape to list responses and draw a lightweight list miniature; replace the cryptic id/version line with the stage count. - Surface OpenCode form questions as a chat card (chat_answer), replay a pending form to late subscribers, and notify for background questions. - Make the mobile dock's Search cell equal to every destination, keep the tab row visible with 100svh, and let Source use the full pane height. - Let a fresh sign-in auto-connect to its own origin; use a Lax session cookie with Expires so Remember me survives app/link launches. - Keep shipped starters and the skill agnostic: no repository paths, project areas or personal device commands; add Diagnose/Fix and Research starters. - Refresh the installed skill and document the new browser conventions.
54 lines
1.7 KiB
Go
54 lines
1.7 KiB
Go
package pipeline
|
|
|
|
import (
|
|
"context"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
// TestOperatorSessionStarIsSharedAndReversible proves the server-side star
|
|
// contract: starring records starred_at on the registry row, listing returns it,
|
|
// unstarring clears it, and the OpenCode session id and other fields are never
|
|
// changed. This is what makes the Starred group visible from every browser.
|
|
func TestOperatorSessionStarIsSharedAndReversible(t *testing.T) {
|
|
ctx := context.Background()
|
|
store, err := Open(filepath.Join(t.TempDir(), "star.db"))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer store.Close()
|
|
if err := store.RecordOperatorSession(ctx, "ses_a", "/work/a", "A", "operator"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := store.SetOperatorSessionStar(ctx, "ses_a", true); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
starred, found, err := store.OperatorSession(ctx, "ses_a")
|
|
if err != nil || !found {
|
|
t.Fatalf("starred lookup: found=%v err=%v", found, err)
|
|
}
|
|
if starred.StarredAt <= 0 {
|
|
t.Fatalf("star did not record starred_at: %+v", starred)
|
|
}
|
|
listed, err := store.OperatorSessions(ctx)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(listed) != 1 || listed[0].StarredAt != starred.StarredAt {
|
|
t.Fatalf("list did not return the shared star: %+v", listed)
|
|
}
|
|
if err := store.SetOperatorSessionStar(ctx, "ses_a", false); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
plain, found, err := store.OperatorSession(ctx, "ses_a")
|
|
if err != nil || !found {
|
|
t.Fatalf("unstarred lookup: found=%v err=%v", found, err)
|
|
}
|
|
if plain.StarredAt != 0 {
|
|
t.Fatalf("unstar did not clear starred_at: %+v", plain)
|
|
}
|
|
if plain.ID != "ses_a" || plain.Directory != "/work/a" || plain.Title != "A" || plain.Tag != "operator" {
|
|
t.Fatalf("star toggling changed other session fields: %+v", plain)
|
|
}
|
|
}
|