Skip to content

Remove dropped ui_artifacts search columns - #94

Merged
kentcdodds merged 1 commit into
mainfrom
cursor/ui-artifacts-search-columns-d57f
Mar 29, 2026
Merged

kentcdodds merged 1 commit into
mainfrom
cursor/ui-artifacts-search-columns-d57f

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Mar 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • remove persisted keywords and search_text usage from ui_artifacts repository queries and row types
  • align saved app MCP capabilities and search embedding with the slimmer post-migration schema
  • update saved app fixtures and focused tests to use only fields that still exist after migration

Testing

  • npm run typecheck
  • npm run test -- packages/worker/src/app/saved-ui-hosted-html.node.test.ts packages/worker/src/mcp/tools/search.node.test.ts packages/worker/src/mcp/capabilities/unified-search.workers.test.ts packages/worker/src/mcp/skills/infer-codemode-capabilities.node.test.ts
  • npm run test:mcp -- packages/worker/src/mcp/mcp-server.mcp-e2e.test.ts -t "mcp server executes ui_save_app via execute tool|mcp server saves app, search returns app hit, and open_generated_ui supports app_id|mcp server supports parameterized saved apps with resolved runtime params|generated ui sessions support secret storage, execute-time resolution, and scoped search visibility|mcp server deletes saved ui app artifacts|mcp server updates saved ui app artifacts"
Open in Web Open in Cursor 

Summary by CodeRabbit

  • Refactor
    • Removed keywords metadata field from saved apps—apps no longer support keyword tagging during creation, update, or retrieval
    • Removed search text field from saved apps—this field is no longer available in API responses
    • Updated search functionality to work with the restructured metadata structure
    • All app endpoints (save, update, retrieve, list) updated to reflect these changes

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@coderabbitai

coderabbitai Bot commented Mar 29, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR removes keywords and search_text fields from the UI artifacts system across database persistence, type definitions, embedding logic, and MCP capability schemas. The artifact embed text construction is updated to use code instead of keywords.

Changes

Cohort / File(s) Summary
Type & Data Structure Definitions
packages/worker/src/mcp/ui-artifacts-types.ts
Removed keywords and search_text fields from UiArtifactRow type definition.
Database Repository & Persistence
packages/worker/src/mcp/ui-artifacts-repo.ts
Removed parseStringArray helper and updated all INSERT/SELECT/UPDATE queries to stop handling keywords and search_text columns; adjusted column lists across insertUiArtifact, getUiArtifactById, listUiArtifactsByUserId, and updateUiArtifact.
Embedding & Vector Logic
packages/worker/src/mcp/ui-artifacts-embed.ts, packages/worker/src/mcp/ui-artifacts-search.ts
Updated buildUiArtifactEmbedText to accept code instead of keywords and searchText; removed keywords and searchText from search hit DTO types.
MCP App Capability Schemas
packages/worker/src/mcp/capabilities/apps/ui-save-app.ts, packages/worker/src/mcp/capabilities/apps/ui-update-app.ts, packages/worker/src/mcp/capabilities/apps/ui-get-app.ts, packages/worker/src/mcp/capabilities/apps/ui-list-apps.ts
Removed keywords and search_text from input/output schemas and handler logic across save, update, get, and list app capabilities.
Test Fixtures & Assertions
packages/worker/src/app/saved-ui-hosted-html.node.test.ts, packages/worker/src/mcp/.../unified-search.workers.test.ts, packages/worker/src/mcp/mcp-server.mcp-e2e.test.ts, packages/worker/src/mcp/skills/infer-codemode-capabilities.node.test.ts, packages/worker/src/mcp/tools/search.node.test.ts
Updated test fixtures and payloads to remove keywords and search_text fields; adjusted expectations in end-to-end tests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #29: Introduces the UI artifact functions and types that are being modified by this field removal.
  • PR #64: Directly modifies the same ui-update-app capability and artifact repository layer affected here.
  • PR #50: Modifies the same saved-UI artifact persistence and type definitions being changed for field removal.

Poem

🐰 A rabbit hops through fields of code,
Tidying keywords from the road,
No search\_text in sight, hooray!
Embed with just the code today,
Cleaner schemas, lighter way! 🌿

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: removing dropped ui_artifacts search columns (keywords and search_text) from repository queries, capabilities, and tests.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/ui-artifacts-search-columns-d57f

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kentcdodds
kentcdodds changed the base branch from cursor/ui-artifacts-unused-columns-c9f5 to main March 29, 2026 20:38
@kentcdodds
kentcdodds marked this pull request as ready for review March 29, 2026 20:39
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Preview deployed: https://kody-pr-94.kentcdodds.workers.dev

Worker: kody-pr-94
D1: kody-pr-94-db
KV: kody-pr-94-oauth-kv

Mocks:

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/worker/src/mcp/mcp-server.mcp-e2e.test.ts (1)

921-921: Use a code-only token in this search regression.

This query still matches the title/description, so it would keep passing even if row.code stopped contributing to app search. A unique term that exists only inside code would make the post-migration behavior explicit.

📌 Suggested test tweak
-						code: '<main><h1>Saved Searchable App Demo</h1></main>',
+						code: '<main><h1>Saved Searchable App Demo</h1><p>saved-app-code-token</p></main>',
...
-			query: 'searchable saved ui artifact demo',
+			query: 'saved-app-code-token',

