Skip to content

Commit 8d5cc94

Browse files
committed
test: document empty change refresh validity
Symptom: the empty change-object fix relies on RefreshInClient=true even though the CE0032 text mentions only missing items and commit state. Root cause: the Studio Pro validator accepts refresh-only empty changes, but that behavior is not obvious from public docs or the CE0032 wording. Fix: add an executable bug-test fixture for issue #339 and document the mx check behavior directly beside the builder inference. Tests: `./bin/mxcli check mdl-examples/bug-tests/339-empty-change-refresh-in-client.mdl` and `go test ./mdl/executor -run TestEmptyChangeObjectRefreshesInClient`.
1 parent 83b7173 commit 8d5cc94

2 files changed

Lines changed: 39 additions & 3 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
-- ============================================================================
2+
-- Bug #339: Empty change-object actions must refresh in client
3+
-- ============================================================================
4+
--
5+
-- Symptom (before fix):
6+
-- Rebuilding an empty change-object activity from MDL wrote a non-committing
7+
-- ChangeObjectAction with no member changes and RefreshInClient=false.
8+
-- Studio Pro / mx check rejected that activity with CE0032:
9+
-- "Change action has no items specified and does not commit the object."
10+
--
11+
-- After fix:
12+
-- `change $Object;` is serialized as a refresh-only change action by setting
13+
-- RefreshInClient=true. Although the CE0032 text mentions only items/commit,
14+
-- empirical mx check validation accepts refresh as the third valid escape.
15+
--
16+
-- Usage:
17+
-- mxcli exec mdl-examples/bug-tests/339-empty-change-refresh-in-client.mdl -p app.mpr
18+
-- mx check app.mpr
19+
-- Expected: 0 new CE0032 errors for BugTest339.MF_RefreshOnlyChange.
20+
-- ============================================================================
21+
22+
create module BugTest339;
23+
24+
create entity BugTest339.Item (
25+
Name: String(100)
26+
);
27+
28+
create microflow BugTest339.MF_RefreshOnlyChange ()
29+
begin
30+
$Item = create BugTest339.Item;
31+
change $Item;
32+
end;
33+
/

mdl/executor/cmd_microflows_builder_actions.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,12 @@ func (fb *flowBuilder) addRollbackAction(s *ast.RollbackStmt) model.ID {
240240
// addChangeObjectAction creates a CHANGE statement.
241241
func (fb *flowBuilder) addChangeObjectAction(s *ast.ChangeObjectStmt) model.ID {
242242
action := &microflows.ChangeObjectAction{
243-
BaseElement: model.BaseElement{ID: model.ID(types.GenerateID())},
244-
ChangeVariable: s.Variable,
245-
Commit: microflows.CommitTypeNo,
243+
BaseElement: model.BaseElement{ID: model.ID(types.GenerateID())},
244+
ChangeVariable: s.Variable,
245+
Commit: microflows.CommitTypeNo,
246+
// Studio Pro rejects an empty non-committing change action unless it
247+
// refreshes in client. The CE0032 message mentions only items/commit,
248+
// but mx check accepts RefreshInClient=true as the third valid escape.
246249
RefreshInClient: len(s.Changes) == 0,
247250
}
248251

0 commit comments

Comments
 (0)