Skip to content

fix: Fix MCP output parsing to conform to new output schema format for service actions#706

Merged
kingston merged 3 commits into
mainfrom
kingston/eng-936-mcp-server-is-currently-failing
Dec 19, 2025
Merged

fix: Fix MCP output parsing to conform to new output schema format for service actions#706
kingston merged 3 commits into
mainfrom
kingston/eng-936-mcp-server-is-currently-failing

Conversation

@kingston

@kingston kingston commented Dec 19, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added a console logger test helper for tests and a test runtime helper for worker-script initialization.
  • Bug Fixes

    • Fixed service action output parsing to match the new output schema.
  • Tests

    • Added integration test for the discover-generators tool.
    • Extended test logging utilities with additional log-level outputs.
  • Chores

    • Updated workspace config and added a development dependency.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel

vercel Bot commented Dec 19, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
baseplate-project-builder-web Ready Ready Preview, Comment Dec 19, 2025 2:49pm

@changeset-bot

changeset-bot Bot commented Dec 19, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d6f1830

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

This PR includes changesets to release 18 packages
Name Type
@baseplate-dev/sync Patch
@baseplate-dev/project-builder-server Patch
@baseplate-dev/core-generators Patch
@baseplate-dev/fastify-generators Patch
@baseplate-dev/project-builder-common Patch
@baseplate-dev/project-builder-lib Patch
@baseplate-dev/project-builder-test Patch
@baseplate-dev/react-generators Patch
@baseplate-dev/plugin-auth Patch
@baseplate-dev/plugin-queue Patch
@baseplate-dev/plugin-storage Patch
@baseplate-dev/project-builder-cli Patch
@baseplate-dev/project-builder-web Patch
@baseplate-dev/create-project Patch
@baseplate-dev/code-morph Patch
@baseplate-dev/tools Patch
@baseplate-dev/ui-components Patch
@baseplate-dev/utils 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

@coderabbitai

coderabbitai Bot commented Dec 19, 2025

Copy link
Copy Markdown

Walkthrough

Adds test helpers and logging utilities, a TSX-based test worker loader, conditional worker script selection, a schema-parse simplification, MCP server integration test, changeset entries, and small workspace/package configuration updates.

Changes

Cohort / File(s) Summary
Changesets
\.changeset/five-poems-enjoy.md, \.changeset/soft-pets-swim.md
New changeset entries documenting patch releases: one for @baseplate-dev/sync (console logger test helper) and one for @baseplate-dev/project-builder-server (MCP output parsing fix).
Sync test logger
packages/sync/src/tests/logger.test-utils.ts
Refactors test logger: adds LogLevel import, exposes getWarnOutput() and getInfoOutput(), extracts formatMessage(), introduces LOG_LEVEL_ORDER & shouldLog() helpers, and exports createConsoleLogger(minLevel: LogLevel = 'debug').
Project-builder-server: worker helpers
packages/project-builder-server/src/actions/utils/worker-script.test-helper.ts, packages/project-builder-server/src/actions/utils/run-in-worker.ts
New worker-script.test-helper.ts that registers TSX runtime and dynamically imports worker-script.js; run-in-worker.ts now selects a test helper script when NODE_ENV=test and logs action start.
Project-builder-server: worker script change
packages/project-builder-server/src/actions/utils/worker-script.ts
Removes Zod wrapper usage; validates outputs by calling action.outputSchema.parse(result) directly.
Integration test
packages/project-builder-server/src/dev-server/mcp/mcp-server.int.test.ts
Adds integration test for MCP server discover-generators tool using a mock ServiceActionContext and in-memory transport, asserting structured generator results.
Package & workspace config
packages/project-builder-server/package.json, pnpm-workspace.yaml, knip.config.js
Adds tsx devDependency to project-builder-server; reorders/updates pnpm workspace keys (adds minimumReleaseAge); adds packages/project-builder-server workspace entry to knip.config.js.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Pay attention to:
    • packages/sync/src/tests/logger.test-utils.ts — verify log level gating and exported API surface.
    • run-in-worker.ts & worker-script.test-helper.ts — confirm test vs prod path selection, ESM/TSX runtime registration, and worker import behavior.
    • worker-script.ts — ensure direct action.outputSchema.parse(result) preserves intended validation semantics.
    • mcp-server.int.test.ts — validate test assumptions, mock context, and transport setup.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ 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 'fix: Fix MCP output parsing to conform to new output schema format for service actions' directly summarizes the main change—updating MCP output parsing logic in worker-script.ts to remove Zod wrapping and conform to the new schema format, which is the core objective of this PR.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kingston/eng-936-mcp-server-is-currently-failing

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a40559c and d6f1830.

