Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Merge release channels into the account database and rename it instance.db

3047be84e9bce79372051c09854ce9b05f12a9bf · Keenan Nemetz · 17d ago · parent 262e516e

Merge release channels into the account database and rename it instance.db

The instance keeps four SQLite files instead of five. Release channels were in a
file of their own only because they were added beside the derived index; they are
authoritative source state, like the roster, so they belong in the file an
operator restores. Nothing has to be migrated: channels.db never shipped in a
release, so only an instance tracking main can have one.

The account database is now data/instance.db. The package comments already called
it that; only the filename disagreed.

Moving an existing instance is an operator step, by decision: a rename under a
live server can lose the -wal file a hook subprocess still has open. Vole refuses
to start while data/users.db is still in place, and says what to move, rather
than creating an empty database beside it that would look like a successful
upgrade.

The list of databases now lives in Config.Databases, which TightenSecrets, the
hook plumbing, and the admin commands read, so a missed -wal file is no longer a
nine-file change. `vole admin account backup <path>` becomes `vole admin db
backup <dir>` and covers every authoritative database; `db list` and `db check`
answer what to back up and whether it is intact.

forge/channel/channel_test.go +22−2

@@ -1,15 +1,28 @@
1 1 package channel
2 2
3 3 import (
4 "os"
4 5 "path/filepath"
5 6 "strings"
6 7 "testing"
7 8 "time"
8 9 )
9 10
11 // newDB is the instance database a store is opened on. The channel table lives in
12 // the file the roster owns, so this package does not create it: a test creates the
13 // file the way an initialised instance already has it.
14 func newDB(t *testing.T) string {
15 t.Helper()
16 path := filepath.Join(t.TempDir(), "instance.db")
17 if err := os.WriteFile(path, nil, 0o600); err != nil {
18 t.Fatal(err)
19 }
20 return path
21 }
22
10 23 func openTest(t *testing.T) *Store {
11 24 t.Helper()
12 s, err := Open(filepath.Join(t.TempDir(), "channels.db"))
25 s, err := Open(newDB(t))
13 26 if err != nil {
14 27 t.Fatal(err)
15 28 }
@@ -17,6 +30,13 @@ func openTest(t *testing.T) *Store {
17 30 return s
18 31 }
19 32
33 func TestOpenRequiresTheInstanceDatabase(t *testing.T) {
34 t.Parallel()
35 if _, err := Open(filepath.Join(t.TempDir(), "absent.db")); err == nil {
36 t.Fatal("Open created a database; the instance database is not this package's to create")
37 }
38 }
39
20 40 func TestValidName(t *testing.T) {
21 41 t.Parallel()
22 42 for _, ok := range []string{"stable", "latest", "beta", "lts-2026", "a"} {
@@ -118,7 +138,7 @@ func TestSetValidates(t *testing.T) {
118 138
119 139 func TestOpenPersists(t *testing.T) {
120 140 t.Parallel()
121 path := filepath.Join(t.TempDir(), "channels.db")
141 path := newDB(t)
122 142 s, err := Open(path)
123 143 if err != nil {
124 144 t.Fatal(err)