Artifact 8f3802636d5fcbd21f4add8f96c9aa234185af4c639a313918e9ec67319e72de:
- File
cmd/quarry/accountstore_test.go
— part of check-in
[b7d4a089fb]
at
2026-08-22 00:32:45
on branch trunk
— dashboard: site admins see the fleet — GrantsFor carries the '' marker
me.feed keyed on grants[''] but nothing ever wrote it; an admin with no explicit rows saw an empty dashboard. (user: dmestas, size: 1141) [annotate] [blame] [check-ins using]
package main import ( "path/filepath" "testing" "craftdesign.group/quarry/internal/oltp" ) // A site admin with no explicit repo_role rows must still read as // "the fleet is yours": GrantsFor carries the "" marker me.feed keys // on. This is the dashboard-was-empty regression (2026-08-21). func TestGrantsForCarriesSiteAdminMarker(t *testing.T) { db, err := oltp.Open(filepath.Join(t.TempDir(), "oltp.db")) if err != nil { t.Fatal(err) } defer db.Close() if err := db.AddAccount("root", "pw12345678", true); err != nil { t.Fatal(err) } if err := db.AddAccount("plain", "pw12345678", false); err != nil { t.Fatal(err) } if err := db.Grant("plain", "alpha", oltp.Write); err != nil { t.Fatal(err) } st := accountStore{db: db} admin, err := st.GrantsFor("root") if err != nil { t.Fatal(err) } if admin[""] != "admin" { t.Fatalf("site admin marker missing: %v", admin) } user, err := st.GrantsFor("plain") if err != nil { t.Fatal(err) } if _, has := user[""]; has { t.Fatalf("plain account grew the marker: %v", user) } if user["alpha"] != "write" { t.Fatalf("explicit grant lost: %v", user) } }