fix(core): add controlled media usage activation - #2445
Conversation
…utomatic-reconciliation # Conflicts: # .changeset/safe-collection-deletion.md # packages/core/src/database/migrations/runner.ts # packages/core/src/database/repositories/media-usage.ts # packages/core/src/database/types.ts # packages/core/src/emdash-runtime.ts # packages/core/src/media/usage/collection-deletion-processor.ts # packages/core/src/media/usage/collection-deletion.ts # packages/core/tests/integration/database/media-usage-incremental-work-migration.test.ts # packages/core/tests/integration/database/migrations.test.ts # packages/core/tests/integration/runtime/media-usage-scheduled-driver.test.ts # packages/core/tests/workerd/media-usage-collection-deletion-d1.test.ts
🦋 Changeset detectedLatest commit: 733e0bb The changes in this PR will be included in the next version bump. This PR includes changesets to release 17 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Scope checkThis PR changes 1,113 lines across 16 files. Large PRs are harder to review and more likely to be closed without review. If this scope is intentional, no action needed. A maintainer will review it. If not, please consider splitting this into smaller PRs. See CONTRIBUTING.md for contribution guidelines. |
Overlapping PRsThis PR modifies files that are also changed by other open PRs:
This may cause merge conflicts or duplicated work. A maintainer will coordinate. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
docs | 733e0bb | Aug 27 2026, 10:13 AM |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-moderation
@emdash-cms/registry-verification
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
…roduction-activation
…roduction-activation
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://feature-media-usage-production-activation.try.emdashcms.com, https://feature-media-usage-production-activation-emdash-playground.emdash-cms.workers.dev (commit 733e0bb)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
What does this PR do?
Adds a deliberate, administrator-controlled way to turn on automatic Media Usage indexing after a production deployment is ready.
The indexing foundation stays dormant until an administrator explicitly starts activation. This PR provides that final safety gate:
schema:manage; bearer-token calls need theadminscope, session-based POSTs need CSRF protection, and every POST requires explicit confirmation that writers are stopped and background maintenance is ready;An
activeresult means that new content changes are being captured. Historical content continues to catch up through the bounded background reconciliation added by #2443.This is stacked directly on #2443 and should be reviewed relative to
feature/media-usage-automatic-reconciliation.Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runAI-generated code disclosure
Screenshots / test output
No visual changes.
Verified locally:
PostgreSQL and Durable Object SQL runtime tests were not available locally. Their shared code paths are typechecked, while the available SQLite and real D1/workerd tests cover the public activation contract and bounded request behavior.
Try this PR
Open a fresh playground →
A full working EmDash site, deployed from this branch. Each visit gets its own session-scoped sandbox: no login needed and no shared state. Try the admin, edit content, hit the public site.
Tracks
feature/media-usage-production-activation. Updated automatically when the playground redeploys.