Skip to content

Commit 63bf7f9

Browse files
engalarclaude
authored andcommitted
fix: move update-widgets to widget-specific tests only
Running mx update-widgets globally in runMxCheck caused StorageFormatException on non-widget tests (e.g., Java actions). Move update-widgets to targeted call sites: doctype tests (before mx check), ComboBox test, and Gallery test. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c64c735 commit 63bf7f9

3 files changed

Lines changed: 21 additions & 6 deletions

File tree

mdl/executor/roundtrip_doctype_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ func TestMxCheck_DoctypeScripts(t *testing.T) {
156156
// Flush to disk
157157
env.executor.Execute(&ast.DisconnectStmt{})
158158

159+
// Update widgets for scripts that create pluggable widgets (prevents CE0463).
160+
// Skip for other scripts — update-widgets can corrupt non-widget projects.
161+
if strings.Contains(name, "page") || strings.Contains(name, "widget") {
162+
runMxUpdateWidgets(t, env.projectPath)
163+
}
164+
159165
// Run mx check
160166
output, mxErr := runMxCheck(t, env.projectPath)
161167
if mxErr != nil {

mdl/executor/roundtrip_mxcheck_datagrid_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ func TestMxCheck_GalleryPage(t *testing.T) {
183183

184184
env.executor.Execute(&ast.DisconnectStmt{})
185185

186+
runMxUpdateWidgets(t, env.projectPath)
187+
186188
output, err := runMxCheck(t, env.projectPath)
187189
if err != nil {
188190
if strings.Contains(output, "placeholder") || strings.Contains(output, "CE0463") {

mdl/executor/roundtrip_mxcheck_test.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,22 @@ func runMxCheck(t *testing.T, projectPath string) (string, error) {
3131
return "", fmt.Errorf("mx binary not found")
3232
}
3333

34-
// Update widgets before checking — ensures widget definitions match templates.
35-
// Without this, programmatically created widgets may trigger CE0463 if the
36-
// embedded template has fewer/more properties than the mpk version expects.
37-
updateCmd := exec.Command(mxPath, "update-widgets", projectPath)
38-
updateCmd.CombinedOutput() // best-effort, ignore errors
39-
4034
cmd := exec.Command(mxPath, "check", projectPath)
4135
output, err := cmd.CombinedOutput()
4236
return string(output), err
4337
}
4438

39+
// runMxUpdateWidgets synchronizes widget definitions with mpk files.
40+
// Call before runMxCheck on tests that create pluggable widgets.
41+
func runMxUpdateWidgets(t *testing.T, projectPath string) {
42+
t.Helper()
43+
mxPath := findMxBinary()
44+
if mxPath == "" {
45+
return
46+
}
47+
exec.Command(mxPath, "update-widgets", projectPath).CombinedOutput()
48+
}
49+
4550
// TestMxCheck_Entity creates an entity and verifies mx check passes.
4651
func TestMxCheck_Entity(t *testing.T) {
4752
if !mxCheckAvailable() {
@@ -836,6 +841,8 @@ END;`
836841
// Disconnect to flush changes
837842
env.executor.Execute(&ast.DisconnectStmt{})
838843

844+
runMxUpdateWidgets(t, env.projectPath)
845+
839846
// Run mx check
840847
output, err := runMxCheck(t, env.projectPath)
841848
if err != nil {

0 commit comments

Comments
 (0)