From 53407e255b23b686f22aa9462bb004a3926ca8e5 Mon Sep 17 00:00:00 2001 From: Urvish Date: Tue, 1 Dec 2026 11:48:07 +0530 Subject: [PATCH] fix(module-builder): use pattern_name instead of name in detail template presentation contract --- app/features/admin/services/module_compiler.py | 2 +- tests/test_module_builder.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/features/admin/services/module_compiler.py b/app/features/admin/services/module_compiler.py index 1ec643b..df8f4a3 100644 --- a/app/features/admin/services/module_compiler.py +++ b/app/features/admin/services/module_compiler.py @@ -1023,7 +1023,7 @@ class ModuleContentCompiler: "display_order": 0, }, { - "attribute_key": f"{template_code}.name", + "attribute_key": f"{template_code}.pattern_name", "empty_behavior": "hide", "visibility": "show", "display_order": 0, diff --git a/tests/test_module_builder.py b/tests/test_module_builder.py index df28a04..82c6612 100644 --- a/tests/test_module_builder.py +++ b/tests/test_module_builder.py @@ -500,6 +500,17 @@ async def test_module_content_compiler_full_pipeline(db_session: AsyncSession): det_tpl = json.loads(compiled_files[f"templates/{mod_code}_ct0005.json"]) validate_definition_document(det_tpl) validate_presentation_contracts(det_tpl) + det_def_codes = {d["code"] for d in det_tpl["attribute_defs"]} + det_pres_keys = [ + a["attribute_key"] + for c in det_tpl["presentation_contracts"] + for a in c["attributes"] + ] + assert f"{mod_code}_ct0005.pattern_name" in det_pres_keys + assert f"{mod_code}_ct0005.name" not in det_pres_keys + for key in det_pres_keys: + root_code = key.split(".", 2)[1] + assert root_code in det_def_codes, f"{key} missing from detail attribute_defs" # 6. Validate Data Documents with Seeder Validators validate_content_document(json.loads(compiled_files["data/list.json"])) -- 2.34.1