fix(admin): wire handleContentAuthors onto locals.emdash so the author filter stops 500ing (#1462)#1543
Conversation
…r filter stops 500ing
GET /_emdash/api/content/{collection}/authors reads emdash.handleContentAuthors, but the middleware that assembles the per-request locals.emdash object never included it — so it was undefined on every request and the route returned 500 NOT_CONFIGURED ("EmDash is not initialized") for every collection, while sibling content routes worked. The runtime method, standalone handler, type, and route all existed; only this one wiring line was missing.
Closes emdash-cms#1462
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: dc5b38d The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 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 |
@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/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: |
…ing (emdash-cms#1462) The middleware-prerender stub runtime listed every content handler except handleContentAuthors, so once the middleware binds it the stub's missing method makes `.bind` throw and `locals.emdash` never builds — failing the "prerendered public runtime routes" test. Add the method to the stub (matching the real runtime) and assert handleContentAuthors is wired, so the emdash-cms#1462 regression is guarded directly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Follow-up commit
Fix: add |
What does this PR do?
Fixes the admin author filter returning HTTP 500
NOT_CONFIGURED("EmDash is not initialized") onGET /_emdash/api/content/{collection}/authors, for every collection.locals.emdashis assembled as an object literal inmiddleware.ts. It wires every content handler — list, get, create, update, delete, all trash handlers, duplicate, publish, schedule, compare, translations, media, revisions — buthandleContentAuthorswas never added. Solocals.emdash.handleContentAuthorsisundefinedon every request, and the route's guard returns 500 before the handler runs — which is exactly why it's consistent, affects every collection, and logs no error. The runtime method (emdash-runtime.ts), the standalone handler (api/handlers/content.ts), theEmDashHandlerstype member, and the route itself all already exist — only this one wiring line was missing (it was overlooked when the author filter shipped in #1442).Closes #1462
Type of change
Checklist
pnpm typecheckpasses — not run cleanly locally: branching offmainleft the installed workspace deps (@emdash-cms/plugin-types) out of sync, producing unrelated pre-existing errors. This change adds one property to an existing object literal and is type-safe —runtime.handleContentAuthorsexists and matches theEmDashHandlersmember signature.pnpm lintpasses (oxlint, 0 errors)pnpm formathas been run (oxfmt clean)handleContentAuthorshandler itself is already covered bytests/integration/content/content-list-filters.test.ts; the omission was in the inlinelocals.emdashassembly, which is only observable through a full middleware boot.AI-generated code disclosure
Notes
Why this slipped past CI:
EmDashHandlersdeclareshandleContentAuthorsas required, yet the assembled object literal omitted it without a typecheck error — solocals.emdash's declared type is looser than the interface. A worthwhile follow-up (kept out of this PR to stay surgical) is to assemblelocals.emdashthrough a typed() => EmDashHandlersfactory orsatisfies EmDashHandlers, so a missing handler failspnpm typecheck— preventing the whole class of "added a handler + route but forgot to wire it ontolocals.emdash" bug.Full root-cause walkthrough in #1462.