Repository navigation
fix(mcp): resolve a foldered document's module through its folder chain - #1501
Merged
Merged
Conversation
ALTER PAGE over the MCP backend failed for every page inside a folder: failed to open page for mutation: module not found: <uuid> The uuid was the page's parent folder. resolvePageUnit passed page.ContainerID straight to GetModule, which only holds for a page at the module root. The backend already had the folder-aware answer, moduleNameForContainer; the page mutator now uses it, for saved pages and for pages created this session. The same direct lookup sat in UpdateConstant and UpdateWorkflow (CREATE OR MODIFY on a foldered constant or workflow failed the same way) and in forgetSessionConstant / forgetSessionEnum (DROP of a foldered document left it registered). Those now resolve through the same helper. Control: with the production change stashed, page_mutator_folder_test.go fails with "OpenPageForMutation: module not found: fPages" plus the three sibling failures; the module-root case passes either way. Fixes mendixlabs#1593 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016ZCjbSMETkeDrr8bHi6LCD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016ZCjbSMETkeDrr8bHi6LCD
Owner
Author
|
The job fails in two places, both from one file this PR doesn't touch:
No open PR fixes it yet. The fix is a one-line patch, verified locally ( --- a/mdl/backend/pagemutator/container_rendermode_test.go
+++ b/mdl/backend/pagemutator/container_rendermode_test.go
- "go.mongodb.org/mongo-driver/bson"
+ "go.mongodb.org/mongo-driver/v2/bson"I've left it out of this PR to keep it scoped to mendixlabs#1593. Once that fix lands on Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes mendixlabs#1593
Symptom (as reported)
alter pageover the MCP backend (Studio Pro 11.12.5) fails for every page inside a folder:The same statement works on a page at the module root.
check --referencespasses, and the trace shows no PED tool call before the error.Cause
resolvePageUnit(mdl/backend/mcp/page_mutator.go) looked up the module withGetModule(page.ContainerID). A page'sContainerIDis its immediate parent, which for a foldered page is the folder, so the<uuid>in the error is the folder's ID. The backend already has a folder-aware resolver,moduleNameForContainer, whichCreatePage,DeleteConstant, the microflow mutator and others use. The page mutator didn't.Fix
resolvePageUnitnow resolves throughmoduleNameForContainer, for both saved pages and pages created this session.UpdateConstant:create or modifyon a foldered constant failed the same way.UpdateWorkflow:create or modifyon a foldered workflow failed the same way.forgetSessionConstant/forgetSessionEnum: DROP of a foldered document created this session left it registered.GetModule(x.ContainerID)calls in the package are correct: a domain model's container is always its module, and the other is the folder walk itself.Evidence
mdl/backend/mcp/page_mutator_folder_test.gocovers:A/B/Pages), plus a page created this session in a folder;pg_read_pageis called withMyFirstModule/Customer_Overview;The fake reader returns
module not found: <id>for any non-module ID, as the codec engine does.Control. With the production change stashed, the module-root case passes and the rest fail with the reported symptom:
All pass with the fix.
Not run against a live Studio Pro. The MCP server is a Studio Pro feature and none is available in this environment. The fix doesn't depend on what a Mendix tool accepts; it changes which ID is used for a lookup.
Regression script.
mdl-examples/bug-tests/1593-mcp-alter-page-in-folder.mdlpassesmxcli checkandmake check-mdl. It also runs cleanly againsttestdata/pedappon the default engine, anddescribe pageshows the nested-folder page altered. The default engine never had this bug, as the script's header notes; run it with--mcp <url>against Studio Pro to reproduce live.Bookkeeping
.claude/skills/fix-issue/findings/mdl-backend/2026-10-20-mcp-alter-page-in-folder-module-not-found.json.make check-findingspasses.docs-wiki/bug-patterns/duplicate-resolver-drift.md: one paragraph on the "which module owns this document?" variant (Fix script set checking to resolve files against accumulated state #1071 in the executor, alter page over the Studio Pro MCP backend fails with "module not found: <id>" for every page inside a folder; check passes mendixlabs/mxcli#1593 in the MCP backend).Checks
make build,make test,make check-mdlandmake check-findingsall pass locally on the branch after mergingmain.build-and-testfailure came from the v1 BSON driver import incontainer_rendermode_test.go, which was already broken onmain. fix(test): point container_rendermode_test at the v2 BSON driver #1500 fixed it there, andmainhas been merged into this branch.🤖 Generated with Claude Code
https://claude.ai/code/session_016ZCjbSMETkeDrr8bHi6LCD