Skip to content

feat: complete media usage tracking setup - #2538

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

feat: complete media usage tracking setup#2538
khoinguyenpham04 wants to merge 58 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?

Completes media usage tracking setup for new and existing sites.

  • The setup wizard selects tracking by default for new sites and lets administrators opt out before continuing.
  • Existing sites enable tracking from Settings → Media usage tracking after confirming that edits and other content updates are paused.
  • The visible settings page advances durable setup and indexing. Closing it pauses new requests; returning resumes from saved progress.
  • Each work claim handles up to 1,000 entries. Failures are isolated by collection, and projection memory is capped at 50,000 references or 16 MB before untouched work is released.
  • Cloudflare Queue, the dedicated media usage Cron, and Node scheduled recovery are removed. The unrelated general Cron remains unchanged.
  • Leases, retries, fencing, live-write safety, truthful coverage, collection deletion, Node support, and V1 compatibility remain intact.
  • Media Library and REST API documentation describe the current setup flow and result coverage.

This PR is stacked on #2472 and should be reviewed against 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 (or targeted tests for my 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). No messages.po changes are included.
  • I have added and reviewed the user-facing changeset (if this PR changes a published package)
  • New features link to an approved Discussion: not applicable; this completes the existing media usage tracking stack

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: OpenAI Codex (GPT-5.6)

Screenshots / test output

  • Focused Admin, Core, and workerd/D1 suites pass.
  • Core and Admin typechecks and builds pass, along with the documentation build.
  • Type-aware lint, formatting, locale compilation, and git diff --check pass.
  • Local browser verification covers the confirmation dialog, keyboard acknowledgement, setup, continuation, and Ready state.

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.

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: 5c4c0aa

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/admin Minor
@emdash-cms/cloudflare 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 5c4c0aa Aug 26 2026, 07:06 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 2378332 Aug 26 2026, 04:09 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 5c4c0aa Aug 26 2026, 07:06 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 changed the title fix: activate and automatically index Media Usage fix: activate and index Media Usage Aug 25, 2026
@khoinguyenpham04 khoinguyenpham04 added the bot:review Trigger an emdashbot code review on this PR label Aug 25, 2026
@emdashbot emdashbot Bot removed the bot:review Trigger an emdashbot code review on this PR label Aug 25, 2026
@khoinguyenpham04 khoinguyenpham04 added the bot:review Trigger an emdashbot code review on this PR label Aug 25, 2026
@emdashbot emdashbot Bot removed the bot:review Trigger an emdashbot code review on this PR label Aug 25, 2026

@ascorbic ascorbic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty close! I have a few specific issues in the code, and one overarching thing. A lot of the wording in here is treating this like it's a product, when it's really just a setting. Calling it "Media Usage" (with title case) is confusing. I think it should be referred to as "media usage tracking" or something like that.

Comment thread docs/src/content/docs/deployment/cloudflare.mdx Outdated
Comment thread docs/src/content/docs/deployment/cloudflare.mdx Outdated
Comment thread packages/admin/src/components/settings/MediaUsageSettings.tsx
Comment thread packages/core/src/media/usage/work-processor.ts Outdated
Comment thread packages/core/src/media/usage/content-refresh.ts Outdated
Comment thread docs/src/content/docs/deployment/nodejs.mdx Outdated
Comment thread docs/src/content/docs/guides/media-library.mdx Outdated
Comment thread packages/admin/src/components/settings/MediaUsageSettings.tsx Outdated
Comment thread packages/admin/src/components/settings/MediaUsageSettings.tsx Outdated
Comment thread .changeset/media-usage-activation-ui.md Outdated
@github-actions github-actions Bot added review/awaiting-author Reviewed; waiting on the author to respond and removed review/needs-rereview Author pushed changes since the last review labels Aug 25, 2026
@github-actions github-actions Bot added review/needs-rereview Author pushed changes since the last review and removed review/awaiting-author Reviewed; waiting on the author to respond labels Aug 25, 2026
@khoinguyenpham04 khoinguyenpham04 changed the title fix: activate and index Media Usage fix: complete media usage tracking setup Aug 26, 2026
@khoinguyenpham04 khoinguyenpham04 changed the title fix: complete media usage tracking setup feat: complete media usage tracking setup Aug 26, 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.

2 participants