Release 2026.08.02-1

SQLite replaces Postgres, and two fixes from using the thing.

- The database is a file under ./storage instead of a second container. Ten
  members never needed a database server, and the driver is pure Go, so the
  build stays CGO_ENABLED=0 and the dependency count is unchanged. One bind
  mount is now the whole backup: no pgdata, no healthcheck-gated depends_on,
  no startup retry loop. Timestamps are UTC text, idle_ttl is seconds, the
  divisive/unified boards carry their own stddev, and foreign keys are on by
  pragma. Tests get a database file each and run without any setup
- Invites are copied, not clicked. An invite is something to send, and the
  anchor opened the join form in the admin's own browser
- Feedback asks for more than faults: the footer reads "Ongelmia? Ideoita?
  Palautetta?" and the page behind it invites ideas rather than only bugs
- Kuuntele YouTubessa opens in a new tab, so a half-typed review survives it
This commit is contained in:
Esa Kataja
2026-08-02 20:58:52 +03:00
parent 400b5d3833
commit 0f15ae0bfc
33 changed files with 480 additions and 396 deletions
+16 -16
View File
@@ -8,7 +8,7 @@ import (
func (a *app) seedSong(t *testing.T, submitter int64, title string) int64 {
t.Helper()
var id int64
err := a.pool.QueryRow(context.Background(), `
err := a.db.QueryRowContext(context.Background(), `
insert into songs (title, artist, genre, audio_file, duration_seconds, submitted_by)
values ($1, 'Testiartisti', 'Metal', 'x.ogg', 120, $2) returning id`,
title, submitter).Scan(&id)
@@ -21,7 +21,7 @@ func (a *app) seedSong(t *testing.T, submitter int64, title string) int64 {
func (a *app) seedReview(t *testing.T, songID, reviewerID int64, score int) int64 {
t.Helper()
var id int64
err := a.pool.QueryRow(context.Background(), `
err := a.db.QueryRowContext(context.Background(), `
insert into reviews (song_id, reviewer_id, score, text)
values ($1, $2, $3, 'sanat') returning id`, songID, reviewerID, score).Scan(&id)
if err != nil {
@@ -133,8 +133,8 @@ func TestQueueContents(t *testing.T) {
// Oldest first: a second unreviewed song comes after the first.
older := a.seedSong(t, bertta, "Vanhempi")
if _, err := a.pool.Exec(ctx,
`update songs set created_at = now() - interval '2 days' where id = $1`, older); err != nil {
if _, err := a.db.ExecContext(ctx,
`update songs set created_at = datetime('now', '-2 days') where id = $1`, older); err != nil {
t.Fatal(err)
}
list, err = a.queue(ctx, aino, 0)
@@ -165,7 +165,7 @@ func TestSongUnlocksWhenTheLastReviewGoes(t *testing.T) {
t.Fatal("a reviewed song is still editable")
}
if _, err := a.pool.Exec(ctx, `delete from reviews where id = $1`, reviewID); err != nil {
if _, err := a.db.ExecContext(ctx, `delete from reviews where id = $1`, reviewID); err != nil {
t.Fatal(err)
}
d, _ = a.song(ctx, aino, songID)
@@ -192,8 +192,8 @@ func TestEditWindow(t *testing.T) {
}
// Just inside the window.
if _, err := a.pool.Exec(ctx,
`update reviews set updated_at = now() - interval '29 minutes' where id = $1`,
if _, err := a.db.ExecContext(ctx,
`update reviews set updated_at = datetime('now', '-29 minutes') where id = $1`,
reviewID); err != nil {
t.Fatal(err)
}
@@ -203,8 +203,8 @@ func TestEditWindow(t *testing.T) {
}
// Past it.
if _, err := a.pool.Exec(ctx,
`update reviews set updated_at = now() - interval '31 minutes' where id = $1`,
if _, err := a.db.ExecContext(ctx,
`update reviews set updated_at = datetime('now', '-31 minutes') where id = $1`,
reviewID); err != nil {
t.Fatal(err)
}
@@ -215,17 +215,17 @@ func TestEditWindow(t *testing.T) {
// The database is the authority, not the Go clock: the update and the delete both refuse.
var n int64
err = a.pool.QueryRow(ctx, `
update reviews set score = 1, updated_at = now()
where id = $1 and reviewer_id = $2 and updated_at > now() - $3::interval
returning id`, reviewID, bertta, editWindow.String()).Scan(&n)
err = a.db.QueryRowContext(ctx, `
update reviews set score = 1, updated_at = datetime('now')
where id = $1 and reviewer_id = $2 and updated_at > datetime('now', $3)
returning id`, reviewID, bertta, editWindowAgo).Scan(&n)
if err == nil {
t.Fatal("an expired review was edited")
}
err = a.pool.QueryRow(ctx, `
err = a.db.QueryRowContext(ctx, `
delete from reviews
where id = $1 and reviewer_id = $2 and updated_at > now() - $3::interval
returning id`, reviewID, bertta, editWindow.String()).Scan(&n)
where id = $1 and reviewer_id = $2 and updated_at > datetime('now', $3)
returning id`, reviewID, bertta, editWindowAgo).Scan(&n)
if err == nil {
t.Fatal("an expired review was deleted")
}