📒 Files selected for processing (1)
  • knip.config.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)

**/*.{ts,tsx,js}: Node 16 module resolution - include file extensions in imports (.js)
Sort imports by group: external libs first, then local imports
Use camelCase for variables/functions, PascalCase for types/classes
Order functions such that functions are placed below the variables/functions they use
Prefer using nullish coalescing operator (??) instead of logical or (||), enforced via ESLint rule
Prefer barrel exports e.g. export * from './foo.js' instead of individual named exports
Use console.info/warn/error instead of console.log

Files:

  • knip.config.js
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Extract repeated logic into helper functions to reduce duplication
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Test broad behavior and common edge cases intelligently to avoid slowing down CI with excessive tests
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.test-helper.{ts,tsx} : Extract common setup code into test helpers in `*.test-helper.ts` files
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-06-30T11:52:28.745Z
Learning: Applies to src/tests/**/*.{ts,tsx} : Test helpers are located in `src/tests/` directory
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to src/tests/**/*.{ts,tsx} : Test helpers are located in `src/tests/` directory
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Leverage TypeScript for type-safe mocking in tests
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/todo-with-auth0/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:46.506Z
Learning: Applies to examples/todo-with-auth0/**/*.{unit,int}.test.ts : Import test functions explicitly from 'vitest' instead of using globals. Example: `import { describe, expect, it } from 'vitest';`
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Structure tests with Arrange-Act-Assert: clear setup, execution, and verification phases
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.int.test.{ts,tsx} : Integration tests use `.int.test.ts` suffix
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-06-30T11:52:28.745Z
Learning: Applies to **/*.int.test.{ts,tsx} : Integration tests use `.int.test.ts` suffix
📚 Learning: 2025-11-24T19:45:01.582Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/code-style.mdc:0-0
Timestamp: 2025-11-24T19:45:01.582Z
Learning: Applies to **/*.{ts,tsx} : Include absolute paths in import statements via tsconfig paths (`src/` is the alias for `src/`)

Applied to files:

  • knip.config.js
📚 Learning: 2025-06-03T09:11:29.651Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 562
File: plugins/plugin-auth/package.json:32-36
Timestamp: 2025-06-03T09:11:29.651Z
Learning: With TypeScript project references, TypeScript compilation is watched from the root level using "watch:tsc:root" script, so individual packages no longer need to include their "tsc:watch" scripts in their local "watch" commands. The local "tsc:watch" scripts are renamed from "watch:tsc" but are not meant to be run as part of the package's watch command since TypeScript watching is handled centrally at the workspace root.

Applied to files:

  • knip.config.js
📚 Learning: 2025-08-17T01:32:58.983Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 633
File: packages/project-builder-web/src/routes/admin-sections.$appKey/-components/columns/column-configs.ts:1-2
Timestamp: 2025-08-17T01:32:58.983Z
Learning: The project-builder-web package doesn't use ESM (ECMAScript modules), so .js extensions are not required in import statements, unlike other packages in the codebase that do use Node 16 ESM resolution.

Applied to files:

  • knip.config.js
