fix #585: parse remaining numeric BSON fields across all numeric widths#587
Merged
Conversation
Six more numeric facets read with the same narrow `.(int32)` assertion fixed in #583 for StringAttributeType.Length. Studio Pro writes them as BSON int64; mxcli was silently returning 0 for all of them: - JsonElement.MinOccurs / MaxOccurs / MaxLength / FractionDigits / TotalDigits (parser_misc.go) — XSD facets in JSON Structures - ScheduledEvent.Interval (parser_enumeration.go) — scheduled-event cadence; misreport showed real events as "interval 0" Also collapsed parseClosePageAction's int32/int64 if-else chain (NumberOfPagesToClose) to the same extractInt helper for consistency. The five existing array-marker probes in parser.go and parser_microflow_actions.go are left as-is; those probe for `int32` intentionally because Mendix BSON-array prefix markers really are stored as int32 type discriminators, not as values to read. Added two test files mirroring the #583 template: - parser_misc_test.go — five JsonElement facets × four numeric widths - parser_scheduledevent_test.go — Interval across numeric widths Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
AI Code ReviewWhat Looks Good
RecommendationApprove – The PR thoroughly addresses the BSON numeric width bug class with minimal, focused changes, comprehensive test coverage, and proper preservation of existing behavior. No checklist violations are present. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
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.
Summary
Sweeps the same BSON-numeric-width bug class fixed in #583 (and PR #584) across the remaining parsers that still used
raw["X"].(int32). Studio Pro writes these fields as BSONint64, so the assertions silently failed and the values defaulted to0.Fields fixed:
sdk/mpr/parser_misc.goJsonElement.MinOccurssdk/mpr/parser_misc.goJsonElement.MaxOccurssdk/mpr/parser_misc.goJsonElement.MaxLengthmaxLengthfacet in import/export mappingssdk/mpr/parser_misc.goJsonElement.FractionDigitssdk/mpr/parser_misc.goJsonElement.TotalDigitssdk/mpr/parser_enumeration.goScheduledEvent.Intervalinterval 0)Also collapsed the existing
int32/int64if-else chain inparseClosePageAction(NumberOfPagesToClose) to use the sameextractInthelper — same intent, less repetition.For each numeric field the
Length-style defaulting is preserved withif _, ok := raw["X"]; ok { ... = extractInt(...) }so the sentinel defaults (MaxLength: -1, etc.) survive when the field is absent.What is intentionally left alone
The five
.(int32)probes inparser.go(array-marker handling) andparser_microflow_actions.go(parameter-mapping prefix skip) are type-discriminators, not value reads — Mendix BSON-array prefix markers really are stored asint32. The PR description in #585 already called these out.Tests
sdk/mpr/parser_misc_test.go— five JsonElement facets × four numeric widths × missing → 25 sub-cases. Fails onmainfor every non-int32 width.sdk/mpr/parser_scheduledevent_test.go—Intervalacross int32/int64/int/float64/missing. Fails onmainforint64andfloat64.Mirrors the parametrised template introduced in PR #584.
Skill update
The narrow-int32 row in
.claude/skills/fix-issue.mdis rewritten to cover the broader symptom (any numeric BSON field misreported as0/unlimited), names every affected field, and adds a sweep command. References both #583 and #585.Test plan
go test ./sdk/mpr/...— passes (including new tests); new tests fail onmainbefore the patchmake build && make test && make lint— all passmainbefore applying the fix🤖 Generated with Claude Code