Repository navigation
fix(executor): a bare System enumeration in a flow signature is an enumeration - #1544
Merged
Merged
Conversation
…umeration `create microflow M.X ($T: System.UserType)` was written as DataTypes$ObjectType with Entity "System.UserType" on every engine. The visitor types each bare qualified name in a parameter or return position as an entity, and the executor's entity-then-enumeration fallback skips the System module outright (its entities are not stored in the project), so a System enumeration kept the entity guess. The local engines wrote it without complaint and DESCRIBE printed a plausible bare `System.UserType` (an enumeration renders as `enum X`), but mx check reports CE1613 "The selected entity 'System.UserType' no longer exists" for the parameter and for a System-enum return type. Studio Pro's PED refuses it at write time, which is how it surfaced over --mcp. The explicit `enum System.UserType` spelling, what DESCRIBE emits for an enumeration, was refused as "enumeration not found", because the System module's enumerations are not in ListEnumerations. settleSystemEnumeration retypes a name in meta.SystemEnumerations before validation at all six sites (microflow, nanoflow, rule x parameter, return type), and isKnownEnumeration accepts a System enumeration where findEnumeration cannot see it. System.User stays an object type. Verified over --mcp on Studio Pro 11.15.0-rc.4: ped_read_document reads back DataTypes$EnumerationType for the parameter and the return type; a stubbed-fix control reproduces the PED error. Locally, mx check 11.14.0 goes from 2x CE1613 to 0 errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Symptom
Found while verifying #1534. Over
--mcp, this fails:A module enumeration (
Rules.RuleResult) works.It was never MCP-only
The local engines write the same wrong document. They just don't check references at write time:
mxcli bson dumpshowsDataTypes$ObjectTypewithEntity: "System.UserType".mx check(11.14.0) reports[CE1613] "The selected entity 'System.UserType' no longer exists." at Parameter 'T'. Areturns System.DeviceTypegets the same error.enum Xand an object type as a bareX, so the plausible-looking$T: System.UserTypein describe output was the symptom.The explicit
$T: enum System.UserTypeform is what DESCRIBE emits for an enumeration parameter. It was refused withenumeration 'System.UserType' not found.Cause
The visitor types every bare qualified name in a flow parameter or return position as
TypeEntity. The executor only falls back from entity to enumeration after the entity lookup misses. For the System module it skips that lookup entirely (isBuiltinModuleEntity, because System entities are not stored in the project), so a System enumeration kept the entity guess.The explicit form failed for a separate reason:
findEnumerationreadsListEnumerations, which never includes System enumerations.Fix
settleSystemEnumerationchanges aTypeEntitytoTypeEnumerationbefore validation when its name is inmodelsdk/meta.SystemEnumerations. It runs at all six sites: microflow, nanoflow and rule, each for parameters and the return type.isKnownEnumerationtreats a System enumeration as known even thoughfindEnumerationcannot see it.System.Userstill becomes an object type. A test controls for this.findEnumerationis deliberately left unchanged. Returning a synthetic System enumeration from it would makeALTER/DROP ENUMERATION System.Xreachable, which is the "making a synthesized element readable makes it writable" trap indocs-wiki/bug-patterns/platform-semantics-gaps.md.Verification
mdl/executor/system_enum_flow_type_test.go). The tests parse real MDL, so the visitor's entity guess is exercised. They cover a bare parameter, a bare return type, an explicitenumparameter, a nanoflow parameter, and a System-entity control. WithsettleSystemEnumerationstubbed to identity, the three bare-name tests fail withgot *microflows.ObjectType. The explicit-enumtest failed before the fix with the "not found" refusal.--mcp, Studio Pro 11.15.0-rc.4. CreatedMyFirstModule.MCPE_SysEnumParamandMCPE_SysEnumReturn.ped_read_documentreads back:mx check11.14.0 onmdl-examples/bug-tests/mcp-system-enumeration-parameter.mdlagainst a copy of TestApp: 2× CE1613 before, 0 errors after. DESCRIBE now round-trips as$T: enum System.UserType.go test ./mdl/... ./cmd/mxcli/... ./modelsdk/...: all 84 packages pass.mdl/executorandmdl/backend/modelsdkhit the 10-minute default timeout on a heavily loaded devcontainer (load average ~11), then passed in a rerun with-timeout 40m(609s and 589s).go vet,gofmtandmake check-findingsare clean.Checklist
platform-semantics-gaps.md; nothing on enum-vs-entity for System references).claude/skills/fix-issue/findings/mdl-executor/2026-10-21-system-enumeration-flow-parameter-written-object-type.jsonmdl-examples/bug-tests/mcp-system-enumeration-parameter.mdlctx.Backend🤖 Generated with Claude Code