📚 Learning: 2025-11-24T19:45:01.582Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/code-style.mdc:0-0
Timestamp: 2025-11-24T19:45:01.582Z
Learning: Applies to **/*.{ts,tsx,js} : Node 16 module resolution - include file extensions in imports (`.js`)

Applied to files:

  • knip.config.js
🔇 Additional comments (1)
knip.config.js (1)

72-76: Verify if paths configuration is needed for consistency.

The new workspace entry looks correct for scanning worker-script files and ignoring test helpers. However, most sibling project-builder-* packages include a paths configuration for the #src/* alias, while this entry omits it (similar to project-builder-common).

If packages/project-builder-server uses #src/* imports, consider adding:

paths: {
  '#src/*': ['./src/*'],
},

Otherwise, the entry is good as-is.


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.

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/project-builder-server/src/actions/utils/run-in-worker.ts (1)

37-41: Consider potential sensitive data in input logging.

The new logging improves observability by capturing when actions start execution. However, the input parameter may contain sensitive data (PII, credentials, API keys) depending on the action being executed.

Consider either:

  • Using logger.debug() instead of logger.info() for input data
  • Implementing input sanitization before logging
  • Adding a note in documentation about configuring log levels appropriately in production
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a173074 and a40559c.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • .changeset/five-poems-enjoy.md (1 hunks)
  • .changeset/soft-pets-swim.md (1 hunks)
  • packages/project-builder-server/package.json (1 hunks)
  • packages/project-builder-server/src/actions/utils/run-in-worker.ts (2 hunks)
  • packages/project-builder-server/src/actions/utils/worker-script.test-helper.ts (1 hunks)
  • packages/project-builder-server/src/actions/utils/worker-script.ts (1 hunks)
  • packages/project-builder-server/src/dev-server/mcp/mcp-server.int.test.ts (1 hunks)
  • packages/sync/src/tests/logger.test-utils.ts (3 hunks)
  • pnpm-workspace.yaml (1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

Add a new Changeset in the .changeset/ directory for new features or changes, with format 'package-name': patch and description of the feature or change

Files:

  • .changeset/soft-pets-swim.md
  • .changeset/five-poems-enjoy.md
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)

**/*.{ts,tsx}: Use TypeScript with strict type checking enabled
Always include return types on top-level functions including React components (React.ReactElement)
Include absolute paths in import statements via tsconfig paths (@src/ is the alias for src/)
If a particular interface or type is not exported, change the file so it is exported
If caught on a typing loop where forcing the any type is necessary, do not iterate too much - leave the typing as broken and let the user fix it

If target code is not easily testable, refactor it to be more testable (e.g., export types or functions)

**/*.{ts,tsx}: Import components from '@baseplate-dev/ui-components' package for UI development (e.g., Button, Input, Card, Dialog, etc.)
Use form components with React Hook Form controller variants (InputField, TextareaField, SelectField, CheckboxField, SwitchField, ComboboxField, MultiComboboxField, ColorPickerField, DatePickerField, DateTimePickerField)
Use SidebarLayout, Card, Breadcrumb, NavigationMenu, and NavigationTabs components for consistent layout structure from @baseplate-dev/ui-components
Use Dialog, ConfirmDialog, and useConfirmDialog from @baseplate-dev/ui-components for modal dialogs and confirmation interactions
Always use compareStrings from @baseplate-dev/utils instead of String.prototype.localeCompare() for code generation, file sorting, and internal data structures
If a particular interface or type is not exported, modify the file to export it
Use TsCodeFragment for composable code pieces and TsCodeUtils for manipulating fragments when generating TypeScript code
Create generators using createGenerator with configuration via descriptor schema (Zod), organizing into one or more tasks created with createGeneratorTask
Tasks should have run (initialization) and build (code generation) phases, export and consume providers, and may be organized into phases for ordered execution
Use provider scopes to control visibility and prevent collisions be...

Files:

  • packages/project-builder-server/src/dev-server/mcp/mcp-server.int.test.ts
  • packages/project-builder-server/src/actions/utils/worker-script.test-helper.ts
  • packages/project-builder-server/src/actions/utils/worker-script.ts
  • packages/project-builder-server/src/actions/utils/run-in-worker.ts
  • packages/sync/src/tests/logger.test-utils.ts
**/*.{unit.test.ts,int.test.ts}

📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)

**/*.{unit.test.ts,int.test.ts}: Unit tests must use .unit.test.ts suffix, integration tests must use .int.test.ts suffix
Always import vitest globals explicitly (describe, it, expect)

Files:

  • packages/project-builder-server/src/dev-server/mcp/mcp-server.int.test.ts
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)

**/*.{ts,tsx,js}: Node 16 module resolution - include file extensions in imports (.js)
Sort imports by group: external libs first, then local imports
Use camelCase for variables/functions, PascalCase for types/classes
Order functions such that functions are placed below the variables/functions they use
Prefer using nullish coalescing operator (??) instead of logical or (||), enforced via ESLint rule
Prefer barrel exports e.g. export * from './foo.js' instead of individual named exports
Use console.info/warn/error instead of console.log

Files:

  • packages/project-builder-server/src/dev-server/mcp/mcp-server.int.test.ts
  • packages/project-builder-server/src/actions/utils/worker-script.test-helper.ts
  • packages/project-builder-server/src/actions/utils/worker-script.ts
  • packages/project-builder-server/src/actions/utils/run-in-worker.ts
  • packages/sync/src/tests/logger.test-utils.ts
**/*.{unit,int}.test.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/testing.mdc)

**/*.{unit,int}.test.{ts,tsx}: Use descriptive test names that explain what is being tested
Structure tests with Arrange-Act-Assert: clear setup, execution, and verification phases
Always mock external API calls and file system operations
Each test should be independent and not rely on other tests
Leverage TypeScript for type-safe mocking in tests
Focus on testing public methods and behaviors, not implementation details
Each test should verify one specific behavior
Extract repeated logic into helper functions to reduce duplication
Test broad behavior and common edge cases intelligently to avoid slowing down CI with excessive tests
For file system operations in tests, use memfs and mock node:fs and node:fs/promises
When using globby with mocked fs, pass the mocked fs adapter to the globby call

Files:

  • packages/project-builder-server/src/dev-server/mcp/mcp-server.int.test.ts
**/*.int.test.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/testing.mdc)

Integration tests use .int.test.ts suffix

Files:

  • packages/project-builder-server/src/dev-server/mcp/mcp-server.int.test.ts
**/*.test-helper.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/testing.mdc)

Extract common setup code into test helpers in *.test-helper.ts files

Files:

  • packages/project-builder-server/src/actions/utils/worker-script.test-helper.ts
