Repository navigation
Conversation
🦋 Changeset detectedLatest commit: c3bfba9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 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 |
Scope checkThis PR changes 1,912 lines across 29 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. |
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
@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-test
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-loader
@emdash-cms/registry-moderation
@emdash-cms/registry-verification
@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: |
Overlapping PRsThis PR modifies files that are also changed by other open PRs:
This may cause merge conflicts or duplicated work. A maintainer will coordinate. |
|
This PR has been inactive for 14 days. It will be closed automatically in 7 days if there is no further activity. If you're still working on this, please push an update or leave a comment. |
129448f to
08fca45
Compare
|
Rebased on upstream main ( Local test runs after rebase, on top of
Bumping out of stale-warning territory. |
b8f394c to
6704774
Compare
There was a problem hiding this comment.
This is the right fix for a real bug. Moving the content picker and MCP content_list to the server-side q search introduced in #1226 is the correct architecture, and the implementation fits EmDash's patterns. The picker now uses useInfiniteQuery with keepPreviousData to avoid flashing empty lists between keystrokes, and it correctly keeps the load-more button available while searching. The MCP tool exposes q and passes it through to the handler layer, reusing the same SQL-safe repository path as the REST route.
I checked the picker refactor, the MCP schema and tool wiring, the new MCP integration test, the underlying handleContentList/ContentRepository.findMany search implementation, and the current ContentList component. The four findings from the prior review are addressed: the three ContentList issues (trusting the server total in search mode, keeping the search input visible, and showing a "no results" state instead of the empty-collection prompt for zero-result searches) are already fixed on this branch, and this PR fixes the picker's load-more-during-search issue.
Headline conclusion: The PR is clean and ready to land after addressing two minor nits — an MCP schema inconsistency and a test organization issue. No blocking logic, security, or convention problems.
…h test Address review feedback on emdash-cms#752: - MCP `content_list` `q` now uses `.trim().min(1).max(200)`, matching the REST `contentListQuery` contract. It previously accepted empty/whitespace `q` and silently ignored it; it now rejects it, so the MCP and REST interfaces accept and reject the same inputs. - Move the `content_list` search test out of the unrelated "soft-delete visibility" describe into a dedicated "content_list search" block. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Merged current On the two red E2E checks from the previous run: they're the Local verification on the merged head: full |
…h test Address review feedback on emdash-cms#752: - MCP `content_list` `q` now uses `.trim().min(1).max(200)`, matching the REST `contentListQuery` contract. It previously accepted empty/whitespace `q` and silently ignored it; it now rejects it, so the MCP and REST interfaces accept and reject the same inputs. - Move the `content_list` search test out of the unrelated "soft-delete visibility" describe into a dedicated "content_list search" block. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
36e9e66 to
02e5c05
Compare
|
@ascorbic gentle ping on this one — it's been open since April and is in a ready state: rebased onto current main, CI fully green, both emdashbot review passes addressed (the second concluded "clean and ready to land after two nits", and those nits landed with regression tests). Zero unresolved threads. If you'd rather route it through the bot first, I can't apply |
There was a problem hiding this comment.
This is the right fix for a real bug. Moving ContentPickerModal and the MCP content_list tool onto the server-side ?q= search introduced in #1226 is the correct architecture for large collections, and the implementation follows EmDash’s existing patterns.
I checked the picker refactor, the MCP tool/schema wiring, the new MCP integration tests, the underlying handleContentList/ContentRepository search path, and the REST contentListQuery schema. The four ContentList issues from the prior review remain resolved on this branch, and the previous MCP schema inconsistency is now fixed: the MCP q shape matches the REST schema exactly (z.string().trim().min(1).max(200).optional()).
Headline conclusion: the PR is clean and nearly ready to land. There are a couple of remaining low-grade nits — one stale test-file header and an explanatory JSX comment that violates the comment-discipline convention — plus a minor UX inconsistency in the picker empty state. None of these are blockers.
Findings
-
[suggestion]
packages/admin/src/components/ContentPickerModal.tsx:203This JSX comment narrates the change rather than explaining non-obvious code. AGENTS.md says comments must not be PR/reviewer-facing narrative; the
hasNextPage &&condition already expresses that load-more stays available. Remove it.{hasNextPage && ( -
[suggestion]
packages/admin/src/components/ContentPickerModal.tsx:156The empty-state uses the raw
searchQueryto decide whether to show the search-specific prompt. BecausesearchParamfalls back toundefinedwhen the input is whitespace-only, a user typing only spaces sees "Try adjusting your search" even though the server is not actually filtering. Use the effective search term instead.{searchParam ? ( -
[suggestion]
packages/core/tests/integration/mcp/content-misc.test.ts:2The file header no longer matches the file contents: the new
content_list searchdescribe block is not listed. Update the docblock so future readers know this file covers thecontent_listqparameter./** * MCP content tools — coverage for the remaining tools and edges. * * Covers: * - content_duplicate * - content_permanent_delete * - content_translations + locale handling on create/get * - _rev optimistic concurrency (happy + race) * - Soft-delete visibility (content_get / content_list filtering) * - content_list search by `q` * - Edit-while-trashed * - Idempotency (publish twice, unpublish-on-draft, schedule + publish) */
|
All three findings from the fresh review pass are addressed in 12f892e:
Verified locally: lint clean, MCP suite 29/29, full admin browser suite 1363/1363. |
12f892e to
822fd3f
Compare
…h test Address review feedback on emdash-cms#752: - MCP `content_list` `q` now uses `.trim().min(1).max(200)`, matching the REST `contentListQuery` contract. It previously accepted empty/whitespace `q` and silently ignored it; it now rejects it, so the MCP and REST interfaces accept and reject the same inputs. - Move the `content_list` search test out of the unrelated "soft-delete visibility" describe into a dedicated "content_list search" block. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
822fd3f to
3b98339
Compare
The MCP `content_list` tool had no search, so an agent looking for an entry in a large collection had to page through all of it and filter the results itself. It now takes `q`, passed to `handleContentList` like the REST list's `?q=`, with the same schema (trimmed, 1-200 characters), so a blank `q` is rejected rather than listing everything. Co-Authored-By: Claude Opus 5.5 <[email protected]>
3b98339 to
c3bfba9
Compare
|
Rebased onto current |
There was a problem hiding this comment.
The approach is right. The PR is narrowed to the MCP half: content_list now accepts q and passes it to handleContentList, so MCP reuses the REST search path. Draft scoping is preserved and the MCP q schema matches the REST contract. The new integration tests cover both filtering and blank-q rejection. The earlier schema, test-grouping and header concerns are resolved, and the picker findings are out of scope for the narrowed diff. One issue remains, raised by only one reviewer: the new q description promises word-prefix matching more broadly than the implementation supports. The other reviewer did not raise it, but did not disagree with it either.
Reviewed by anthropic/claude-opus-5-5 and openai/gpt-6.1-sol.
| .optional() | ||
| .describe( | ||
| "Search the collection's title or name, slug, and searchable fields. Case-insensitive; collections with search enabled match word prefixes.", | ||
| ), |
There was a problem hiding this comment.
[needs fixing] The new tool description says collections with search enabled match word prefixes, but enabling search is not sufficient. canUseFtsForListFilter() in api/handlers/content.ts returns false on PostgreSQL, when the index is missing, or when it does not cover the display columns; those paths use substring matching instead. This description is exposed to MCP clients as the search contract, so agents can incorrectly assume prefix-only results on supported configurations. Qualify the prefix behavior, for example: “Case-insensitive substring search, or word-prefix matching when an eligible SQLite FTS5 index is available.” (Raised by openai/gpt-6.1-sol; anthropic/claude-opus-5-5 did not mention it.)
What does this PR do?
The MCP
content_listtool can't search. To find an entry in a large collection, an agent has to page through all of it and filter the results itself. The REST list (?q=, #1226) and the admin can both search on the server.This adds a
qparameter tocontent_list:handleContentList, so it runs the same search the REST list uses: title or name, slug, and searchable fields; word prefixes on collections with search enabled.contentListQuery.q(trimmed, 1–200 characters), so a blankqis rejected rather than quietly listing everything.Rebased and narrowed (2026-10-06). This branch was 884 commits behind
main. It used to also moveContentPickerModalto server-side search, butmainnow does that already (it landed with #1928), so that half is dropped. The old branch and its review history are in the earlier commits on this PR.Type of change
Checklist
pnpm typecheckpasses. Scope verified:tsgo --noEmitforpackages/core, after building its workspace dependencies. The repo-wide script was not run locally.pnpm lintpasses. Scope verified:oxlint --type-aware --deny-warningson the touched files.pnpm testpasses (or targeted tests for my change).tests/integration/mcp/content-misc.test.ts: 35/35.pnpm formathas been run (oxfmt on the touched files)AI-generated code disclosure
Screenshots / test output
Not applicable (no UI change).
There are two integration tests in
content-misc.test.ts:qfilters the list;qis an error, matching REST.Both fail with the
server.tschange reverted: the MCP SDK drops the unknownq, so test 1 gets every post back and test 2 gets no error.