Commit 957e764
fix(mcp): ListDomainModels must reconstruct dirty existing modules
CREATE ASSOCIATION failed over --mcp when its from/to entities were created
earlier in the same script, inside an existing module:
Created entity: MyFirstModule.Address
Error: parent entity not found: MyFirstModule.Address
The executor resolves an association's entities via findEntity → ListDomainModels.
GetDomainModel already reconstructs a written-this-session module from Studio Pro's
live model (dirty routing), but ListDomainModels only reconstructed *session-
created* modules — for a *dirty existing* module it returned the stale on-disk
snapshot, so entities created earlier in the run were invisible. The two read paths
were inconsistent; this is why new-module scripts worked but an existing module
(e.g. MyFirstModule in a fresh app) failed.
Apply the same dirty routing in ListDomainModels: reconstruct any local domain
model whose module is dirty, then append session-created modules as before.
Repro (MCP-only, existing module): mdl-examples/bug-tests/mcp-association-existing-module.mdl.
Live verification pending Studio Pro restart; the fix mirrors GetDomainModel's
proven routing and is build/test-clean. Not unit-tested in isolation because the
backend's *mpr.Reader has no mock seam (consistent with the package's tests).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent bd82d1e commit 957e764
2 files changed
Lines changed: 66 additions & 6 deletions
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
324 | | - | |
325 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
326 | 340 | | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
| 341 | + | |
| 342 | + | |
331 | 343 | | |
332 | 344 | | |
333 | 345 | | |
| |||
0 commit comments