Repository navigation
fix: store Boolean constant values as "True"/"False" (mendixlabs/mxcli#1321) - #1010
Merged
Merged
Conversation
`create constant ... (Type: Boolean, DefaultValue: true)` rendered the literal with fmt's %v and stored "true". Studio Pro stores "True" / "False", and its constant dialog shows a stored "true" as False while the runtime reads it as true. Normalise Boolean defaults on both the create and the create-or-modify path. Fixes mendixlabs#1321 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018KhC7qZthbY6TNuUTqURmt
) `alter settings constant @m.Flag value true` stored the configuration override's value as typed ("true"), the same defect mendixlabs#1321 reports for a constant's default. Look up the constant's type and normalise Boolean values with storedConstantDefault; other types are stored as written. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018KhC7qZthbY6TNuUTqURmt
Resolves the PR's conflict in .claude/skills/fix-issue/findings/mdl-executor.jsonl by keeping both sides' appended findings (the file's merge=union rule, which GitHub's mergeability check does not apply). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018KhC7qZthbY6TNuUTqURmt
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#1321.
Problem
Reported: "
create constantwithType: Booleanstores the literalstrueandTrueas the string"true". Studio Pro stores a Boolean default as"True"or"False"… Studio Pro's constant dialog shows a stored"true"as False, while the runtime reads it as true."Two write paths had this defect:
create constant,create or modify constant):createConstantturned the parsed literal into text withfmt.Sprintf("%v"), so a boolean was written as Go's lowercase"true"/"false". Only a quoted'True'was copied as written.alter settings constant @M.Flag value true): the value was stored exactly as typed, without checking the constant's type.describe constantreads the value without caring about case, so the two forms looked the same and only the stored file showed the difference.Fix
storedConstantDefault(mdl/executor/cmd_constants.go) converts any capitalisation of true/false to"True"/"False"for Boolean constants. Values of other types are left unchanged.alterSettingsConstant(mdl/executor/cmd_settings.go) looks up the constant's type withsettingsConstantTypeand uses the same helper. A String constant set to'true'keeps lowercase"true". If the constant can't be found, the value is stored as written.Evidence
Tests written first (
mdl/executor/cmd_constant_boolean_default_test.go, usingMockBackend). Each failed with the reported symptom before its fix and passes after it:create constant: 5 of 6 spellings failed (e.g.DefaultValue: true stored as "true", want "True"). The quoted'True'control passed.create or modify constant: failed withstored as "true".alter settings constant: 3 of 5 cases failed (value true stored as "true",value FALSE stored as "FALSE"). The two controls, already'True'and a String constant, passed.Stored on disk: I ran the scripts against a copy of
testdata/pedappand read the stored files.DefaultValue: true/True"true""True"DefaultValue: false"false""False"value true/value 'true'(Boolean)"true""True"value 'true'(String constant)"true""true"Not verified with Mendix tools: I didn't run
mx check, the runtime or Studio Pro. Per the report,mx checkflags neither spelling and the runtime reads both as true; only Studio Pro's dialog shows the difference, and Studio Pro can't run here. That"True"/"False"is the right form rests on the reporter's Studio Pro 11.12.4 measurement; the repo has no Studio Pro-made Boolean constant to compare against.Also in this PR
mdl-examples/bug-tests/1321-boolean-constant-default-case.mdl; passesmxcli checkandmake check-mdl..claude/skills/fix-issue/findings/mdl-executor.jsonl;make check-findingspasses.make build,make testandmake lintpass.🤖 Generated with Claude Code
https://claude.ai/code/session_018KhC7qZthbY6TNuUTqURmt