🧠 Learnings (28)
📓 Common learnings
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Test broad behavior and common edge cases intelligently to avoid slowing down CI with excessive tests
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Extract repeated logic into helper functions to reduce duplication
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.test-helper.{ts,tsx} : Extract common setup code into test helpers in `*.test-helper.ts` files
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/ui-rules.mdc:0-0
Timestamp: 2025-11-24T19:45:27.654Z
Learning: Applies to +(*.tsx|packages/project-builder-web/**/*.tsx|packages/ui-components/**/*.tsx) : Use ShadCN-based components from `baseplate-dev/ui-components` instead of creating custom components
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.int.test.{ts,tsx} : Integration tests use `.int.test.ts` suffix
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-06-30T11:52:28.745Z
Learning: Applies to **/*.int.test.{ts,tsx} : Integration tests use `.int.test.ts` suffix
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Leverage TypeScript for type-safe mocking in tests
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 510
File: packages/project-builder-server/src/sync/conflict-file-monitor.test.ts:19-24
Timestamp: 2025-04-23T06:44:30.952Z
Learning: In the project-builder-server test suite, Vitest automocks for 'node:fs' and 'node:fs/promises' are already configured to use memfs without needing explicit implementation replacement in each test file.
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-06-30T11:52:28.745Z
Learning: Applies to **/*.unit.test.{ts,tsx} : Unit tests are colocated with source files using `.unit.test.ts` suffix
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.unit.test.{ts,tsx} : Unit tests are colocated with source files using `.unit.test.ts` suffix
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to .changeset/*.md : Add a new Changeset in the `.changeset/` directory for new features or changes, with format `'package-name': patch` and description of the feature or change

Applied to files:

  • .changeset/soft-pets-swim.md
  • .changeset/five-poems-enjoy.md
📚 Learning: 2025-05-08T12:56:11.723Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 539
File: scripts/check-changesets.ts:70-79
Timestamp: 2025-05-08T12:56:11.723Z
Learning: In the check-changesets.ts script for monorepo validation, `npm pack ${pkg.name}latest` is intentionally used to pack the most recently published version (not local changes) for comparison purposes to determine if changes require new changesets.

Applied to files:

  • pnpm-workspace.yaml
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Leverage TypeScript for type-safe mocking in tests

Applied to files:

  • packages/project-builder-server/src/dev-server/mcp/mcp-server.int.test.ts
  • packages/project-builder-server/src/actions/utils/worker-script.test-helper.ts
📚 Learning: 2025-04-23T06:44:30.952Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 510
File: packages/project-builder-server/src/sync/conflict-file-monitor.test.ts:19-24
Timestamp: 2025-04-23T06:44:30.952Z
Learning: In the project-builder-server test suite, Vitest automocks for 'node:fs' and 'node:fs/promises' are already configured to use memfs without needing explicit implementation replacement in each test file.

Applied to files:

  • packages/project-builder-server/src/dev-server/mcp/mcp-server.int.test.ts
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.int.test.{ts,tsx} : Integration tests use `.int.test.ts` suffix

Applied to files:

  • packages/project-builder-server/src/dev-server/mcp/mcp-server.int.test.ts
📚 Learning: 2025-11-24T19:45:01.582Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/code-style.mdc:0-0
Timestamp: 2025-11-24T19:45:01.582Z
Learning: Applies to **/*.{unit.test.ts,int.test.ts} : Unit tests must use `.unit.test.ts` suffix, integration tests must use `.int.test.ts` suffix

Applied to files:

  • packages/project-builder-server/src/dev-server/mcp/mcp-server.int.test.ts
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Always mock external API calls and file system operations

Applied to files:

  • packages/project-builder-server/src/dev-server/mcp/mcp-server.int.test.ts
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.test-helper.{ts,tsx} : Extract common setup code into test helpers in `*.test-helper.ts` files

Applied to files:

  • packages/project-builder-server/src/actions/utils/worker-script.test-helper.ts
📚 Learning: 2025-06-30T11:52:28.745Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-06-30T11:52:28.745Z
Learning: Applies to src/tests/**/*.{ts,tsx} : Test helpers are located in `src/tests/` directory

Applied to files:

  • packages/project-builder-server/src/actions/utils/worker-script.test-helper.ts
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Extract repeated logic into helper functions to reduce duplication

Applied to files:

  • packages/project-builder-server/src/actions/utils/worker-script.test-helper.ts
📚 Learning: 2025-11-24T19:44:46.506Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/todo-with-auth0/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:46.506Z
Learning: Applies to examples/todo-with-auth0/**/*.{unit,int}.test.ts : Import test functions explicitly from 'vitest' instead of using globals. Example: `import { describe, expect, it } from 'vitest';`

Applied to files:

  • packages/project-builder-server/src/actions/utils/worker-script.test-helper.ts
  • packages/project-builder-server/package.json
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Tasks should have `run` (initialization) and `build` (code generation) phases, export and consume providers, and may be organized into phases for ordered execution

Applied to files:

  • packages/project-builder-server/src/actions/utils/worker-script.test-helper.ts
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Use Dynamic Tasks for data-driven generation where code generation is driven by data

Applied to files:

  • packages/project-builder-server/src/actions/utils/worker-script.test-helper.ts
📚 Learning: 2025-11-24T19:44:33.994Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/blog-with-auth/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:33.994Z
Learning: Applies to examples/blog-with-auth/**/*.test.ts : Import test functions explicitly from 'vitest' instead of relying on globals (e.g., `import { describe, expect, it } from 'vitest';`)

