Skip to content

fix(describe): print a Data grid 2's and a Gallery's settings by their widget key - #1575

Open
stagknee wants to merge 1 commit into
mendixlabs:mainfrom
stagknee:fix/datagrid-describe-by-key-settings
Open

stagknee wants to merge 1 commit into
mendixlabs:mainfrom
stagknee:fix/datagrid-describe-by-key-settings

Conversation

@stagknee

Copy link
Copy Markdown
Contributor

Closes #1573 together with #1574 (this is the describe half). Please merge after #1574. That PR makes a no-project check accept the expression-typed settings this one now prints.

What it fixes

describe page printed only a few keyword properties of a Data grid 2 (PageSize, Pagination, …) and of a Gallery. Every other setting that check and exec accept by widget key was dropped, so a describe → exec round trip reset it to the default. That includes refreshInterval, columnsHidable, the personalization settings, row classes, text-template labels, a column's own settings, and the emptyPlaceholder slot.

How

cmd_pages_describe_bykey.go (new):

  • Defaults come from the stored widget's own Type.ObjectType.PropertyTypes[].ValueType, and from the columns item type for columns, with no hard-coded list.
  • A setting is printed only when it differs from what exec writes when the key is left out. That isn't always the schema's DefaultValue: four text templates have '' there but store their shipped translations. Without this rule, every grid would print four labels.
  • Printed forms:
    • an enum or string is quoted, a boolean or integer is bare;
    • a text template is printed with its <key>Params;
    • an expression is unquoted, except a pure string literal, which is quoted so it round-trips;
    • an attribute is bare where exec resolves a bare name, and qualified otherwise.
  • Actions were already covered by onClick and the named action slots (Feature: MDL surface for named pluggable-widget action slots beyond onClick/onChange (FileUploader createFileAction / onUploadSuccessFile) #956), and selection-typed keys by Selection:.
  • An attribute reached over associations is named in a -- NOT re-executable: comment instead of being lost.
  • Gallery had the same loss through the same path, so it's included. An untouched widget's describe output is unchanged.

Evidence

  • Tests: cmd_pages_describe_bykey_test.go. With the by-key reads switched off, 9 of 10 fail with the symptom, for example configurationStorageType was not printed. The tenth guards an untouched grid's output. All pass with the fix.

  • Real round trip (Mendix 11.12.5 scratch app; five grid pages and one gallery page, from bug-tests/1573-datagrid-by-key-settings-describe.mdl). describe → exec over a stored page only proves pass-through, so the real test is describe → drop page → exec → BSON compare, with ids stripped:

    pages byte-identical after the round trip
    v0.27.0 0 of 6
    this branch 6 of 6

    mx check reports 0 errors after the round trip. Describing the untouched Studio Pro pages of the scratch app and of PedApp changes exactly one page in each: Administration.Account_Overview now keeps onClickTrigger: 'double', which v0.27.0 lost.

  • Round-trip suite: go test -tags integration ./mdl/roundtrip -run TestPedAppRoundTrip is ok. The full package gives 2181 pass and 1 Windows TempDir-lock failure (a microflow test), which is identical on the other branch.

  • Tests and vet: go test ./mdl/executor/ shows the same 28 pre-existing Windows failures as main. go vet and gofmt are clean.

  • Linux (golang:1.26.6-bookworm, ANTLR 4.13.2): make grammar build test check-mdl check-findings check-conformance check-migration-reference lint-go all pass.

  • Also included: a CHANGELOG entry (Fixed), a finding in findings/mdl-executor/, and a widget-types.md note that any Data grid 2 setting can be set by its key, with the personalization example.

Not covered

  • Combobox, textfilter, dropdownfilter and image have the same describe loss, each in its own describe branch (see the issue).
  • A cleared text template (exportDialogLabel: '') is written as the shipped default text, so that can't be represented in MDL.
  • A multi-language text template prints only its first non-empty text, as the existing generic describe does.

🤖 Generated with Claude Code

…r widget key (mendixlabs#1573)

A pluggable widget takes every one of its settings under the key its package
declares, and exec stores them:

  datagrid dg (DataSource: database Shop.Ord, configurationStorageType: localStorage,
               itemSelectionMethod: rowClick, refreshInterval: 30)

`describe page` printed only the properties MDL has a keyword for (PageSize,
Pagination, Selection, onClick), so executing the description wrote the
widget's default over each of the others. Measured on Mendix 11.12.5: a grid
with 22 settings changed came back with the 4 that have keywords, with
`mx check` at 0 errors throughout, and a Studio Pro-authored grid lost its
`onClickTrigger: double`.

The describers for datagrid2 and gallery now also print every setting whose
stored value differs from the default, under its key: enumerations and plain
values, text templates with their `{N}` parameters, expressions, attributes, a
column's own settings (minWidth, minWidthLimit, allowEventPropagation, …) and
the empty-state placeholder slot. The default is read from the widget's own
stored definition (Type.ObjectType, and the item type of `columns`), not from a
list. It is not always the schema's DefaultValue: four text templates have ''
there and store the text the widget ships for them, so a text template counts
as default when it holds that text, and a grid that sets none of the settings
describes byte for byte as before (16 pages of a Studio Pro-authored project and
16 of the committed PedApp: the one that differs is a marketplace page, by the
setting it had been losing).

An Expression prints unquoted, except an expression that is only a string
literal, which would be read back as the string and stored without its quotes.
An attribute prints bare where exec resolves a bare name (inside a data
container) and qualified where it would not. A setting with no spelling (an
attribute reached over associations) is named in a `-- NOT re-executable`
comment. Selection-typed keys are carried by `Selection:` and not repeated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

AI Code Review

Review Summary

Critical Issues

None found.

Moderate Issues

None found.

Minor Issues

None found.

What Looks Good

  • Thoroughly addresses the issue: The PR fixes the core problem where describe page was dropping Data grid 2 and Gallery settings that don't have dedicated MDL keywords, preventing silent resets to defaults during describe→exec roundtrips.
  • Comprehensive testing:
    • New unit test file (cmd_pages_describe_bykey_test.go) with 415 lines covers various property types (enumerations, booleans, integers, expressions, text templates, attributes)
    • Real round-trip validation shows 6/6 pages byte-identical after describe→drop→exec→BSON compare (vs 0/6 before)
    • Integration tests pass and existing test suites remain stable
  • Correct implementation approach:
    • Defaults are read from the widget's actual BSON schema (Type.ObjectType.PropertyTypes) rather than hardcoded lists
    • Settings are only printed when they differ from what exec writes when omitted (avoiding noise like printing all four text template labels)
    • Proper formatting for different value types (quoted strings/enums, bare booleans/integers, expression handling, attribute resolution)
    • Handles omitted properties (like association paths) via comments rather than losing them silently
  • Maintains backward compatibility: Untouched widgets produce identical describe output
  • Documentation updates:
    • CHANGELOG entry clearly explains the fix
    • widget-types.md updated to document that any Data grid 2 setting can be set by widget key
  • Code quality:
    • Follows existing patterns in the executor package
    • Clean separation of concerns (new bykey.go file for core logic)
    • Proper handling of edge cases (attribute resolution inside/outside data containers)
    • No generated parser files modified (appropriately skipped)

Recommendation

Approve. The PR is well-tested, correctly implements the fix according to the project's architecture and guidelines, and provides strong evidence of resolving the described issue without regressions. The dependency on #1574 should be respected as noted in the PR description, but the code itself is sound.


Automated review via OpenRouter (Nemotron Super 120B) — workflow source

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.

Data grid 2 settings written by their widget key are lost on a describe → exec round trip, and check without a project calls them "silently dropped"

1 participant