Also applies to: 938-939

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/worker/src/mcp/mcp-server.mcp-e2e.test.ts` at line 921, The test
inserts an app with code that currently contains the same text as the
title/description so the search still matches even if row.code stops
contributing; change the inserted object(s) where the code property is set
(refer to row.code in the failing test cases around the test in
mcp-server.mcp-e2e.test.ts) to include a unique, code-only token (e.g. a random
or clearly unique string) that does not appear in title/description, and update
the assertions to search for that unique token (also update the similar
occurrences noted around lines 938-939) so the test will only pass if row.code
is actually indexed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/worker/src/mcp/ui-artifacts-embed.ts`:
- Around line 38-47: The embed currently places raw source (input.code) before
structured metadata so slice(maxChars) can chop off runtime/parameterText;
update the construction in ui-artifacts-embed.ts so structured metadata
(input.title, input.description, input.runtime, 'mcp app', 'ui artifact',
parameterText) appear before the source, and then append input.code last (or
build structuredPart + codePart and, if truncated to maxChars, only trim the
codePart) so that runtime and parameterText are preserved in the final sliced
text; adjust variables text/structuredPart/codePart and the final return to
ensure parameterText and runtime are kept ahead of the code when enforcing
maxChars.

---

Nitpick comments:
In `@packages/worker/src/mcp/mcp-server.mcp-e2e.test.ts`:
- Line 921: The test inserts an app with code that currently contains the same
text as the title/description so the search still matches even if row.code stops
contributing; change the inserted object(s) where the code property is set
(refer to row.code in the failing test cases around the test in
mcp-server.mcp-e2e.test.ts) to include a unique, code-only token (e.g. a random
or clearly unique string) that does not appear in title/description, and update
the assertions to search for that unique token (also update the similar
occurrences noted around lines 938-939) so the test will only pass if row.code
is actually indexed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f3fc8f25-437b-4b05-b1b4-4ce8b12a328b

📥 Commits

Reviewing files that changed from the base of the PR and between f8221b0 and 7da3eff.

📒 Files selected for processing (13)
  • packages/worker/src/app/saved-ui-hosted-html.node.test.ts
  • packages/worker/src/mcp/capabilities/apps/ui-get-app.ts
  • packages/worker/src/mcp/capabilities/apps/ui-list-apps.ts
  • packages/worker/src/mcp/capabilities/apps/ui-save-app.ts
  • packages/worker/src/mcp/capabilities/apps/ui-update-app.ts
  • packages/worker/src/mcp/capabilities/unified-search.workers.test.ts
  • packages/worker/src/mcp/mcp-server.mcp-e2e.test.ts
  • packages/worker/src/mcp/skills/infer-codemode-capabilities.node.test.ts
  • packages/worker/src/mcp/tools/search.node.test.ts
  • packages/worker/src/mcp/ui-artifacts-embed.ts
  • packages/worker/src/mcp/ui-artifacts-repo.ts
  • packages/worker/src/mcp/ui-artifacts-search.ts
  • packages/worker/src/mcp/ui-artifacts-types.ts
💤 Files with no reviewable changes (3)
  • packages/worker/src/mcp/capabilities/unified-search.workers.test.ts
  • packages/worker/src/app/saved-ui-hosted-html.node.test.ts
  • packages/worker/src/mcp/ui-artifacts-types.ts

Comment on lines 38 to 47
const text = [
input.title,
input.description,
input.keywords.join(' '),
input.code,
input.runtime,
'mcp app',
'ui artifact',
...(parameterText ? [parameterText] : []),
...(input.searchText ? [input.searchText] : []),
].join('\n')
return text.slice(0, maxChars)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Keep structured app metadata ahead of raw source in the embed budget.

Line 41 now inserts the full code before runtime and parameterText, then Line 47 truncates the whole document. For larger saved apps, parameter names/descriptions get cut off entirely, so searches for things like a runtime param or default value stop finding the app even though that metadata still exists in the row.

✂️ Suggested fix
-	const text = [
-		input.title,
-		input.description,
-		input.code,
-		input.runtime,
-		'mcp app',
-		'ui artifact',
-		...(parameterText ? [parameterText] : []),
-	].join('\n')
-	return text.slice(0, maxChars)
+	const metadataText = [
+		input.title,
+		input.description,
+		input.runtime,
+		'mcp app',
+		'ui artifact',
+		...(parameterText ? [parameterText] : []),
+	].join('\n')
+	const remainingChars = Math.max(0, maxChars - metadataText.length - 1)
+	const codeText = input.code.slice(0, remainingChars)
+	return [metadataText, codeText].filter(Boolean).join('\n')
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const text = [
input.title,
input.description,
input.keywords.join(' '),
input.code,
input.runtime,
'mcp app',
'ui artifact',
...(parameterText ? [parameterText] : []),
...(input.searchText ? [input.searchText] : []),
].join('\n')
return text.slice(0, maxChars)
const metadataText = [
input.title,
input.description,
input.runtime,
'mcp app',
'ui artifact',
...(parameterText ? [parameterText] : []),
].join('\n')
const remainingChars = Math.max(0, maxChars - metadataText.length - 1)
const codeText = input.code.slice(0, remainingChars)
return [metadataText, codeText].filter(Boolean).join('\n')
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/worker/src/mcp/ui-artifacts-embed.ts` around lines 38 - 47, The
embed currently places raw source (input.code) before structured metadata so
slice(maxChars) can chop off runtime/parameterText; update the construction in
ui-artifacts-embed.ts so structured metadata (input.title, input.description,
input.runtime, 'mcp app', 'ui artifact', parameterText) appear before the
source, and then append input.code last (or build structuredPart + codePart and,
if truncated to maxChars, only trim the codePart) so that runtime and
parameterText are preserved in the final sliced text; adjust variables
text/structuredPart/codePart and the final return to ensure parameterText and
runtime are kept ahead of the code when enforcing maxChars.

@kentcdodds
kentcdodds merged commit fe3eb20 into main Mar 29, 2026
9 checks passed
@kentcdodds
kentcdodds deleted the cursor/ui-artifacts-search-columns-d57f branch March 29, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants