Skip to content

feat(plugin-test): add runtime-backed host - #3162

Merged
ascorbic merged 9 commits into
mainfrom
codex/runtime-plugin-test-host
Sep 16, 2026
Merged

ascorbic merged 9 commits into
mainfrom
codex/runtime-plugin-test-host

Conversation

@ascorbic

@ascorbic ascorbic commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Adds the runtime-backed testing foundation for sandboxed plugin capabilities.

@emdash-cms/plugin-test now exports createPluginRuntimeTestHost(). Its API separates direct sandbox transport, fixtures, production actions, observable-state inspectors, scheduled time control, cold restart, and disposal. It covers the shipped content lifecycle, plugin activation and deactivation, media upload, public comment submission and moderation, plugin-route policy, scheduled tasks, and captured email without adding planned plugin capabilities.

The existing createPluginTestHost() API remains compatible and is documented as a transport-level isolate harness. Generated plugin projects keep that fast Worker Loader test as their default; Node/workerd parity remains opt-in for plugin authors. The documented emdashPluginTest() configuration supplies the virtual runtime modules required by the runtime host.

Core route, comment, media, scheduler, and shutdown behavior is shared through production-owned boundaries so the runtime host does not copy business logic. The controlled scheduler clock applies to cron creation and recurrence as well as scheduled publishing, and each host run executes one production maintenance batch. Programmatic media uploads run both upload hook phases and preserve hook-transformed metadata.

The scheduler coverage also fixes ISO timestamps being misclassified as recurring schedules because the cron parser accepts them. ISO date-times, including timezone-less values, run once and are removed after a successful run.

Capability-specific helpers for schema discovery, translations, publication policy, Block Kit, binary HTTP, raw routes, taxonomies, redirects, expanded comment/media APIs, and encrypted settings remain with their owning capability PRs.

Type of change

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

This is a maintainer-directed testing-foundation PR; there is no separate Discussion URL.

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 (not applicable; no admin UI strings)
  • I have added and reviewed the user-facing changeset
  • New features link to an approved Discussion (not applicable; maintainer-directed testing foundation)
  • I have included screenshots below if this PR changes the UI (not applicable; no UI change)

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: GPT-5 Codex

Screenshots / test output

Not applicable; this PR does not change rendered UI.

Validated locally:

  • full repository build;
  • root typecheck;
  • type-aware lint with zero diagnostics;
  • 179 focused core route, comment, media, scheduler, and MCP tests;
  • 12 real Cloudflare Worker Loader runtime-host journeys using the documented configuration;
  • 13 production Node/workerd integration journeys;
  • 33 generated scaffold/template tests;
  • documentation build and reference inventory check; and
  • publint for emdash and @emdash-cms/plugin-test.

The local attw --pack invocation for emdash crashes inside attw with Cannot read properties of undefined (reading 'filename'). npm pack succeeds and includes the new plugin-test-runtime JavaScript and declaration entry points; CI remains authoritative for the package check.

@changeset-bot

changeset-bot Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f36b985

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

This PR includes changesets to release 13 packages
Name Type
@emdash-cms/plugin-test Minor
emdash Minor
@emdash-cms/cloudflare Minor
@emdash-cms/plugin-cli Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/admin Minor
@emdash-cms/auth Minor
@emdash-cms/blocks Minor
create-emdash Minor
@emdash-cms/gutenberg-to-portable-text Minor
@emdash-cms/x402 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 2,613 lines across 28 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.

@pkg-pr-new

pkg-pr-new Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/admin@3162

@emdash-cms/auth

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/auth@3162

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/auth-atproto@3162

@emdash-cms/blocks

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/blocks@3162

@emdash-cms/cloudflare

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/cloudflare@3162

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/contentful-to-portable-text@3162

emdash

npm i https://pkg.pr.new/emdash-cms/emdash@3162

create-emdash

npm i https://pkg.pr.new/emdash-cms/emdash/create-emdash@3162

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/gutenberg-to-portable-text@3162

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/plugin-cli@3162

@emdash-cms/plugin-test

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/plugin-test@3162

@emdash-cms/plugin-types

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/plugin-types@3162

@emdash-cms/registry-client

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/registry-client@3162

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/registry-lexicons@3162

@emdash-cms/registry-loader

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/registry-loader@3162

@emdash-cms/registry-moderation

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/registry-moderation@3162

@emdash-cms/registry-verification

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/registry-verification@3162

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/sandbox-workerd@3162

@emdash-cms/x402

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/x402@3162

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/plugin-ai-moderation@3162

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/plugin-atproto@3162

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/plugin-audit-log@3162

@emdash-cms/plugin-color

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/plugin-color@3162

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/plugin-embeds@3162

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/plugin-field-kit@3162

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/plugin-forms@3162

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/emdash-cms/emdash/@emdash-cms/plugin-webhook-notifier@3162

commit: f36b985

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://codex-runtime-plugin-test-host.try.emdashcms.com, https://codex-runtime-plugin-test-host-emdash-playground.emdash-cms.workers.dev (commit f36b985)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://8032b0d4.try.emdashcms.com, https://8032b0d4-emdash-playground.emdash-cms.workers.dev f36b985 2026-09-16T21:44:36.690Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://e260938b.try.emdashcms.com, https://e260938b-emdash-playground.emdash-cms.workers.dev 8029c08 2026-09-16T20:59:49.557Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://4c8e32e7.try.emdashcms.com, https://4c8e32e7-emdash-playground.emdash-cms.workers.dev bed36a8 2026-09-16T19:37:15.589Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://57a79b2c.try.emdashcms.com, https://57a79b2c-emdash-playground.emdash-cms.workers.dev 4779dbc 2026-09-16T19:03:24.350Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://f23e063e.try.emdashcms.com, https://f23e063e-emdash-playground.emdash-cms.workers.dev 792e26b 2026-09-16T18:59:02.111Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://e0d2b47b.try.emdashcms.com, https://e0d2b47b-emdash-playground.emdash-cms.workers.dev 57bde2c 2026-09-16T18:11:19.347Z Visit the dashboard ↗
  • Build: In progress 🔵

View logs ↗
4111a18 2026-09-16T18:06:17.254Z View logs ↗

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 16, 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 8029c08 Sep 16 2026, 08:58 PM

@github-actions

Copy link
Copy Markdown
Contributor

Overlapping PRs

This PR modifies files that are also changed by other open PRs:

This may cause merge conflicts or duplicated work. A maintainer will coordinate.

@ascorbic
ascorbic merged commit a4af578 into main Sep 16, 2026
87 of 88 checks passed
@ascorbic
ascorbic deleted the codex/runtime-plugin-test-host branch September 16, 2026 22:10
@emdashbot emdashbot Bot mentioned this pull request Sep 16, 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