Run migrations before starting workers and the backup scheduler #87
Labels
No labels
bug
duplicate
enhancement
future
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rbrooks/TeaLeaves#87
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: Medium · Confidence: High · Effort: XS · Category: ops
Evidence
api/src/index.ts:17-27- workers +startBackupScheduler()called beforeawait runMigrations()at :29; the.catchat :27 swallows errors.api/src/services/backup.ts:461-468-startBackupSchedulerqueriesbackup_destinationsat startup.Problem
On a first-ever boot the schema isn't applied yet, so
startBackupSchedulerqueries a non-existent table; the error is swallowed and the schedule silently never registers until a later restart. More generally, workers begin consuming jobs against a possibly-unmigrated schema.Impact
Backup scheduling silently disabled on fresh installs; latent races on deploys that add columns.
Fix
await runMigrations()first, then start workers and schedulers.Acceptance criteria
Related: F-08 (shutdown).
Filed from the 2026-07-15 codebase audit. Full report:
docs/.internal/report-2026-07-15.md(gitignored).Fixed in
b640072(v7.1.0 wave 3).api/src/index.tsboot order is now migrate → workers → scheduler → listen.await runMigrations()moved above everystartX()call andstartBackupScheduler(), so the schema is guaranteed to exist before the scheduler queriesbackup_destinationsand before any worker consumes a job against a possibly-unmigrated schema.Acceptance criteria:
Verified on the dev server: API boots clean, no errors,
/health→{"status":"ok"}. CI green (234/234 tests).Related: #85 (graceful shutdown) landed in the same commit and reworked the same file.