feat(meta-validate): проверка формы MDObjectRef-ссылок

Значения xsi:type="xr:MDObjectRef" не проверялись вообще. Ошибка «тип ссылки
вместо объекта метаданных» обнаруживалась только платформой при загрузке
(«Неизвестный объект метаданных»), причём в логе, а не в коде возврата.

Проверка 17 по первому сегменту пути (переиспользован $validTypes +
$structuralOnlyTypes):
- сегмент оканчивается на Ref → Error: вида метаданных с таким именем
  не существует, ссылка гарантированно нерабочая; в тексте подсказана
  исправленная форма;
- неизвестный сегмент без Ref → Warn (список видов может быть неполон).

Ловит дефект статически, без платформы, независимо от происхождения файла.

Кейс error-mdobjectref-type-form + фикстура. Регресс 23/23 ps1+py.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-07-25 14:27:14 +03:00
co-authored by Claude Opus 5
parent eb1a2ed8c1
commit 387f10edf0
4 changed files with 164 additions and 2 deletions
@@ -0,0 +1,9 @@
{
"name": "Валидатор находит ошибку: MDObjectRef указывает на тип ссылки вместо объекта метаданных",
"setup": "fixture:catalog-bad-mdobjectref",
"params": { "objectPath": "Catalogs/ДоговорыТест.xml" },
"expectError": true,
"expect": {
"stdoutContains": "17. MDObjectRef 'CatalogRef.ВалютыТест'"
}
}
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<MetaDataObject xmlns="http://v8.1c.ru/8.3/MDClasses" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:cmi="http://v8.1c.ru/8.2/managed-application/cmi" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xen="http://v8.1c.ru/8.3/xcf/enums" xmlns:xpr="http://v8.1c.ru/8.3/xcf/predef" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.17">
<Catalog uuid="2836ef7b-0419-42fe-8724-618fd1c2c12a">
<InternalInfo>
<xr:GeneratedType name="CatalogObject.ДоговорыТест" category="Object">
<xr:TypeId>6baeb62e-97e6-4499-8b70-f3d01537550d</xr:TypeId>
<xr:ValueId>dddc4ad4-26bd-4419-a730-e52dfd769001</xr:ValueId>
</xr:GeneratedType>
<xr:GeneratedType name="CatalogRef.ДоговорыТест" category="Ref">
<xr:TypeId>9d21e0de-25b7-4795-bf56-3b4079d934fc</xr:TypeId>
<xr:ValueId>6ec351b4-1c1c-4302-b418-8bee2278fe53</xr:ValueId>
</xr:GeneratedType>
<xr:GeneratedType name="CatalogSelection.ДоговорыТест" category="Selection">
<xr:TypeId>0f6c64e1-d4a2-44c4-beb5-fd1a0c677430</xr:TypeId>
<xr:ValueId>b8f0c243-2e1a-4fd2-95bd-5cb3ede085ea</xr:ValueId>
</xr:GeneratedType>
<xr:GeneratedType name="CatalogList.ДоговорыТест" category="List">
<xr:TypeId>ebf66c45-7189-483a-9735-69649a113dd7</xr:TypeId>
<xr:ValueId>cf1b1818-49d8-4dc4-890f-7a08289522e2</xr:ValueId>
</xr:GeneratedType>
<xr:GeneratedType name="CatalogManager.ДоговорыТест" category="Manager">
<xr:TypeId>826f6ff2-e21e-4872-a142-23aeab5ffe30</xr:TypeId>
<xr:ValueId>98a2519d-35ec-452e-84b6-0717bdcec784</xr:ValueId>
</xr:GeneratedType>
</InternalInfo>
<Properties>
<Name>ДоговорыТест</Name>
<Synonym>
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Договоры тест</v8:content>
</v8:item>
</Synonym>
<Comment/>
<Hierarchical>false</Hierarchical>
<HierarchyType>HierarchyOfItems</HierarchyType>
<LimitLevelCount>false</LimitLevelCount>
<LevelCount>2</LevelCount>
<FoldersOnTop>true</FoldersOnTop>
<UseStandardCommands>true</UseStandardCommands>
<Owners>
<xr:Item xsi:type="xr:MDObjectRef">CatalogRef.ВалютыТест</xr:Item>
</Owners>
<SubordinationUse>ToItems</SubordinationUse>
<CodeLength>9</CodeLength>
<DescriptionLength>25</DescriptionLength>
<CodeType>String</CodeType>
<CodeAllowedLength>Variable</CodeAllowedLength>
<CodeSeries>WholeCatalog</CodeSeries>
<CheckUnique>false</CheckUnique>
<Autonumbering>true</Autonumbering>
<DefaultPresentation>AsDescription</DefaultPresentation>
<Characteristics/>
<PredefinedDataUpdate>Auto</PredefinedDataUpdate>
<EditType>InDialog</EditType>
<QuickChoice>false</QuickChoice>
<ChoiceMode>BothWays</ChoiceMode>
<InputByString>
<xr:Field>Catalog.ДоговорыТест.StandardAttribute.Description</xr:Field>
<xr:Field>Catalog.ДоговорыТест.StandardAttribute.Code</xr:Field>
</InputByString>
<SearchStringModeOnInputByString>Begin</SearchStringModeOnInputByString>
<FullTextSearchOnInputByString>DontUse</FullTextSearchOnInputByString>
<ChoiceDataGetModeOnInputByString>Directly</ChoiceDataGetModeOnInputByString>
<DefaultObjectForm/>
<DefaultFolderForm/>
<DefaultListForm/>
<DefaultChoiceForm/>
<DefaultFolderChoiceForm/>
<AuxiliaryObjectForm/>
<AuxiliaryFolderForm/>
<AuxiliaryListForm/>
<AuxiliaryChoiceForm/>
<AuxiliaryFolderChoiceForm/>
<IncludeHelpInContents>false</IncludeHelpInContents>
<BasedOn/>
<DataLockFields/>
<DataLockControlMode>Managed</DataLockControlMode>
<FullTextSearch>Use</FullTextSearch>
<ObjectPresentation/>
<ExtendedObjectPresentation/>
<ListPresentation/>
<ExtendedListPresentation/>
<Explanation/>
<CreateOnInput>Use</CreateOnInput>
<ChoiceHistoryOnInput>Auto</ChoiceHistoryOnInput>
<DataHistory>DontUse</DataHistory>
<UpdateDataHistoryImmediatelyAfterWrite>false</UpdateDataHistoryImmediatelyAfterWrite>
<ExecuteAfterWriteDataHistoryVersionProcessing>false</ExecuteAfterWriteDataHistoryVersionProcessing>
</Properties>
<ChildObjects/>
</Catalog>
</MetaDataObject>