Conversation
There was a problem hiding this comment.
Pull request overview
Adds end-to-end “delete realm/workspace” support, spanning host UI (workspace chooser action + destructive confirmation), realm-server endpoint implementation, and test coverage to validate both server-side deletion behavior and the host flow.
Changes:
- Added
DELETE /_delete-realmrealm-server endpoint and wired it into routing. - Introduced shared realm destruction utilities and refactored unpublish to use them.
- Added realm-server endpoint tests, host acceptance tests, and CI inclusion for the new test module.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/realm-server/tests/server-endpoints/delete-realm-test.ts | New endpoint coverage for deleting source realms, published copies, permissions, and domain-claim soft deletion. |
| packages/realm-server/tests/index.ts | Registers the new delete-realm endpoint test. |
| packages/realm-server/routes.ts | Adds DELETE /_delete-realm route with JWT middleware. |
| packages/realm-server/handlers/realm-destruction-utils.ts | New shared helper for deleting realm contents + unmounting. |
| packages/realm-server/handlers/handle-unpublish-realm.ts | Refactors published realm removal to use the new shared helper. |
| packages/realm-server/handlers/handle-delete-realm.ts | New handler implementing the server-side realm deletion flow. |
| packages/host/tests/helpers/realm-server-mock/routes.ts | Adds mock realm-server route for /_delete-realm used by host acceptance tests. |
| packages/host/tests/acceptance/workspace-chooser-delete-test.gts | Adds acceptance coverage for enabling/disabling delete and for the delete confirmation UI content. |
| packages/host/app/services/realm.ts | Adds removeRealm() to evict a realm resource locally after deletion. |
| packages/host/app/services/realm-server.ts | Adds deleteRealm() client method calling the new realm-server endpoint. |
| packages/host/app/services/matrix-service.ts | Adds helper to remove a realm URL from Matrix account data. |
| packages/host/app/components/operator-mode/workspace-chooser/workspace.gts | Adds workspace context menu + delete confirmation modal and deletion workflow. |
| packages/host/app/components/operator-mode/workspace-chooser/index.gts | Enables the workspace menu in the chooser list. |
| packages/host/app/components/operator-mode/delete-modal.gts | Makes delete modal content more flexible and adds size override support. |
| .github/workflows/ci.yaml | Ensures the new realm-server endpoint test is included in CI’s test-module list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/host/app/components/operator-mode/workspace-chooser/index.gts
Outdated
Show resolved
Hide resolved
Preview deployments |
Host Test Results 1 files ± 0 1 suites ±0 2h 36m 11s ⏱️ + 13m 10s For more details on these errors, see this check. Results for commit 804b4dc. ± Comparison against base commit 3665973. This pull request removes 1 and adds 16 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
|
I had no design for this so I vibed it. I'll show it to the design people and get feedback. In the meanwhile this is ready for review. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec5b945584
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| await this.realmServer.deleteRealm(this.args.realmURL); | ||
| await this.matrixService.removeRealmFromAccountData(this.args.realmURL); | ||
| this.recentFilesService.removeRecentFilesForRealmURL(this.args.realmURL); |
There was a problem hiding this comment.
Recover from matrix update failures after realm deletion
The delete flow performs deleteRealm first and only then updates Matrix account data, but all subsequent cleanup is inside the same try. If removeRealmFromAccountData fails (for example, a transient Matrix API error), the catch path skips local cleanup and leaves the just-deleted workspace in account data/recent UI state; a retry then hits _delete-realm with a 404 because the realm is already gone. This creates a hard-to-recover partial-failure state for end users.
Useful? React with 👍 / 👎.
| let isActiveWorkspace = | ||
| this.operatorModeStateService.realmURL === this.args.realmURL || | ||
| this.operatorModeStateService | ||
| .getOpenCardIds() | ||
| .some((cardId) => cardId.startsWith(this.args.realmURL)) || |
There was a problem hiding this comment.
Include published realm URLs in active-workspace detection
The active-workspace check only looks for the source realm URL, but deleting a workspace also deletes its published realms on the server. If a user currently has stack items or code paths under one of those published URLs, this condition stays false and the stacks are not cleared, leaving open references to resources that were just removed and causing follow-on load/edit failures.
Useful? React with 👍 / 👎.
|
are there any odd behaviors if you have an existing chat with AI that has artifacts from a deleted realm? |
|
@IanCal this is the PR that we can use for removing a realm for teh software factory so that realms become more disposable. probably a good next step is to make a command and skill for this (and prob refactor the menu logic here to call the command) |
| return response.body.data.id as string; | ||
| } | ||
|
|
||
| test('DELETE /_delete-realm removes a created realm, its published copies, and related domain claims', async function (assert) { |
There was a problem hiding this comment.
i think there is more cleanup. we should delete all items for the deleted realm in the realm_versions, boxel_index, boxel_working_index, and modules tables and add assertions our tests for that. Also probably we should delete any pending jobs in the jobs table that are tied to the deleted realm's concurrency group (indexing:<realm_url>)
There was a problem hiding this comment.
maybe also ask AI to think of any other tables that might need cleanup
There was a problem hiding this comment.
maybe a way to detect this is to dump the database and look for any mentions of the should-have-been-deleted realm name

Screen.Recording.2026-03-12.at.13.19.09.mov
Summary
Testing