Skip to content

docs(plugins): note that a missing hook capability fails silently - #4486

Merged
ascorbic merged 1 commit into
emdash-cms:mainfrom
justadityaraj:docs/hook-capability-silent-skip
Nov 4, 2026
Merged

ascorbic merged 1 commit into
emdash-cms:mainfrom
justadityaraj:docs/hook-capability-silent-skip

Conversation

@justadityaraj

Copy link
Copy Markdown

What does this PR do?

Documents what an author actually sees when a hook's required capability is missing from the manifest.

The capability table above says EmDash "registers them only when the manifest declares the matching capability", which is accurate but stops short of the consequence. In practice the plugin installs and activates normally, its other hooks keep running, and nothing appears in the admin interface. The only symptom is a handler that never fires, and the only signal is a console.warn from registerPluginHook in packages/core/src/plugins/hooks.ts. Manifest validation does not cross-check hooks against capabilities, so nothing catches it earlier.

I hit this while moving four WordPress sites onto EmDash: a declared hook was silently dropped and the warning was in the Worker log. We now test that every declared hook's capability is also declared. This aside points authors at the log before they start debugging the handler.

Adds a caution aside with the exact log line so it is greppable. No behavior change.

Type of change

  • Documentation

Your connection to this change

  • I use EmDash and ran into the problem this PR addresses

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)
  • I have added and reviewed the user-facing changeset (if this PR changes a published package)
  • New features link to their merged design PR
  • I have included screenshots below if this PR changes the UI

On the unchecked boxes, so a reviewer does not have to work out which apply:

  • typecheck and test filter to {./packages/**} and {./packages/*}, so neither covers docs/. I ran the gate that does: pnpm --filter docs build succeeds, 95 pages, and the aside renders on the built page.
  • oxlint --type-aware --deny-warnings docs/ is clean.
  • prettier --check on the changed file is clean.
  • No changeset: docs is private and listed in .changeset/config.json ignore.
  • No tests, no admin strings, no UI change, not a feature.

AI assistance disclosure

  • This PR includes AI-generated code or text — model/tool: Claude Opus 5 and Claude Fable 5.1, via Claude Code

The aside wording and this description were drafted with Claude Opus 5 and reviewed with Claude Fable 5.1. I hit the problem myself during the migrations, verified the behavior against main (the registerPluginHook path in hooks.ts, the absence of any cross-check in manifest-schema.ts, and the existing capability enforcement tests in packages/core/tests/unit/plugins/hooks.test.ts), reviewed the complete diff, and ran the docs build and linters before opening this.

Screenshots / test output

Not applicable — prose-only change to one page.

$ pnpm --filter docs build
[build] Server built in 7.92s
[build] Complete!
Generated Cloudflare deployment contains the docs Worker and static assets.

$ npx prettier --check docs/src/content/docs/plugins/creating-plugins/hooks.mdx
All matched files use Prettier code style!

$ npx oxlint --type-aware --deny-warnings docs/
(exit 0)

The capability table says EmDash registers a gated hook only when the
manifest declares the matching capability, but not what an author sees when
it does not. The plugin installs and activates normally, its other hooks
still run, and nothing appears in the admin interface, so the only symptom
is a handler that never fires. The sole signal is a console.warn from
registerPluginHook, and manifest validation does not cross-check hooks
against capabilities.

Hit this while moving four WordPress sites onto EmDash. Adds a caution aside
with the exact log line so it is greppable.

No behavior change.
@changeset-bot

changeset-bot Bot commented Oct 29, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 6816601

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The approach is right: a short caution aside under the capability table, documenting what authors see when a gated hook's capability is missing. Both reviewers approved with no findings. The documented warning text matches the implementation in HookPipeline.registerPluginHook, and only the gated hook is skipped. Neither reviewer found a manifest, install or admin-UI check that surfaces the problem earlier. The aside also follows the page's docs conventions. Neither reviewer ran builds, linters or tests.


Reviewed by anthropic/claude-opus-5-5 and openai/gpt-6.1-sol.

@justadityaraj

justadityaraj commented Oct 29, 2026 •

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA.

@justadityaraj

Copy link
Copy Markdown
Author

recheck

github-actions Bot added a commit that referenced this pull request Oct 29, 2026
@emdashbot emdashbot Bot added review/needs-review No maintainer or bot review yet and removed review/needs-review No maintainer or bot review yet labels Nov 4, 2026
@github-actions github-actions Bot added review/approved Approved; no new commits since and removed review/needs-review No maintainer or bot review yet labels Nov 4, 2026
@ascorbic
ascorbic enabled auto-merge (squash) November 4, 2026 10:44
@ascorbic
ascorbic merged commit 54cb8d6 into emdash-cms:main Nov 4, 2026
32 of 33 checks passed
@emdashbot

emdashbot Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for contributing to EmDash! 🎉

Join the EmDash Discord, then run /link to connect your GitHub account and claim the Contributor role.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants