New monthly database partitions stop being created after a server's first start-up; item writes would eventually fail

Aperta
#218 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
postgresql, python
Ambito
backend, databases

Direzione di ricerca

Start with the partition creation logic in app/src/lib/db/migrate.ts around line 1842 and decision record 0012, then trace how the pipeline runs scheduled work. Add a frozen-clock test that checks the next month's partition after the last pre-created month; done when that test passes and decision record 0012 describes the actual behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug ready

Found in the 2026-11-29 whole-repo review. The once-only flag is verified; the consequence was traced by a reviewer and should be confirmed with a test.

Problem

Two tables are split into one partition per month (the catalog change log item_events and audit_log). The code that creates upcoming partitions lives in the start-up migration routine, which is guarded by let migrated = false; ... if (migrated) return; (app/src/lib/db/migrate.ts ~line 1842). So it runs once per server process. Decision record 0012 assumes it runs on any request. The pipeline never creates partitions and there is no catch-all partition.

How it goes wrong

A server that stays up for a few months without a redeploy runs out of partitions. The trigger that records catalog changes then fails, which aborts every item write; audit inserts fail silently.

Suggested fix

Create partitions on a schedule (a pipeline timer or a scheduled job), separate from the once-only migrations. Add a catch-all partition as a safety net and alert if it ever receives rows.

Acceptance criteria

  • Test with a frozen clock: after the process has been up past the last pre-created month, the next month's partition exists
  • Decision record 0012 matches the behaviour
Lingua principale
Python
Stelle
0
Fork
2
Merge medio
8h 26m
PR unite (30g)
47

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TechTraverse/stac-higher

Tutte le issue di TechTraverse/stac-higher

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.