Skip to content

feat(admin): allow trusted plugins to add content list columns - #2195

Merged
ascorbic merged 9 commits into
emdash-cms:mainfrom
logelog:feat/plugin-content-list-columns-v2
Aug 16, 2026
Merged

ascorbic merged 9 commits into
emdash-cms:mainfrom
logelog:feat/plugin-content-list-columns-v2

Conversation

@logelog

@logelog logelog commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds a focused, display-only content-list column extension for trusted React plugins.

Plugins can export typed contentListColumns definitions for computed metadata such as review statuses, moderation outcomes, or publication readiness. EmDash retains ownership of the table, pagination, row actions, loading states, and empty states while passing each cell the current content item, collection, and locale.

The resolver:

  • filters disabled or stale plugins
  • supports collection and minimum-role visibility
  • orders contributions deterministically
  • validates malformed and duplicate definitions
  • isolates failing predicates, headers, and cells so the content list remains usable
  • omits plugin columns from Trash

Sorting, filtering, and search remain outside this display-only contract because they require server-backed contracts. Search is covered by #2191, indexed sorting by #2212, and indexed filtering by #2213.

#2194 has merged and supplies the shared content-list layout. This branch is now based on main and contains only the trusted-plugin extension commits.

Approved Discussion: #2048

Wider content-list context: #2397

Closes: N/A

Type of change

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

Checklist

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: Claude Opus 5, GPT-5.6

Screenshots / test output

Local validation after rebasing:

  • focused admin browser tests: 2 files, 63 tests passed
  • admin production build
  • core and admin typechecks
  • full type-aware lint
  • full repository format check
  • git diff --check

No screenshot is included because the extension renders only when a trusted plugin contributes a column.

@changeset-bot

changeset-bot Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: de74ca6

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

This PR includes changesets to release 17 packages
Name Type
@emdash-cms/admin Minor
emdash 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 586 lines across 10 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.

@github-actions github-actions Bot added the review/needs-review No maintainer or bot review yet label Jul 22, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

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

@emdash-cms/auth

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

@emdash-cms/auth-atproto

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

@emdash-cms/blocks

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

@emdash-cms/cloudflare

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

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

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

emdash

npm i https://pkg.pr.new/emdash@2195

create-emdash

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

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

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

@emdash-cms/plugin-cli

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

@emdash-cms/plugin-types

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

@emdash-cms/registry-client

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

@emdash-cms/registry-lexicons

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

@emdash-cms/registry-verification

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

@emdash-cms/sandbox-workerd

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

@emdash-cms/x402

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

@emdash-cms/plugin-ai-moderation

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

@emdash-cms/plugin-atproto

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

@emdash-cms/plugin-audit-log

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

@emdash-cms/plugin-color

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

@emdash-cms/plugin-embeds

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

@emdash-cms/plugin-field-kit

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

@emdash-cms/plugin-forms

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

@emdash-cms/plugin-webhook-notifier

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

commit: de74ca6

@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.

