Add DB-backed site configuration #47

Closed
opened 2026-05-22 09:25:56 -05:00 by erik · 2 comments
Owner

Goal

Persist site configuration in SQLite and expose a small manually testable read path without replacing the file-based template defaults.

Requirements

  • Add the smallest site configuration table needed for persisted site identity and homepage settings.
  • Add migration(s) using the existing migration foundation.
  • Add service logic to read persisted config with file/default fallback behavior.
  • Add one manually testable route or command that proves persisted config is read.
  • Keep the PR as a small vertical slice.

Acceptance criteria

  • Migration creates the persisted site configuration table from scratch.
  • Tests use isolated databases.
  • Persisted config can be read through a manually testable path.
  • File/default config still works when no DB config exists.
  • Relevant lint/test checks pass.

Dependencies

  • task-0dbd25d3
  • task-69937fe4
## Goal Persist site configuration in SQLite and expose a small manually testable read path without replacing the file-based template defaults. ## Requirements - Add the smallest site configuration table needed for persisted site identity and homepage settings. - Add migration(s) using the existing migration foundation. - Add service logic to read persisted config with file/default fallback behavior. - Add one manually testable route or command that proves persisted config is read. - Keep the PR as a small vertical slice. ## Acceptance criteria - [ ] Migration creates the persisted site configuration table from scratch. - [ ] Tests use isolated databases. - [ ] Persisted config can be read through a manually testable path. - [ ] File/default config still works when no DB config exists. - [ ] Relevant lint/test checks pass. ## Dependencies - task-0dbd25d3 - task-69937fe4
Author
Owner

Synced from todu comment by @todu on 2026-05-22T22:08:49.102Z

PR Review: Approved

PR: #62

Summary

Reviewed PR #62 at commit 1223eeb. The PR adds a small site_config migration, a DB-first/file-fallback site config reader, homepage and API metadata wiring for migrated runtime databases, isolated tests, and documentation for manually verifying persisted config reads.

Acceptance Criteria

  • Migration creates the persisted site configuration table from scratch.
  • Tests use isolated databases.
  • Persisted config can be read through a manually testable path.
  • File/default config still works when no DB config exists.
  • Relevant lint/test checks pass: make check, ./scripts/pre-pr.sh, and Forgejo CI passed.

Blocking Issues

None.

Warnings

None.

Verdict

Approved for merge after explicit human approval.

_Synced from todu comment by @todu on 2026-05-22T22:08:49.102Z_ ## PR Review: Approved PR: https://forge.caradoc.com/erik/slugkit/pulls/62 ### Summary Reviewed PR #62 at commit `1223eeb`. The PR adds a small `site_config` migration, a DB-first/file-fallback site config reader, homepage and API metadata wiring for migrated runtime databases, isolated tests, and documentation for manually verifying persisted config reads. ### Acceptance Criteria - [x] Migration creates the persisted site configuration table from scratch. - [x] Tests use isolated databases. - [x] Persisted config can be read through a manually testable path. - [x] File/default config still works when no DB config exists. - [x] Relevant lint/test checks pass: `make check`, `./scripts/pre-pr.sh`, and Forgejo CI passed. ### Blocking Issues None. ### Warnings None. ### Verdict Approved for merge after explicit human approval.
erik 2026-05-22 17:26:25 -05:00
Author
Owner

Synced from todu comment by @todu on 2026-05-22T22:23:36.242Z

Closing Summary

PR #62 merged: #62

Acceptance criteria evidence:

  • Migration creates the persisted site configuration table from scratch: met — template/site/src/db/migrations/003_site_config.sql creates site_config; migration tests apply template migrations from an empty database and assert the table exists.
  • Tests use isolated databases: met — config/app tests use :memory: SQLite databases with cleanup; migration tests use temporary directories/databases.
  • Persisted config can be read through a manually testable path: met — readSiteConfig() reads the site_config row; / and /api/v1/meta use DB-backed config when the runtime app is started with a migrated database; README documents manual verification.
  • File/default config still works when no DB config exists: met — readSiteConfig() returns src/config/site.ts defaults without a DB or without a persisted row; tests cover both fallback cases.
  • Relevant lint/test checks pass: met — make check, ./scripts/pre-pr.sh, PR review, and Forgejo CI passed.

Readiness: READY

_Synced from todu comment by @todu on 2026-05-22T22:23:36.242Z_ ## Closing Summary PR #62 merged: https://forge.caradoc.com/erik/slugkit/pulls/62 Acceptance criteria evidence: - Migration creates the persisted site configuration table from scratch: met — `template/site/src/db/migrations/003_site_config.sql` creates `site_config`; migration tests apply template migrations from an empty database and assert the table exists. - Tests use isolated databases: met — config/app tests use `:memory:` SQLite databases with cleanup; migration tests use temporary directories/databases. - Persisted config can be read through a manually testable path: met — `readSiteConfig()` reads the `site_config` row; `/` and `/api/v1/meta` use DB-backed config when the runtime app is started with a migrated database; README documents manual verification. - File/default config still works when no DB config exists: met — `readSiteConfig()` returns `src/config/site.ts` defaults without a DB or without a persisted row; tests cover both fallback cases. - Relevant lint/test checks pass: met — `make check`, `./scripts/pre-pr.sh`, PR review, and Forgejo CI passed. Readiness: READY
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
erik/slugkit#47
No description provided.