Applied to files:

  • packages/project-builder-server/src/actions/utils/worker-script.test-helper.ts
  • packages/project-builder-server/package.json
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Test broad behavior and common edge cases intelligently to avoid slowing down CI with excessive tests

Applied to files:

  • packages/project-builder-server/src/actions/utils/worker-script.test-helper.ts
📚 Learning: 2025-08-17T01:32:58.983Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 633
File: packages/project-builder-web/src/routes/admin-sections.$appKey/-components/columns/column-configs.ts:1-2
Timestamp: 2025-08-17T01:32:58.983Z
Learning: The project-builder-web package doesn't use ESM (ECMAScript modules), so .js extensions are not required in import statements, unlike other packages in the codebase that do use Node 16 ESM resolution.

Applied to files:

  • packages/project-builder-server/package.json
📚 Learning: 2025-06-03T09:11:29.651Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 562
File: plugins/plugin-auth/package.json:32-36
Timestamp: 2025-06-03T09:11:29.651Z
Learning: With TypeScript project references, TypeScript compilation is watched from the root level using "watch:tsc:root" script, so individual packages no longer need to include their "tsc:watch" scripts in their local "watch" commands. The local "tsc:watch" scripts are renamed from "watch:tsc" but are not meant to be run as part of the package's watch command since TypeScript watching is handled centrally at the workspace root.

Applied to files:

  • packages/project-builder-server/package.json
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Run `pnpm lint:affected` and `pnpm typecheck` before committing changes

Applied to files:

  • packages/project-builder-server/package.json
📚 Learning: 2025-11-24T19:45:27.654Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/ui-rules.mdc:0-0
Timestamp: 2025-11-24T19:45:27.654Z
Learning: Applies to +(*.tsx|packages/project-builder-web/**/*.tsx|packages/ui-components/**/*.tsx) : Use ShadCN-based components from `baseplate-dev/ui-components` instead of creating custom components

Applied to files:

  • packages/project-builder-server/package.json
📚 Learning: 2025-11-24T19:44:33.994Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/blog-with-auth/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:33.994Z
Learning: Applies to examples/blog-with-auth/**/*.{ts,tsx,js,jsx} : Follow ESM module resolution with TypeScript's `NodeNext` setting

Applied to files:

  • packages/project-builder-server/package.json
📚 Learning: 2025-11-24T19:45:01.582Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/code-style.mdc:0-0
Timestamp: 2025-11-24T19:45:01.582Z
Learning: Applies to **/*.{unit.test.ts,int.test.ts} : Always import vitest globals explicitly (describe, it, expect)

Applied to files:

  • packages/project-builder-server/package.json
📚 Learning: 2025-06-30T11:52:28.745Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-06-30T11:52:28.745Z
Learning: Applies to **/*.test.{ts,tsx} : For file system operations in tests, use memfs and mock 'node:fs' and 'node:fs/promises' with vi.mock

Applied to files:

  • packages/project-builder-server/package.json
📚 Learning: 2025-11-24T19:44:46.506Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/todo-with-auth0/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:46.506Z
Learning: Use ESM-only module system (`"type": "module"` in package.json)

Applied to files:

  • packages/project-builder-server/package.json
📚 Learning: 2025-11-24T19:45:01.582Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/code-style.mdc:0-0
Timestamp: 2025-11-24T19:45:01.582Z
Learning: Applies to **/*.{ts,tsx,js} : Node 16 module resolution - include file extensions in imports (`.js`)

Applied to files:

  • packages/project-builder-server/package.json
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Create generators using `createGenerator` with configuration via descriptor schema (Zod), organizing into one or more tasks created with `createGeneratorTask`

Applied to files:

  • packages/project-builder-server/src/actions/utils/worker-script.ts
📚 Learning: 2025-11-24T19:45:01.582Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/code-style.mdc:0-0
Timestamp: 2025-11-24T19:45:01.582Z
Learning: Applies to **/*.{ts,tsx,js} : Use console.info/warn/error instead of console.log

