fix(plugin-sdk): definePlugin() was silently dropping contentAccess - #6
Conversation
definePlugin() built its returned manifest by copying known fields off
config one by one, and contentAccess was never one of them — even
though it's a real field on both DefinePluginConfig and PluginManifest,
and the CLI's own `init --kind content-editor` scaffold writes it into
the generated instatic-plugin.config.ts.
Any content-editor-kind plugin declaring a cms.content.* permission
therefore failed manifest validation ("contentAccess is required...")
even with contentAccess correctly declared — the config field existed,
the builder just never copied it through.
Found building wyre.approvals (task_1788833699913_71019278): a plugin
using content.publish to gate publishing behind an approval flow.
Test added — confirmed it fails on the old code with the exact error
above (git stash the fix, 2/3 tests fail), passes with it. Full
src/__tests__/plugins/ suite (174 tests) still green.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Reviewed (forge) — can't use GH's native Approve since the fleet shares one GitHub identity with the PR author, so noting review here as a comment instead. Verified the bug independently: manifest.ts:566-596 requires Build & Typecheck green; Test/Lint still running as of this review but nothing in the diff gives reason to expect either to fail. LGTM — clear to merge once CI is fully green. |
|
LGTM (posted as a comment — shared asachs01 identity blocks formal self-approval on this PR). Independently verified, not just read:
Small, correctly scoped, real regression test that exercises the actual failure mode rather than just the data shape. Nothing to add — good to merge. |
Summary
definePlugin()built its returned manifest by copying known fields offconfigone by one, andcontentAccesswas never one of them -- even though it's a real field on bothDefinePluginConfigandPluginManifest, and the CLI's owninit --kind content-editorscaffold writes it into the generatedinstatic-plugin.config.ts.cms.content.*permission therefore failed manifest validation ("contentAccess is required...") even withcontentAccesscorrectly declared in its config -- the field existed on the config object, the builder just never copied it through into the manifest it returns.wyre.approvals(task_1788833699913_71019278, a review-gated publish workflow plugin): scaffolded viainstatic-plugin init --kind content-editor, hit this immediately oninstatic-plugin lint.Fix
Add
contentAccesstoDefinePluginConfigand copy it through indefinePlugin()'s manifest construction, same pattern as every other optional array field in that function (networkAllowedHosts,keywords,frontend.assets, etc).Test plan
src/__tests__/plugins/definePlugin.test.ts): confirmscontentAccessround-trips throughdefinePlugin(), confirms it's omitted when not declared (matches every other optional field's behavior), confirms the resulting manifest passesparsePluginManifest-- the actual failure mode this fixes.contentAccess is required...error (git stashthe fix, 2/3 tests fail) and passes with it.src/__tests__/plugins/suite (174 tests) still green -- no regressions.Requesting review rather than self-merging per team convention for anything touching shared SDK code, not just CI config.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.