Skip to content

Keep what MDL cannot state on a flow rebuild (drop + create in one script) - #2214

Merged
ako merged 1 commit into
mainfrom
claude/beautiful-thompson-96trn4
Nov 13, 2026
Merged

ako merged 1 commit into
mainfrom
claude/beautiful-thompson-96trn4

Conversation

@ako

@ako ako commented Nov 13, 2026

Copy link
Copy Markdown
Owner

Fixes #2178 (upstream mendixlabs#1831).

Symptom (as reported)

drop microflow if exists X; followed by the describe of X as create, in one script, keeps every element ID. But bson dump shows:

Property before after
Microflow MarkAsUsed true false
Parameter Documentation Parameter documentation empty
Activity Documentation Activity documentation empty
Loop ErrorHandlingType (upstream comment) Continue Rollback

The last row changes behaviour: one failing iteration now aborts the whole loop.

Cause

The writer remembers a deleted unit's bytes and reconciles the re-insert with them, so canon.Reconcile transplants the stored $IDs. The content still comes from the statement, though, and none of these properties has an MDL spelling, so the writer's defaults were written.

Fix

canon.CarryUnexpressed (run by Reconcile after the transplant) now has a table, unstatedFlowDefaults. Each entry is an element $Type and key, with the writer's default:

  • flow and nanoflow MarkAsUsed
  • Documentation on parameters, action activities, loops, and exclusive and inheritance splits
  • a loop's ErrorHandlingType
  • a REST call's RequestProxyType and ProxyConfiguration

The stored value goes back on the element with the same $ID, but only while the written value is the default, so a value a statement can state still lands. A carried sub-element whose ID is already in the document is skipped.

The fix sits in Reconcile because that is where the identities already survive. It covers both rebuild shapes (drop + create in one script, and a create or modify that cannot splice) without pairing activities by hand. Loop Caption was a candidate but is not storable, so it isn't in the table.

Evidence

  • Failing test first. TestUnexpressed_FlowRebuildKeepsWhatMDLCannotState failed with exactly the reported values (MarkAsUsed:false, Documentation:"", ErrorHandlingType:"Rollback", RequestProxyType:"DefaultProxy").
  • Controls.
    • A stated change (a decision caption) still lands, with the unstatable values carried beside it.
    • A written non-default value (Abort) is not overwritten.
  • Real run on Mendix 11.14.0. I created the issue's flow and set the four properties in the stored unit. mx check on that patched baseline gives 0 errors. Then I ran drop plus describe output in one script:
    • Before the fix: MarkAsUsed: false, all documentation empty, no Continue.
    • After the fix: all values kept, and mx check gives 0 errors.
    • Same script with the log text edited: the edit lands and the carried values stay.

Checks

  • make build && make test && make lint && make check-mdl pass locally.
  • Bug-test script: mdl-examples/bug-tests/2178-drop-create-keeps-unstatable-properties.mdl
  • Finding file added; make check-findings passes.
  • Docs:
    • alter-microflow.md and the write-microflows pitfalls page say what a rebuild keeps, and that a create in a later run than its drop still writes the defaults.
    • The rewrite-drops-unauthored-state pattern page is synced.

Generated by Claude Code

…ript)

A drop + create of a flow in one script is reconciled with the deleted
unit, so every element $ID was kept, but the content came from the
statement: Mark as used, parameter, activity, loop and decision
documentation, a loop's error handling (Continue -> Rollback) and a REST
call's proxy came back at the writer's defaults (#2178,
mendixlabs#1831).

CarryUnexpressed now puts the stored value back on the element of the same
$ID for those properties, only while the written value is the default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011oK82rmxc4mZcUDT8ePYWM
@ako
ako marked this pull request as ready for review November 13, 2026 08:40
@ako
ako merged commit df9084d into main Nov 13, 2026
21 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.

[up#1831] drop + create in one script loses documentation and Mark as used

2 participants