Applied to files:

  • packages/sync/src/tests/logger.test-utils.ts
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Focus on testing public methods and behaviors, not implementation details

Applied to files:

  • packages/sync/src/tests/logger.test-utils.ts
🧬 Code graph analysis (2)
packages/project-builder-server/src/dev-server/mcp/mcp-server.int.test.ts (4)
packages/project-builder-server/src/actions/types.ts (1)
  • ServiceActionContext (15-26)
packages/sync/src/tests/logger.test-utils.ts (1)
  • createConsoleLogger (65-88)
packages/project-builder-server/src/dev-server/mcp/server.ts (1)
  • createMcpServer (42-178)
packages/project-builder-server/src/actions/registry.ts (1)
  • ALL_SERVICE_ACTIONS (23-40)
packages/project-builder-server/src/actions/utils/run-in-worker.ts (1)
packages/project-builder-server/src/actions/utils/worker-script.ts (1)
  • WorkerData (8-12)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Verify Sync (todo-with-auth0)
  • GitHub Check: Verify Sync (blog-with-auth)
  • GitHub Check: test
  • GitHub Check: Test E2E
  • GitHub Check: Lint
🔇 Additional comments (12)
packages/project-builder-server/package.json (1)

92-92: LGTM! TSX devDependency supports the new test helper.

The addition of tsx as a devDependency is appropriate for enabling the TSX runtime in tests via the new worker-script.test-helper.ts file.

pnpm-workspace.yaml (1)

36-40: LGTM! Cosmetic key reordering with no functional impact.

The reordering of workspace configuration keys (minimumReleaseAge, publishBranch, saveWorkspaceProtocol) has no effect on functionality.

.changeset/five-poems-enjoy.md (1)

1-5: LGTM! Changeset correctly documents the test helper addition.

The changeset follows the expected format and accurately describes the addition of the createConsoleLogger test helper.

.changeset/soft-pets-swim.md (1)

1-5: LGTM! Changeset correctly documents the MCP output parsing fix.

The changeset follows the expected format and accurately describes the fix to MCP output parsing for service actions.

packages/project-builder-server/src/dev-server/mcp/mcp-server.int.test.ts (1)

1-68: LGTM! Well-structured integration test for MCP server.

The integration test properly:

  • Uses .int.test.ts suffix (as per guidelines)
  • Imports vitest globals explicitly
  • Includes proper cleanup in afterEach
  • Tests the MCP server end-to-end with in-memory transport
  • Validates the discover-generators tool response structure, confirming the output parsing fix works correctly
packages/sync/src/tests/logger.test-utils.ts (4)

1-1: LGTM! Import additions support the new console logger API.

The import of Logger and LogLevel types from the evented logger enables proper typing for the new createConsoleLogger function.


5-7: LGTM! TestLogger interface consistently extended.

The addition of getWarnOutput() and getInfoOutput() methods completes the interface symmetrically across all log levels.


10-27: LGTM! Good refactoring to extract formatMessage.

Extracting formatMessage as a top-level function promotes reusability and reduces duplication between createTestLogger and createConsoleLogger.


54-88: LGTM! Console logger implementation follows best practices.

The createConsoleLogger function:

  • Uses console.error/warn/info/debug instead of console.log (as per guidelines)
  • Implements proper log level filtering via shouldLog
  • Reuses the extracted formatMessage helper
  • Provides a clean API for test environments
packages/project-builder-server/src/actions/utils/worker-script.ts (1)

82-82: LGTM! Critical fix for MCP output schema validation.

The change from z.object(action.outputSchema).parse(result) to action.outputSchema.parse(result) is correct. The previous code incorrectly wrapped an already-complete Zod schema with z.object(), which created an invalid schema structure. The new code properly uses the schema directly, conforming to the expected Zod 4 API and fixing the MCP output parsing issue described in the PR.

packages/project-builder-server/src/actions/utils/worker-script.test-helper.ts (1)

