Skip to content

fix: store Boolean constant values as "True"/"False" (mendixlabs/mxcli#1321) - #1010

Merged
ako merged 3 commits into
mainfrom
claude/epic-davinci-vnkt3x
Oct 7, 2026
Merged

ako merged 3 commits into
mainfrom
claude/epic-davinci-vnkt3x

Conversation

@ako

@ako ako commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Fixes mendixlabs#1321.

Problem

Reported: "create constant with Type: Boolean stores the literals true and True as 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:

  • Constant default (create constant, create or modify constant): createConstant turned the parsed literal into text with fmt.Sprintf("%v"), so a boolean was written as Go's lowercase "true"/"false". Only a quoted 'True' was copied as written.
  • Configuration override (alter settings constant @M.Flag value true): the value was stored exactly as typed, without checking the constant's type.

describe constant reads 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 with settingsConstantType and 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, using MockBackend). 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 with stored 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/pedapp and read the stored files.

statement before after
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 check flags 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

  • Bug test mdl-examples/bug-tests/1321-boolean-constant-default-case.mdl; passes mxcli check and make check-mdl.
  • Finding appended to .claude/skills/fix-issue/findings/mdl-executor.jsonl; make check-findings passes.
  • make build, make test and make lint pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_018KhC7qZthbY6TNuUTqURmt

claude added 2 commits October 6, 2026 19:10
`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
@ako ako changed the title fix: store Boolean constant default as "True"/"False" (#1321) fix: store Boolean constant values as "True"/"False" (mendixlabs/mxcli#1321) Oct 7, 2026
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
@ako
ako merged commit a94290c into main Oct 7, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Boolean constant: DefaultValue: true is stored as "true", which Studio Pro shows as False while the runtime reads true

2 participants