Repository navigation
Conversation
…lection (mendixlabs#1618) `datagrid dg (DataSource: database Shop.Ord, itemSelection: Single)` passed check and exec but stored PrimitiveValue 'Single' and Selection 'None': a selection property keeps its value in Selection. The mapping pass read only the `Selection:` keyword, and the explicit-key pass skipped "already handled" names by comparing them with the mappings' SOURCE keywords, so the property's KEY fell through to the scalar branch. - resolveSelectionValue reads the keyword and the key, validates against the template's SelectionTypes and refuses two spellings that disagree (MDL-WIDGET50, check and exec); the explicit pass writes an unmapped selection as a selection. - The Gallery click-ambiguity check reads the key too. - A definition constant the script overrides by key on a widget that declares no such property (gallery `advanced: true`) is refused instead of dropped, by exec and by check (MDL-WIDGET49). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Closes #1618.
What it fixes
itemSelection: Single,MultiorNoneon a Data grid 2 or a Gallery, written by its widget key, was stored asPrimitiveValuewithSelectionleft at its default. The grid had no selection, and a gallery kept its defaultSingle.check,execandmx checkall stayed green.How
resolveSelectionValue(new,widget_selection_value.go) is shared by the engine, the explicit-key pass andcheck, so they can't disagree. It reads both theSelection:keyword and the property key, and validates the value against theSelectionTypesthe template declares.PropertyTypeIDEntry.SelectionTypesis new and filled by themodelsdkloader; without it, the fallback is None/Single/Multi.New refusal, MDL-WIDGET50, in
checkandexec:itemSelection: Bogus);Selection: Single, itemSelection: Multi). Picking a winner would be a guess, and "last pass wins" would depend on the order of two passes.Agreeing spellings, in any case (
MultipleandMulticount as the same), are fine.The explicit-key pass now skips mapped selection keys by key, and writes an unmapped selection-typed key (for example combobox
optionsSourceDatabaseItemSelection) as a selection."selection"is added toexplicitPassWritableTypes, socheckno longer says that key will be dropped (MDL-WIDGET06).The Gallery click-ambiguity check (MDL-WIDGET36) now reads
itemSelectiontoo. Before,itemSelection: NoneplusonClickwas reported wrongly.New refusal, MDL-WIDGET49, in
checkandexec: a definition constant that the script overrides by key on a widget that doesn't declare that property. Gallery 3.4.0 has noadvanced, butgallery.def.jsonmaps it to the constantfalse, soadvanced: truewas dropped.refuseUndeclaredMappedKeyexempted every mapping with a constant. It now refuses an authored value that differs from the constant, andadvanced: falsestill passes. Data grid 2 does declareadvanced, and it's unchanged.Also included: CHANGELOG entries (Fixed), a finding in
findings/mdl-executor/, acreate-pageskill note on selection by key, andmdl-examples/bug-tests/1618-datagrid-itemselection-by-key.mdlwith a.fail.mdlcompanion.Evidence
Tests:
widget_itemselection_by_key_test.go.main, 22 tests and subtests fail: the stored selection is wrong, the bogus value and the conflict are accepted, an unmapped selection is written as a primitive,advanced: trueis dropped, and the Gallery click rule fires wrongly. All pass with the fix.refreshInterval,pageSize,pagination), Data grid 2advanced: true, and valid spellings.Real run (Mendix 11.12.5 scratch app), stored
itemSelection, by key:SingleMultiNoneMultiSelection:spelling for all four (it differed for all four on v0.27.0).mx checkreports 0 errors.itemSelection: Bogus, the conflicting pair, and galleryadvanced: truefailcheck -p(exit 1), andexecrefuses and rolls back, also with--no-check.alter page … set (itemSelection: Multi)was already refused loudly, so it's unchanged.Windows:
go test ./mdl/executor/ ./mdl/backend/modelsdk/shows the same pre-existing failures asmain.go vetandgofmtare clean.Linux (
golang:1.26.6-bookworm, ANTLR 4.13.2), on the branch rebased onto currentmain:make grammar build test check-mdl check-findings check-conformance check-migration-reference lint-goall pass.Not in this PR
A survey of 12 widget templates shows the explicit-key pass still writes
PrimitiveValueinto property types that never hold one: Association, Image, Icon, Action, DataSource, Widgets and Object (for example, comboboxattributeAssociation). Association by key has a real meaning (an association path) and is the same bug, but it needs entity resolution, so I left it for a follow-up. #1575's describe still prints selection throughSelection:, which now matches what the key stores.🤖 Generated with Claude Code