This is a focused, well-scoped addition to the trusted-plugin admin surface. It solves the right problem (display-only content-list columns contributed by trusted React plugins) in the right way: EmDash keeps ownership of the table while plugins provide header/cell components;filtering, sorting, and search are deliberately left out because they need server-backed semantics. The change follows the same trusted-plugin model already used for pages, widgets, and field widgets, and it is backed by an approved Discussion (#2048).

I checked the new resolver, the boundary component, the ContentList integration, the router wiring, the test coverage, and the changeset. The logic is sound: disabled/stale plugins are omitted, role and collection filters work, malformed/duplicate definitions are isolated, and error boundaries keep a broken column from crashing the list. No logic bugs, security issues, regressions, or logged-out query-count impacts were found.

There are three AGENTS.md import-extension violations on changed/new lines: two new internal imports omit the required .js extension. Fixing those is the only blocker.

Comment thread packages/admin/src/index.ts Resolved
@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.

@github-actions github-actions Bot added review/awaiting-author Reviewed; waiting on the author to respond review/needs-rereview New commits since the last review and removed review/needs-review No maintainer or bot review yet review/awaiting-author Reviewed; waiting on the author to respond labels Jul 22, 2026
@logelog
logelog force-pushed the feat/plugin-content-list-columns-v2 branch from ee1f044 to 0a83f6d Compare July 22, 2026 22:57
@logelog
logelog force-pushed the feat/plugin-content-list-columns-v2 branch from 0a83f6d to 8825b20 Compare July 24, 2026 19:26
@logelog
logelog force-pushed the feat/plugin-content-list-columns-v2 branch from 8825b20 to ffe1365 Compare August 2, 2026 23:36
@logelog
logelog force-pushed the feat/plugin-content-list-columns-v2 branch from ffe1365 to 139939b Compare August 3, 2026 12:20
@github-actions github-actions Bot added review/awaiting-author Reviewed; waiting on the author to respond and removed review/needs-rereview New commits since the last review labels Aug 12, 2026
@logelog
logelog force-pushed the feat/plugin-content-list-columns-v2 branch from 86099f1 to acc1ed3 Compare August 12, 2026 12:51
@github-actions github-actions Bot added review/needs-rereview New commits since the last review and removed review/awaiting-author Reviewed; waiting on the author to respond labels Aug 12, 2026
@logelog
logelog force-pushed the feat/plugin-content-list-columns-v2 branch 2 times, most recently from 5760ef3 to 183cae3 Compare August 13, 2026 11:52
@ascorbic ascorbic added the bot:review Trigger an emdashbot code review on this PR label Aug 13, 2026

@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.

Re-review of the trusted-plugin content-list column extension. The overall approach remains sound: EmDash keeps ownership of the table, pagination, row actions, loading/empty states, and sort/filter/search contracts, while letting trusted React plugins contribute display-only columns through the existing manifest-driven plugin admin module. This fits the plugin architecture without leaking host responsibilities.

I re-read the full diff, the new resolver, the boundary component, the ContentList integration, the tests, the docs, and the changeset. The extension correctly filters disabled/stale plugins, applies role and collection visibility, validates malformed definitions, deduplicates per-plugin IDs, orders deterministically, keeps plugin columns out of Trash, and uses Lingui-wrapped strings with RTL-safe logical Tailwind.

One regression surfaced: the ContentListColumnBoundary key around each plugin cell includes item.updatedAt, which forces every plugin cell to unmount and remount whenever an item’s updatedAt changes (polls, mutations, autosaves, etc.). This contradicts the documented contract that “every cell component mounts once per visible row” and destroys local React state/effects inside trusted plugin cells. The boundary should key on stable row identity (collection, item locale, id, plugin, and column id) and reset its error state via lifecycle logic if data-change reset is truly needed.

No security issues, locale-filter misses, broken API-envelope contracts, or AGENTS.md convention violations were found outside the single issue above.

@emdashbot emdashbot Bot removed the bot:review Trigger an emdashbot code review on this PR label Aug 13, 2026
@logelog
logelog force-pushed the feat/plugin-content-list-columns-v2 branch 4 times, most recently from bc8cdd8 to cbe8815 Compare August 13, 2026 16:24
@logelog
logelog requested a review from ascorbic August 13, 2026 17:20
@logelog
logelog force-pushed the feat/plugin-content-list-columns-v2 branch from cbe8815 to 11c2f3a Compare August 13, 2026 20:39

@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.

Re-review of PR #2195 — trusted-plugin content-list columns.

The previous review flagged a concrete regression: the ContentListColumnBoundary around each plugin cell was keyed on item.updatedAt, which forced every trusted-plugin cell to unmount/remount on any row update (polls, autosaves, mutations) and destroyed local state/effects inside the plugin cell. That contradicted the documented contract that cells mount once per visible row.

That issue is fixed in this revision:

  • The cell boundary now keys on stable row identity: ${collection}:${item.locale}:${item.id}:${pluginId}:${extension.id}.
  • Data-driven retry is handled via a resetKey={item.updatedAt} prop and componentDidUpdate lifecycle logic inside ContentListColumnBoundary, which clears hasError only when the row actually changes.
  • A regression test (preserves contributed cell state when an existing row updates) asserts the cell does not remount when updatedAt changes, and a companion test verifies that error recovery still happens on row update.

I re-read the resolver in packages/admin/src/lib/content-list-columns.tsx, the ContentList integration, the router.tsx wiring, the virtual-module type update, the changeset, and the docs. The extension still filters disabled/stale plugins, applies collection and role visibility, validates malformed definitions, deduplicates per-plugin IDs, orders deterministically, keeps plugin columns out of Trash, and uses Lingui-wrapped strings with RTL-safe logical Tailwind.

No remaining blocking issues, AGENTS.md violations, or security/locale/API-envelope concerns were found. Approving.

@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.

This PR is the right change for the approved Discussion: it fits the existing trusted-plugin extension pattern, keeps EmDash in control of the table/pagination/actions, and is well scoped to display-only columns. The previous review's regression is fixed — the cell boundary now keys on stable row identity (collection:locale:id:pluginId:columnId) and uses a separate resetKey={item.updatedAt} for data-driven retry, so plugin cells mount once per visible row.

I re-read the resolver, the ContentList integration, the router wiring, the virtual-module type update, the changeset, and the tests. The implementation otherwise follows the conventions I checked: Lingui-wrapped strings, RTL-safe logical Tailwind (text-start/text-end), deterministic plugin ordering, manifest/role/collection filtering, Trash exclusion, and a changeset covering both touched packages. No logged-out routes are affected.

One new needs_fixing issue: the runtime validator for cell and header uses typeof === "function", which silently rejects valid React components created with React.forwardRef or React.memo. Those return objects at runtime, even though the TypeScript React.ComponentType type accepts them. This breaks the documented contract for plugin authors. The fix is to use React.isValidElementType (excluding strings) and add a regression test with a forwardRef cell/header.

With that validation fixed and a test added, this looks ready to approve.

@ascorbic ascorbic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@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 PR addresses the approved Discussion: it keeps EmDash in control of the content-list table, pagination, and row actions while letting trusted React plugins contribute display-only columns. The scope is focused, the resolver isolates misbehaving plugins, and the integration respects existing localization and RTL conventions.

I re-read the resolver, the ContentList integration, the router wiring, the virtual-module type update, the docs, the changeset, and the tests. The previously flagged regression is fixed: the component validator now accepts forwardRef and memo cells/headers (via $$typeof wrapper-type checks and a typeof === "function" fallback), and a regression test covers it. I also checked for the conventions in AGENTS.md: Lingui-wrapped strings, RTL-safe logical Tailwind, deterministic ordering, manifest/role/collection filtering, Trash exclusion, changeset coverage, and no logged-out route impact. No issues remain.

Approved.

@emdashbot emdashbot Bot mentioned this pull request Aug 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.

3 participants