Skip to content

Commit 2773c10

Browse files
akoclaude
andcommitted
fix(catalog): extractLayoutRef reads page-template LayoutCall (completes layout coverage)
Page templates (Forms$PageTemplate, e.g. all 46 Atlas_Web_Content templates) nest their layout under LayoutCall, whereas regular pages (Forms$Form) use FormCall. extractLayoutRef only read FormCall, so every page template reported no layout — on MxGraphStudioDemo only 22 of 68 pages had a LayoutRef, and the refs table had 22 layout edges. Both calls nest the same Form (string QN) / Layout (binary GUID) fields, so fall back to LayoutCall when FormCall is absent. Now 68/68 pages resolve a layout (e.g. Phone_Detail -> Atlas_Core.Phone_Default) and refs layout edges go 22 -> 68. TestExtractLayoutRef gains a LayoutCall (page-template) case. This closes the "layout extraction is partial" follow-up noted on #663 gap 3. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 456803f commit 2773c10

2 files changed

Lines changed: 23 additions & 4 deletions

File tree

mdl/catalog/builder_pages.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,20 +187,28 @@ type rawWidgetInfo struct {
187187
AttributeRef string
188188
}
189189

190-
// extractLayoutRef extracts the layout reference from raw page BSON.
190+
// extractLayoutRef extracts the layout reference from raw page BSON. Regular
191+
// pages (Forms$Form) carry the layout under FormCall; page templates
192+
// (Forms$PageTemplate) carry it under LayoutCall instead. Both nest the same
193+
// Form (string qualified name) / Layout (binary GUID) fields, so try FormCall
194+
// first and fall back to LayoutCall — without the fallback every page template
195+
// reports no layout (e.g. all 46 Atlas_Web_Content templates).
191196
func extractLayoutRef(rawData map[string]any) string {
192-
formCall, ok := rawData["FormCall"].(map[string]any)
197+
call, ok := rawData["FormCall"].(map[string]any)
198+
if !ok {
199+
call, ok = rawData["LayoutCall"].(map[string]any)
200+
}
193201
if !ok {
194202
return ""
195203
}
196204

197205
// Try Form field first (string layout name)
198-
if formName, ok := formCall["Form"].(string); ok && formName != "" {
206+
if formName, ok := call["Form"].(string); ok && formName != "" {
199207
return formName
200208
}
201209

202210
// Try Layout field (binary GUID) - extract and format
203-
if layoutID := extractBinaryID(formCall["Layout"]); layoutID != "" {
211+
if layoutID := extractBinaryID(call["Layout"]); layoutID != "" {
204212
return layoutID // Will be a GUID string
205213
}
206214

mdl/catalog/builder_pages_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ func TestExtractLayoutRef(t *testing.T) {
4848
},
4949
want: "04030201-0605-0807-090a-0b0c0d0e0f10",
5050
},
51+
{
52+
// Page templates (Forms$PageTemplate) nest the layout under LayoutCall
53+
// rather than FormCall.
54+
name: "LayoutCall Form field (page template)",
55+
rawData: map[string]any{
56+
"LayoutCall": map[string]any{
57+
"Form": "Atlas_Core.Phone_Default",
58+
},
59+
},
60+
want: "Atlas_Core.Phone_Default",
61+
},
5162
}
5263

5364
for _, tt := range tests {

0 commit comments

Comments
 (0)