Skip to content

fix(executor): refuse a combo box in enumeration mode on a non-enumeration attribute (CE7247) - #1567

Open
ako wants to merge 1 commit into
mainfrom
fix/combobox-boolean-ce7247
Open

ako wants to merge 1 commit into
mainfrom
fix/combobox-boolean-ce7247

Conversation

@ako

@ako ako commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Closes the gap noted under "Related gap, not fixed here" in #1390 (found while measuring mendixlabs#1466).

Symptom

combobox cb (Attribute: Flag) on a Boolean, no data source, passed mxcli check --references and exec, then failed mxbuild:

[error] [CE7247] "Only attributes of type Enumeration are allowed here." at Combo box 'cbFlag'

Measurement

One combo box per attribute type, each with its own name, on fresh mxcli new projects. 11.14.0 and 11.13.0 gave identical results:

Attribute type mxbuild
String, Integer, Long, Decimal, AutoNumber, Boolean, DateTime, Binary CE7247 ×8
Enumeration (control) 0 errors

check --references on the same script reported none of the 8.

The combo box template explains why. In enumeration mode the attribute is written to attributeEnumeration, whose AllowedTypes is [Enum]. The widget does have a separate attributeBoolean slot (optionsSourceType: boolean), but MDL never writes it.

Fix

MDL-WIDGET39 (the CE2421 attribute-type matrix for the built-in inputs) now also judges a combo box in enumeration mode. Only Enumeration is accepted; the message names CE7247 and suggests checkbox / radiobuttons for a Boolean. Each rule now carries its own error code (CE2421 for the built-in inputs, CE7247 for the combo box), because the message text is the same.

  • A combo box with an options data source is in association mode and is not judged by this rule.
  • A combo box over a bare association is left unjudged: MDL-WIDGET39's CE1613 message was measured for the built-in inputs only.
  • Like the rest of MDL-WIDGET39, it runs in the --references walk, so it needs -p. exec uses that walk, so it refuses the shape too.
  • Not gated on the language version: every refused form already fails the build.

Tests

validate_widget_attribute_type_test.go: the per-type matrix for enumeration mode (written independently of the rule's table), the Boolean message case, and an association-mode control.

Proof by revert: with the combo box branch stubbed out, 9 checks fail (the 8 types plus the message test); restored, they pass.

Two-variant mxbuild run (11.14.0)

  • Fault forced: the bug-test file exec'd with --no-check → exactly CE7247 ×1 at cbFlag.
  • Fixed: the same file without cbFlag → 0 errors. Its controls (combobox on an Enumeration, checkbox on the Boolean) build clean.
  • check -p --references on the 9-type measurement script reports exactly the 8 combo boxes mxbuild reports.
  • No false positives: none of the 40 mdl-examples scripts containing a combo box gets a new MDL-WIDGET39 under check -p --references.

Also

  • Bug-test file mdl-examples/bug-tests/combobox-enumeration-mode-attribute-type-ce7247.mdl. It is plain .mdl because the rule needs a project and make check-mdl runs without one.
  • Skill note in create-page/reference/widgets.md.
  • Finding mdl-executor/2026-10-22-combobox-enumeration-mode-attribute-type-ce7247.json.

Not done here

Writing a Boolean combo box properly (optionsSourceType: boolean + attributeBoolean, plus describe reading it back) would be a feature, not this check.

Validation

go test ./..., go vet, gofmt, make lint, make check-mdl, make check-skill-mdl (1240 blocks), make check-skill-index and make check-findings pass. No writer or describe change, so roundtrip was not run.


Generated by Claude Code

…ation attribute (CE7247)

`combobox cb (Attribute: Flag)` on a Boolean, with no data source, passed
`check --references` and `exec` and failed mxbuild with CE7247 "Only
attributes of type Enumeration are allowed here." Enumeration mode writes
the attribute to `attributeEnumeration`, whose AllowedTypes is Enum alone.

Measured on fresh 11.14.0 and 11.13.0 projects, one combo box per type:
String, Integer, Long, Decimal, AutoNumber, Boolean, DateTime and Binary
are CE7247; Enumeration builds clean.

MDL-WIDGET39 now judges an enumeration-mode combo box against that
matrix, carrying the error code per rule (CE2421 for the built-in inputs,
CE7247 for the combo box). Association mode (an options data source) is
not judged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VKmbj53BC2vuUWYmgWgfQ5

This branch has not been deployed

No deployments
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.

2 participants