1-5: LGTM! Clean test helper for TSX runtime registration.

This test helper:

  • Properly registers the TSX ESM loader via register()
  • Dynamically imports the worker script to enable test-time execution
  • Follows the test helper pattern (as per guidelines)
  • Works in conjunction with the environment-based worker script path selection in run-in-worker.ts
packages/project-builder-server/src/actions/utils/run-in-worker.ts (1)

43-49: LGTM!

Clean refactor that replaces the hardcoded path with the environment-aware constant. The satisfies WorkerData ensures type safety for the worker data structure.

Comment on lines +9 to +14
const WORKER_SCRIPT_PATH = path.join(
import.meta.dirname,
process.env.NODE_ENV === 'test'
? 'worker-script.test-helper.ts'
: 'worker-script.js',
);

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 | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash

echo "=== Checking for worker script files ==="
fd -t f "worker-script" packages/project-builder-server/src/actions/utils/

echo ""
echo "=== Checking for tsx in package.json ==="
if [ -f packages/project-builder-server/package.json ]; then
    jq '.devDependencies.tsx // .dependencies.tsx' packages/project-builder-server/package.json
else
    echo "package.json not found"
fi

echo ""
echo "=== Looking for integration tests using runActionInWorker ==="
rg -l "runActionInWorker" --type ts -g "*.int.test.ts" packages/project-builder-server/

echo ""
echo "=== Checking for NODE_OPTIONS or vitest configuration ==="
fd -t f "vitest.config" packages/project-builder-server/
fd -t f ".env*" packages/project-builder-server/ | head -10

echo ""
echo "=== Checking the run-in-worker.ts file ==="
fd -t f "run-in-worker.ts" packages/project-builder-server/ && wc -l packages/project-builder-server/src/actions/utils/run-in-worker.ts

Repository: halfdomelabs/baseplate

Length of output: 1394


🏁 Script executed:

#!/bin/bash

echo "=== Reading vitest.config.js ==="
cat packages/project-builder-server/vitest.config.js

echo ""
echo "=== Reading worker-script.test-helper.ts ==="
cat packages/project-builder-server/src/actions/utils/worker-script.test-helper.ts

echo ""
echo "=== Searching for any .int.test.ts files in the project ==="
fd -e "int.test.ts" packages/project-builder-server/

echo ""
echo "=== Checking root package.json for tsx ==="
cat package.json | jq '.devDependencies.tsx // .dependencies.tsx // "not found"'

Repository: halfdomelabs/baseplate

Length of output: 938


🏁 Script executed:

#!/bin/bash

echo "=== Reading run-in-worker.ts (relevant sections) ==="
head -50 packages/project-builder-server/src/actions/utils/run-in-worker.ts

echo ""
echo "=== Checking for worker-script.js (compiled version) ==="
fd "worker-script.js" packages/project-builder-server/

echo ""
echo "=== Looking at the action execution logging (lines 37-49) ==="
sed -n '37,49p' packages/project-builder-server/src/actions/utils/run-in-worker.ts

echo ""
echo "=== Checking what data is passed to workers ==="
grep -A 5 -B 5 "workerData" packages/project-builder-server/src/actions/utils/run-in-worker.ts | head -30

Repository: halfdomelabs/baseplate

Length of output: 2421


Input logging exposes potentially sensitive data in action arguments.

The dynamic path selection (test helper .ts for test environment, compiled .js for production) is properly configured using tsx/esm/api register() for TypeScript support in worker threads. However, line 41 logs the full input object, which may contain sensitive information like API keys, credentials, or user data.

Consider sanitizing or excluding sensitive fields before logging, or log only non-sensitive metadata like input size/structure rather than values.

@kingston kingston merged commit 795ee4c into main Dec 19, 2025
13 checks passed
@kingston kingston deleted the kingston/eng-936-mcp-server-is-currently-failing branch December 19, 2025 14:52
@github-actions github-actions Bot mentioned this pull request Dec 19, 2025
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.

1 participant