Skip to content

Persist tenant deletion and recover startup safely - #7

Merged
theboringhumane merged 4 commits into
mainfrom
fix/tenant-deprovision-lifecycle
Oct 10, 2026
Merged

theboringhumane merged 4 commits into
mainfrom
fix/tenant-deprovision-lifecycle

Conversation

@theboringhumane

Copy link
Copy Markdown
Contributor

Deleting a tenant left its PostgreSQL record behind, so the next startup tried to restore ClickHouse access for a deleted user and failed. Persist deletion intent and key revocation before removing access, retain inactive history, and reconcile interrupted cleanup during startup.

Tenant lifecycle changes now use a PostgreSQL advisory lock across instances. Provisioning reserves a unique database username and records confirmed creation before grants; ambiguous creation stops for operator review. A maintenance command repairs reviewed legacy deletions from a protected exact tenant allowlist without inferring ownership from revoked keys.

Validation: mandatory CI adds real PostgreSQL and ClickHouse lifecycle, restart, reprovisioning, migration replay, collision, locking and recovery checks. Unit tests cover failed boundaries and allowlist validation. Local work was limited to source review and formatting; runtime recovery and restart qualification remain pending. Authentication caches can retain a valid key for up to 60 seconds.

Refs #6. Keep this issue open until the rebuilt image passes recovery and restart acceptance.

Signed-off-by: theboringhumane <me@iamharsh.dev>
Signed-off-by: theboringhumane <me@iamharsh.dev>
Signed-off-by: theboringhumane <me@iamharsh.dev>
Signed-off-by: theboringhumane <me@iamharsh.dev>
@theboringhumane
theboringhumane marked this pull request as ready for review October 10, 2026 11:55
@theboringhumane
theboringhumane merged commit a8fe648 into main Oct 10, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant