Skip to content

fix: activate and automatically index Media Usage - #2538

Open
khoinguyenpham04 wants to merge 27 commits into
chore/media-usage-dev-seed-readinessfrom
feature/media-usage-activation-and-indexing
Open

fix: activate and automatically index Media Usage#2538
khoinguyenpham04 wants to merge 27 commits into
chore/media-usage-dev-seed-readinessfrom
feature/media-usage-activation-and-indexing

Conversation

@khoinguyenpham04

@khoinguyenpham04 khoinguyenpham04 commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds an administrator-controlled Media Usage setup flow and automatically indexes existing content in the background.

This draft:

  • adds an Admin-only Settings → Media Usage page and a compact Media Library setup notice;
  • enables Media Usage from one button and one confirmation dialog, then continues activation on the server if the browser closes;
  • shows truthful setup, indexing, completion, and failure states without changing V1 Media Usage responses;
  • processes durable entry work in bulk, with up to 1,000 entries in each entry-work batch;
  • skips idle maintenance classes while preserving leases, retries, stale-worker fencing, collection-deletion safety, and truthful coverage;
  • uses identity-free Cloudflare Queue messages to wake and continue sequential work, with concurrency set to one and Cron retained for recovery;
  • runs the same continuation-capable maintenance engine through the Node scheduler;
  • updates Cloudflare templates, deployment guidance, generated binding types, tests, and changesets.

The activation request never indexes the full site. Durable database work rows remain authoritative across interruption, retries, and duplicate Queue delivery.

This PR is stacked directly on #2472 and should be reviewed relative to chore/media-usage-dev-seed-readiness.

No linked issue.

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (targeted tests for this change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable). The focused English catalog update fixes the production fallback; unrelated generated catalogs are unchanged.
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion: not applicable; this completes and accelerates the existing Media Usage system

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: OpenAI Codex (GPT-5.6), with GPT-5.6 Terra adversarial review

Screenshots / test output

The CI preview can be used to review the responsive setup page, Media Library notice, activation states, and indexing progress.

Verified on the combined tip 3b485c00:

  • 526 tracked Node Media Usage tests passed, with 2 skipped;
  • 14 workerd/D1 tests, 18 Cloudflare scheduler tests, and 25 admin tests passed;
  • relevant typechecks, package builds, the documentation build, lint, formatting, and diff checks passed;
  • the retained 10,000-entry benchmark preserved exact correctness at 576 SQL queries without a meaningful throughput regression;
  • final adversarial review reported no findings.

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-activation-and-indexing. Updated automatically when the playground redeploys.

@changeset-bot

changeset-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e66bba6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
emdash Minor
@emdash-cms/cloudflare Minor
@emdash-cms/admin Minor
@emdash-cms/sandbox-workerd Patch
@emdash-cms/plugin-mcp-smoke Major
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/do-demo-site Patch
@emdash-cms/do-solo-demo-site Patch
@emdash-cms/auth Minor
@emdash-cms/blocks Minor
@emdash-cms/gutenberg-to-portable-text Minor
@emdash-cms/x402 Minor
create-emdash Minor
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

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

@github-actions

Copy link
Copy Markdown
Contributor

Scope check

This PR changes 3,521 lines across 63 files. Large PRs are harder to review and more likely to be closed without review.
This PR spans 5 different areas (area/core, area/admin, area/docs, area/templates, area/cloudflare). Consider breaking it into smaller, focused PRs.

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.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-demo-do e66bba6 Aug 20 2026, 10:13 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-playground 1fcbc86 Aug 18 2026, 10:43 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
docs ccecc1e Aug 20 2026, 09:59 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-demo-cache e66bba6 Aug 20 2026, 10:15 PM

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
packages/admin/src/locales/en/messages.po Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@khoinguyenpham04
khoinguyenpham04 marked this pull request as ready for review August 20, 2026 14:44
@github-actions github-actions Bot added the review/needs-review No maintainer or bot review yet label Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant