Skip to content

[P2] Enforce data integrity and harden container startup - #113

Closed
apple050620312 wants to merge 1 commit into
Kyrela:mainfrom
apple050620312:p2-data-ops-resilience
Closed

apple050620312 wants to merge 1 commit into
Kyrela:mainfrom
apple050620312:p2-data-ops-resilience

Conversation

@apple050620312

Copy link
Copy Markdown
Contributor

Summary

  • Recover safely from find-or-create uniqueness races without masking unrelated database failures.
  • Add a migration that deduplicates existing rows and enforces unique member and custom-domain constraints.
  • Expand and index event names for operational queries.
  • Flush buffered analytics and close HTTP sessions during shutdown.
  • Generate runtime configuration safely, bound database startup waits, and make migrations explicit and fail-closed.
  • Keep the database private to the Compose network and add a one-shot migration service.

Priority

P2 — improves correctness, rollout safety, and recovery under concurrent multi-worker operation.

Validation

  • Migration imports successfully.
  • Compose migration topology and private database assertions pass.
  • Runtime imports and all Python AST parsing checks pass.

@Kyrela

Kyrela commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Recover safely from find-or-create uniqueness races without masking unrelated database failures.

The ORM is not async, and I closed #112, so it doesn't bring anything here.

Add a migration that deduplicates existing rows and enforces unique member and custom-domain constraints.

Yeah this one is obvious I should have done it from the start.

Expand and index event names for operational queries.

The "expand" part is wrong (and thus dangerous as it can fail), but same, I should have indexed it like this from the start

Flush buffered analytics and close HTTP sessions during shutdown.

Yeah I tought of this, but decided I didn't really care. But it's technically just an improvement, except, this has some problems like a fail-loop that blocks analytics entierely.

Generate runtime configuration safely

Not bad, but a bit overkill.

bound database startup waits

Useless as restart: unless-stopped is used.

make migrations explicit and fail-closed

fail-closed is good, but "explicit" (if it means making migrations opt-in) is obviously a bad idea, except for multi-instances work proposed in #112

Keep the database private to the Compose network

Yeah, that makes sense.

add a one-shot migration service

See above

Also, the migrations files were manually created and therefore don't have any id.

@Kyrela Kyrela closed this Oct 25, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants