Repository navigation
Tech-debt batch 3: tenant teardown, backend-mismatch guard, checksum reconciler (#583 #589 #590) - #605
Merged
Conversation
…s of deleted tenants Closes #583 Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
…no longer configured Closes #589 Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
…les missing checksums Closes #590 Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
…handlers inline Adds EventBus.publish_durable_or_inline; file_storage defers backend-object purge to on_commit when no transport is installed. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
Platform files keep serving publicly; tenant object purge skips non-active backends; inline mode tolerates sessions without on_commit. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
Checksum reconciliation only picks active-backend rows; public-file tenant checks are cached for 60 s and forgotten on TenantDeleted; tenant storage cleanup manifests are chunked. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
drop_object shares the backend-mismatch helper. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
Tenant-existence cache evicts across workers via a core TENANT_DELETED_CHANNEL published by tenants after commit; checksum reconciliation picks random candidates; tenant purge materializes rows before publishing, skips empty multipart ids, and warns when no bus is wired. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
Public files check the tenant registry only on multi-tenant installs (single-tenant fallback tenants have no row); a failed multipart abort during tenant cleanup is logged instead of wedging the manifest. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
Public-file tenant checks release the request connection first; tenant object cleanup retries when an abort or delete fails. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
Public-file tenant check releases the connection through the guarded _release_connection helper; publish_durable_or_inline skips a missing subscription instead of asserting. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
Deploying simple-module-python with
|
| Latest commit: |
f001def
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://bce6433a.simple-module-python.pages.dev |
| Branch Preview URL: | https://fix-debt-batch-3.simple-module-python.pages.dev |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TenantDeletedmoves tosimple_module_core.tenant_events(still re-exported fromtenants.contracts.events) and is published through the newEventBus.publish_durable_or_inline: durable via the outbox whenbackground_tasksis installed, inline in the deleting transaction otherwise. Durable handlers purge file_storage files/upload sessions (backend objects deleted after commit from chunked manifests; failed aborts/deletes are retried), api_tokens, sharing grants, feature-flag overrides and framework tenant-scoped settings (incl. branding). Audit history is kept. On multi-tenant installs, public files of a deleted tenant 404 at once: a 60 s per-worker existence cache, evicted on every worker byTENANT_DELETED_CHANNEL, which tenants publishes after commit. The request connection is released before the lookup. Platform files and single-tenant installs (fallback tenant, no registry row) are unaffected.enqueue_after_commitis documented as at-most-once. New hourlyfile_storage.reconcile_checksumsre-enqueues checksums for active-backend files left without one for 30 min, up to 500 random candidates per run.Accepted residual risk: without
background_tasks, backend-object deletion after commit is best-effort; a failure is logged with the keys, andfile_storage.reap_objectsremoves the orphans oncebackground_tasksruns (nothing is exposed: the rows are gone and public serving 404s). Seedocs/framework/multi-tenancy.md.Follow-up (not in scope): there is no admin UI or REST route that deletes a tenant;
TenantService.delete_tenantis a service API only.Verification
:8213) and a single-tenant (:8214) server; no 5xxmake lint,make test-py(5685 passed),make test-js(748 passed), full e2e suite (49 passed), Postgres run of tenants/file_storage/api_tokens/sharing/feature_flags/framework db+core (1675 passed)QA Report
test_tenants_teardown_integration.pyand the durable/inline deletion testsTest plan
TenantService.delete_tenant; its public file URL 404s, another tenant's stays 200, the branding logo still loadsCloses #583
Closes #589
Closes #590
https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4