Skip to content

Commit 00b80f3

Browse files
akoclaude
andcommitted
feat: make lowercase keywords the standard convention in MDL output
Convert all Go source files, executor commands, visitor code, and tests to produce and expect lowercase MDL keywords. The grammar already supports case-insensitive parsing; this change establishes lowercase as the canonical output convention so generated MDL reads more like a modern DSL than SQL/BASIC. - Visitor: store widget types as lowercase (ToLower instead of ToUpper) - Executor: DESCRIBE/SHOW commands emit lowercase keywords throughout - Widget registry: normalize MDLName and MDLContainer to lowercase on load - Microflow formatter: lowercase aggregate functions and log levels - All test assertions updated to expect lowercase Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 1ad450a commit 00b80f3

146 files changed

Lines changed: 3079 additions & 3071 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

mdl/backend/mpr/convert_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func TestJsonStructureFieldPreservation(t *testing.T) {
121121
js := &mpr.JsonStructure{
122122
ContainerID: model.ID("m1"),
123123
Name: "MyJson",
124-
Documentation: "Test JSON structure",
124+
Documentation: "Test json structure",
125125
JsonSnippet: `{"a":1}`,
126126
Elements: []*mpr.JsonElement{
127127
{

mdl/backend/mpr/datagrid_builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ func (b *MprBackend) buildFilterWidgetBSON(widgetID, filterName string, projectP
11911191
rawType, rawObject, _, _, err := widgets.GetTemplateFullBSON(widgetID, types.GenerateID, projectPath)
11921192
if err != nil || rawType == nil {
11931193
if err != nil {
1194-
log.Printf("WARNING: failed to load template for widget %s: %v; using minimal fallback", widgetID, err)
1194+
log.Printf("warning: failed to load template for widget %s: %v; using minimal fallback", widgetID, err)
11951195
}
11961196
return b.buildMinimalFilterWidgetBSON(widgetID, filterName)
11971197
}

mdl/backend/mpr/page_mutator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ func (m *mprPageMutator) DropVariable(name string) error {
258258

259259
func (m *mprPageMutator) SetLayout(newLayout string, paramMappings map[string]string) error {
260260
if m.containerType == backend.ContainerSnippet {
261-
return fmt.Errorf("SET Layout is not supported for snippets")
261+
return fmt.Errorf("set Layout is not supported for snippets")
262262
}
263263

264264
formCall := dGetDoc(m.rawData, "FormCall")

mdl/backend/mpr/widget_builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ func updatePropertyInArray(arr bson.A, propertyTypeID string, updateFn func(bson
365365
}
366366
if !matched {
367367
// TODO(shared-types): propagate warning instead of logging — requires interface change.
368-
log.Printf("WARNING: updatePropertyInArray: no match for TypePointer %s in %d properties", propertyTypeID, len(arr)-1)
368+
log.Printf("warning: updatePropertyInArray: no match for TypePointer %s in %d properties", propertyTypeID, len(arr)-1)
369369
}
370370
return result
371371
}

mdl/backend/mpr/workflow_mutator.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (b *MprBackend) openWorkflowForMutation(unitID model.ID) (backend.WorkflowM
5656

5757
func (m *mprWorkflowMutator) SetProperty(prop string, value string) error {
5858
switch prop {
59-
case "DISPLAY":
59+
case "display":
6060
wfName := dGetDoc(m.rawData, "WorkflowName")
6161
if wfName == nil {
6262
newName := bson.D{
@@ -71,7 +71,7 @@ func (m *mprWorkflowMutator) SetProperty(prop string, value string) error {
7171
dSet(m.rawData, "Title", value)
7272
return nil
7373

74-
case "DESCRIPTION":
74+
case "description":
7575
wfDesc := dGetDoc(m.rawData, "WorkflowDescription")
7676
if wfDesc == nil {
7777
newDesc := bson.D{
@@ -113,7 +113,7 @@ func (m *mprWorkflowMutator) SetPropertyWithEntity(prop string, value string, en
113113
}
114114
return nil
115115

116-
case "PARAMETER":
116+
case "parameter":
117117
if value == "" {
118118
for i, elem := range m.rawData {
119119
if elem.Key == "Parameter" {
@@ -159,7 +159,7 @@ func (m *mprWorkflowMutator) SetActivityProperty(activityRef string, atPos int,
159159
}
160160

161161
switch prop {
162-
case "PAGE":
162+
case "page":
163163
taskPage := dGetDoc(actDoc, "TaskPage")
164164
if taskPage != nil {
165165
dSet(taskPage, "Page", value)
@@ -173,7 +173,7 @@ func (m *mprWorkflowMutator) SetActivityProperty(activityRef string, atPos int,
173173
}
174174
return nil
175175

176-
case "DESCRIPTION":
176+
case "description":
177177
taskDesc := dGetDoc(actDoc, "TaskDescription")
178178
if taskDesc != nil {
179179
dSet(taskDesc, "Text", value)

mdl/backend/mpr/workflow_mutator_test.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ func TestWorkflowMutator_SetProperty_Display(t *testing.T) {
8181
doc := makeWorkflowDoc()
8282
m := newMutator(doc)
8383

84-
if err := m.SetProperty("DISPLAY", "New Title"); err != nil {
85-
t.Fatalf("SetProperty DISPLAY failed: %v", err)
84+
if err := m.SetProperty("display", "New Title"); err != nil {
85+
t.Fatalf("SetProperty display failed: %v", err)
8686
}
8787

8888
if got := dGetString(m.rawData, "Title"); got != "New Title" {
@@ -108,8 +108,8 @@ func TestWorkflowMutator_SetProperty_Display_NilSubDoc(t *testing.T) {
108108
}
109109
m := newMutator(doc)
110110

111-
if err := m.SetProperty("DISPLAY", "Created Title"); err != nil {
112-
t.Fatalf("SetProperty DISPLAY with nil sub-doc failed: %v", err)
111+
if err := m.SetProperty("display", "Created Title"); err != nil {
112+
t.Fatalf("SetProperty display with nil sub-doc failed: %v", err)
113113
}
114114

115115
if got := dGetString(m.rawData, "Title"); got != "Created Title" {
@@ -128,8 +128,8 @@ func TestWorkflowMutator_SetProperty_Description(t *testing.T) {
128128
doc := makeWorkflowDoc()
129129
m := newMutator(doc)
130130

131-
if err := m.SetProperty("DESCRIPTION", "Updated desc"); err != nil {
132-
t.Fatalf("SetProperty DESCRIPTION failed: %v", err)
131+
if err := m.SetProperty("description", "Updated desc"); err != nil {
132+
t.Fatalf("SetProperty description failed: %v", err)
133133
}
134134

135135
wfDesc := dGetDoc(m.rawData, "WorkflowDescription")
@@ -152,8 +152,8 @@ func TestWorkflowMutator_SetProperty_Description_NilSubDoc(t *testing.T) {
152152
}
153153
m := newMutator(doc)
154154

155-
if err := m.SetProperty("DESCRIPTION", "New desc"); err != nil {
156-
t.Fatalf("SetProperty DESCRIPTION with nil sub-doc failed: %v", err)
155+
if err := m.SetProperty("description", "New desc"); err != nil {
156+
t.Fatalf("SetProperty description with nil sub-doc failed: %v", err)
157157
}
158158

159159
wfDesc := dGetDoc(m.rawData, "WorkflowDescription")
@@ -1142,8 +1142,8 @@ func TestWorkflowMutator_SetActivityProperty_Page_New(t *testing.T) {
11421142
act = append(act, bson.E{Key: "TaskPage", Value: nil})
11431143
m := newMutator(makeWorkflowDoc(act))
11441144

1145-
if err := m.SetActivityProperty("Review", 0, "PAGE", "MyModule.TaskPage"); err != nil {
1146-
t.Fatalf("SetActivityProperty PAGE failed: %v", err)
1145+
if err := m.SetActivityProperty("Review", 0, "page", "MyModule.TaskPage"); err != nil {
1146+
t.Fatalf("SetActivityProperty page failed: %v", err)
11471147
}
11481148

11491149
actDoc, _ := m.findActivityByCaption("Review", 0)
@@ -1163,8 +1163,8 @@ func TestWorkflowMutator_SetActivityProperty_Page_MissingKey(t *testing.T) {
11631163
m := newMutator(makeWorkflowDoc(act))
11641164

11651165
// No error returned, but the set is silently lost
1166-
if err := m.SetActivityProperty("Review", 0, "PAGE", "MyModule.TaskPage"); err != nil {
1167-
t.Fatalf("SetActivityProperty PAGE failed: %v", err)
1166+
if err := m.SetActivityProperty("Review", 0, "page", "MyModule.TaskPage"); err != nil {
1167+
t.Fatalf("SetActivityProperty page failed: %v", err)
11681168
}
11691169

11701170
actDoc, _ := m.findActivityByCaption("Review", 0)
@@ -1184,8 +1184,8 @@ func TestWorkflowMutator_SetActivityProperty_Page_Existing(t *testing.T) {
11841184
}})
11851185
m := newMutator(makeWorkflowDoc(act))
11861186

1187-
if err := m.SetActivityProperty("Review", 0, "PAGE", "NewModule.NewPage"); err != nil {
1188-
t.Fatalf("SetActivityProperty PAGE update failed: %v", err)
1187+
if err := m.SetActivityProperty("Review", 0, "page", "NewModule.NewPage"); err != nil {
1188+
t.Fatalf("SetActivityProperty page update failed: %v", err)
11891189
}
11901190

11911191
actDoc, _ := m.findActivityByCaption("Review", 0)
@@ -1204,8 +1204,8 @@ func TestWorkflowMutator_SetActivityProperty_Description(t *testing.T) {
12041204
}})
12051205
m := newMutator(makeWorkflowDoc(act))
12061206

1207-
if err := m.SetActivityProperty("Review", 0, "DESCRIPTION", "new desc"); err != nil {
1208-
t.Fatalf("SetActivityProperty DESCRIPTION failed: %v", err)
1207+
if err := m.SetActivityProperty("Review", 0, "description", "new desc"); err != nil {
1208+
t.Fatalf("SetActivityProperty description failed: %v", err)
12091209
}
12101210

12111211
actDoc, _ := m.findActivityByCaption("Review", 0)
@@ -1299,8 +1299,8 @@ func TestWorkflowMutator_SetPropertyWithEntity_Parameter_New(t *testing.T) {
12991299
doc = append(doc, bson.E{Key: "Parameter", Value: nil})
13001300
m := newMutator(doc)
13011301

1302-
if err := m.SetPropertyWithEntity("PARAMETER", "WorkflowContext", "MyModule.Order"); err != nil {
1303-
t.Fatalf("SetPropertyWithEntity PARAMETER failed: %v", err)
1302+
if err := m.SetPropertyWithEntity("parameter", "WorkflowContext", "MyModule.Order"); err != nil {
1303+
t.Fatalf("SetPropertyWithEntity parameter failed: %v", err)
13041304
}
13051305

13061306
param := dGetDoc(m.rawData, "Parameter")
@@ -1322,8 +1322,8 @@ func TestWorkflowMutator_SetPropertyWithEntity_Parameter_Update(t *testing.T) {
13221322
}})
13231323
m := newMutator(doc)
13241324

1325-
if err := m.SetPropertyWithEntity("PARAMETER", "WorkflowContext", "NewModule.NewEntity"); err != nil {
1326-
t.Fatalf("SetPropertyWithEntity PARAMETER update failed: %v", err)
1325+
if err := m.SetPropertyWithEntity("parameter", "WorkflowContext", "NewModule.NewEntity"); err != nil {
1326+
t.Fatalf("SetPropertyWithEntity parameter update failed: %v", err)
13271327
}
13281328

13291329
param := dGetDoc(m.rawData, "Parameter")
@@ -1339,8 +1339,8 @@ func TestWorkflowMutator_SetPropertyWithEntity_Parameter_Clear(t *testing.T) {
13391339
}})
13401340
m := newMutator(doc)
13411341

1342-
if err := m.SetPropertyWithEntity("PARAMETER", "", ""); err != nil {
1343-
t.Fatalf("SetPropertyWithEntity PARAMETER clear failed: %v", err)
1342+
if err := m.SetPropertyWithEntity("parameter", "", ""); err != nil {
1343+
t.Fatalf("SetPropertyWithEntity parameter clear failed: %v", err)
13441344
}
13451345

13461346
if v := dGet(m.rawData, "Parameter"); v != nil {

mdl/executor/bugfix_integration_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ func TestDropCreateMicroflowReplacesContent(t *testing.T) {
2121
name := testModule + ".MF_DropCreateTest"
2222

2323
// Create original microflow with a LOG statement
24-
err := env.executeMDL(`CREATE MICROFLOW ` + name + ` ()
25-
BEGIN
26-
LOG INFO 'original content';
27-
END;
24+
err := env.executeMDL(`create microflow ` + name + ` ()
25+
begin
26+
log info 'original content';
27+
end;
2828
/`)
2929
if err != nil {
3030
t.Fatalf("Failed to create original microflow: %v", err)
3131
}
3232

3333
// Verify original content
34-
output, err := env.describeMDL("DESCRIBE MICROFLOW " + name + ";")
34+
output, err := env.describeMDL("describe microflow " + name + ";")
3535
if err != nil {
3636
t.Fatalf("Failed to describe original: %v", err)
3737
}
@@ -40,30 +40,30 @@ END;
4040
}
4141

4242
// DROP and recreate with different content
43-
err = env.executeMDL("DROP MICROFLOW " + name + ";")
43+
err = env.executeMDL("drop microflow " + name + ";")
4444
if err != nil {
4545
t.Fatalf("Failed to drop microflow: %v", err)
4646
}
4747

48-
err = env.executeMDL(`CREATE MICROFLOW ` + name + ` ()
49-
BEGIN
50-
LOG WARNING 'replacement content';
51-
END;
48+
err = env.executeMDL(`create microflow ` + name + ` ()
49+
begin
50+
log warning 'replacement content';
51+
end;
5252
/`)
5353
if err != nil {
5454
t.Fatalf("Failed to create replacement microflow: %v", err)
5555
}
5656

5757
// DESCRIBE should show the NEW content
58-
output, err = env.describeMDL("DESCRIBE MICROFLOW " + name + ";")
58+
output, err = env.describeMDL("describe microflow " + name + ";")
5959
if err != nil {
6060
t.Fatalf("Failed to describe replacement: %v", err)
6161
}
6262
if !strings.Contains(output, "replacement content") {
63-
t.Errorf("DROP+CREATE did not replace content. Got:\n%s", output)
63+
t.Errorf("drop+create did not replace content. Got:\n%s", output)
6464
}
6565
if strings.Contains(output, "original content") {
66-
t.Errorf("DROP+CREATE still shows original content. Got:\n%s", output)
66+
t.Errorf("drop+create still shows original content. Got:\n%s", output)
6767
}
6868
}
6969

@@ -78,7 +78,7 @@ func TestDescribeEnumerationInSubfolder(t *testing.T) {
7878
enumName := testModule + ".SubfolderTestStatus"
7979

8080
// Create an enumeration
81-
err := env.executeMDL(`CREATE ENUMERATION ` + enumName + ` (
81+
err := env.executeMDL(`create enumeration ` + enumName + ` (
8282
Active 'Active',
8383
Inactive 'Inactive'
8484
);`)
@@ -87,18 +87,18 @@ func TestDescribeEnumerationInSubfolder(t *testing.T) {
8787
}
8888

8989
// Move it to a subfolder
90-
err = env.executeMDL(`MOVE ENUMERATION ` + enumName + ` TO FOLDER 'Enums';`)
90+
err = env.executeMDL(`move enumeration ` + enumName + ` to folder 'Enums';`)
9191
if err != nil {
9292
t.Fatalf("Failed to move enumeration to folder: %v", err)
9393
}
9494

9595
// DESCRIBE should still find it
96-
output, err := env.describeMDL("DESCRIBE ENUMERATION " + enumName + ";")
96+
output, err := env.describeMDL("describe enumeration " + enumName + ";")
9797
if err != nil {
98-
t.Errorf("DESCRIBE ENUMERATION failed for subfoldered enum: %v", err)
98+
t.Errorf("describe enumeration failed for subfoldered enum: %v", err)
9999
return
100100
}
101101
if !strings.Contains(output, "Active") || !strings.Contains(output, "Inactive") {
102-
t.Errorf("DESCRIBE output missing enum values:\n%s", output)
102+
t.Errorf("describe output missing enum values:\n%s", output)
103103
}
104104
}

0 commit comments

Comments
 (0)