@@ -498,6 +498,34 @@ async def test_edit_note_auto_create_metadata_type_overrides_content_frontmatter
498498 assert "Decision body." in read_result .content [0 ].text
499499
500500
501+ @pytest .mark .asyncio
502+ async def test_edit_note_auto_create_type_preserves_bom_frontmatter (mcp_server , app , test_project ):
503+ """Type precedence must not turn BOM-prefixed frontmatter into note body text."""
504+ async with Client (mcp_server ) as client :
505+ edit_result = await client .call_tool (
506+ "edit_note" ,
507+ {
508+ "project" : test_project .name ,
509+ "identifier" : "notes/bom-frontmatter" ,
510+ "operation" : "append" ,
511+ "content" : "\ufeff ---\n type: incident\n status: draft\n ---\n # BOM Note\n \n Body." ,
512+ "metadata" : {"type" : "decision" },
513+ },
514+ )
515+
516+ assert "Created note (append)" in edit_result .content [0 ].text
517+ read_result = await client .call_tool (
518+ "read_note" ,
519+ {"project" : test_project .name , "identifier" : "notes/bom-frontmatter" },
520+ )
521+ persisted = read_result .content [0 ].text
522+ persisted_metadata = parse_frontmatter (persisted )
523+ assert persisted_metadata ["type" ] == "decision"
524+ assert persisted_metadata ["status" ] == "draft"
525+ assert persisted .count ("---" ) == 2
526+ assert "# BOM Note\n \n Body." in persisted
527+
528+
501529@pytest .mark .asyncio
502530async def test_edit_note_rejects_blank_metadata_type (mcp_server , app , test_project ):
503531 """A writable type field must reject an empty note classification."""
0 commit comments