Skip to content

fix(mcp): stop tsc class fields from wiping model instances in configure_environment - #279

Merged
vigneshrajsb merged 1 commit into
mainfrom
fix-mcp-configure-environment-class-fields
Nov 10, 2026
Merged

vigneshrajsb merged 1 commit into
mainfrom
fix-mcp-configure-environment-class-fields

Conversation

@vigneshrajsb

Copy link
Copy Markdown
Contributor

Description

  • configure_environment returned internal_error for any change to a service's active or branchOrExternalUrl.
  • The MCP tools are served from the tsc build of ws-server, where target: esnext emits declared model properties (id!: number, deployableId, ...) as class fields. Objection's instance.$query().patch() then overwrote the instance with undefined values, and the next read of the instance (d.deployable.dependsOnDeployableName) threw a TypeError. REST routes are built by Next/SWC and Jest by Babel, which don't emit those fields, so only MCP hit it.
  • Set useDefineForClassFields: false in tsconfig.server.json.
  • Log the original error with the request id in mapEnvironmentOperationError before mapping to internal_error; the client message is unchanged.

Verifying Changes

  • Reproduced against a throwaway Postgres/Redis with the real BuildService/OverrideService: active:false through the MCP handler failed before and passes with the option off.
  • New compile test fails without the config change; new mapper tests cover the logging and that expected errors aren't logged; handler test covers active and branchOrExternalUrl patches.
  • eslint, prettier and jest src/server/mcp src/server/models pass; tsc shows only pre-existing errors.

…ure_environment

The server build emits declared model properties as class fields, so an
Objection instance patched via $query().patch() was overwritten with
undefined values. Disable useDefineForClassFields for the server build and
log unexpected errors in the environment operation error mapper.
@vigneshrajsb
vigneshrajsb marked this pull request as ready for review November 10, 2026 19:36
@vigneshrajsb
vigneshrajsb requested a review from a team as a code owner November 10, 2026 19:36
@vigneshrajsb
vigneshrajsb merged commit 8c25922 into main Nov 10, 2026
5 checks passed
@vigneshrajsb
vigneshrajsb deleted the fix-mcp-configure-environment-class-fields branch November 10, 2026 19:43
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