Summary
PR #584 fixed the BSON-numeric-width bug for StringAttributeType.Length. The same narrow raw[\"X\"].(int32) pattern lives in several other parsers, each of which will silently report 0 for any value Mendix Studio Pro writes as BSON int64 (the same divergence that produced #583).
Affected fields
| File:Line |
Field |
What surfaces silently as 0/unlimited |
sdk/mpr/parser_misc.go:762 |
MinOccurs (JSON Structure element) |
JSON-structure occurrence constraints |
sdk/mpr/parser_misc.go:765 |
MaxOccurs (JSON Structure element) |
JSON-structure occurrence constraints |
sdk/mpr/parser_misc.go:774 |
MaxLength (JSON Structure element) |
XSD/JSON maxLength facet, used for import/export mapping validation |
sdk/mpr/parser_misc.go:777 |
FractionDigits (JSON Structure element) |
Decimal precision in JSON structures |
sdk/mpr/parser_misc.go:780 |
TotalDigits (JSON Structure element) |
Decimal precision in JSON structures |
sdk/mpr/parser_enumeration.go:200 |
Interval (scheduled event) |
Scheduled-event interval value — would show as 0 → "never runs" in describe output |
Also worth tidying (not buggy, but verbose):
Out of scope (don't touch):
parser.go:96/111/177 and parser_microflow_actions.go:249/270 — these intentionally probe for int32 because Mendix array-prefix markers really are stored as int32. The assertion is a type-discriminator, not a value read.
Proposed fix
For each row in the table, replace the narrow assertion with the existing extractInt(raw[\"X\"]) helper from sdk/mpr/parser.go:44, which accepts int32/int64/int/float64. Same pattern as #584.
Add unit tests in sdk/mpr/parser_misc_test.go and sdk/mpr/parser_enumeration_test.go (or parser_scheduledevent_test.go if the function is moved) parametrised on numeric width, mirroring TestParseAttributeType_StringLength_BsonNumericWidths from PR #584.
How this is likely to bite
Same pattern as #583: an AI agent (or a fixture script) reads MaxLength/MaxOccurs from mxcli describe import-mapping or mxcli describe json-structure, generates payloads under the assumption that no limit applies, and gets runtime rejections from Mendix's XSD validator. Scheduled-event misreport is more visible — describe output would show interval 0 for events that actually run on a real cadence.
Verification approach
For each affected field: hand-craft a BSON document (map[string]any{...}) with the field stored as int64, call the parser directly, assert the field is preserved. The Go unit test from #584 is a one-file template — copy-paste, swap the field name, and you have the failing test in one step.
Notes
Summary
PR #584 fixed the BSON-numeric-width bug for
StringAttributeType.Length. The same narrowraw[\"X\"].(int32)pattern lives in several other parsers, each of which will silently report0for any value Mendix Studio Pro writes as BSONint64(the same divergence that produced #583).Affected fields
sdk/mpr/parser_misc.go:762MinOccurs(JSON Structure element)sdk/mpr/parser_misc.go:765MaxOccurs(JSON Structure element)sdk/mpr/parser_misc.go:774MaxLength(JSON Structure element)maxLengthfacet, used for import/export mapping validationsdk/mpr/parser_misc.go:777FractionDigits(JSON Structure element)sdk/mpr/parser_misc.go:780TotalDigits(JSON Structure element)sdk/mpr/parser_enumeration.go:200Interval(scheduled event)Also worth tidying (not buggy, but verbose):
sdk/mpr/parser_microflow_actions.go:295-301(NumberOfPagesToClose) already handles both int32 and int64 with an if/else chain. Collapsing toextractInt(...)keeps the codebase consistent with the fix #583: parse StringAttributeType.Length across BSON numeric widths #584 fix.Out of scope (don't touch):
parser.go:96/111/177andparser_microflow_actions.go:249/270— these intentionally probe forint32because Mendix array-prefix markers really are stored asint32. The assertion is a type-discriminator, not a value read.Proposed fix
For each row in the table, replace the narrow assertion with the existing
extractInt(raw[\"X\"])helper fromsdk/mpr/parser.go:44, which acceptsint32/int64/int/float64. Same pattern as #584.Add unit tests in
sdk/mpr/parser_misc_test.goandsdk/mpr/parser_enumeration_test.go(orparser_scheduledevent_test.goif the function is moved) parametrised on numeric width, mirroringTestParseAttributeType_StringLength_BsonNumericWidthsfrom PR #584.How this is likely to bite
Same pattern as #583: an AI agent (or a fixture script) reads
MaxLength/MaxOccursfrommxcli describe import-mappingormxcli describe json-structure, generates payloads under the assumption that no limit applies, and gets runtime rejections from Mendix's XSD validator. Scheduled-event misreport is more visible — describe output would showinterval 0for events that actually run on a real cadence.Verification approach
For each affected field: hand-craft a BSON document (
map[string]any{...}) with the field stored asint64, call the parser directly, assert the field is preserved. The Go unit test from #584 is a one-file template — copy-paste, swap the field name, and you have the failing test in one step.Notes
.claude/skills/fix-issue.mdsymptom table already has a row for "narrow int32 assertion on a numeric field" pointing at this fix pattern (added in fix #583: parse StringAttributeType.Length across BSON numeric widths #584), so the next contributor matching the symptom lands here.