fix(form-compile): эмитить пустой <Attributes/> у форм без реквизитов

Компилятор при отсутствии реквизитов не эмитил <Attributes> вовсе (предполагал
толерантность 1С — не проверено). Корпус: 100% форм (17033) имеют <Attributes>,
162 — пустой <Attributes/>, 0 без него. Платформа эмитит ВСЕГДА.

Emit-Attributes теперь эмитит <Attributes/> при пустом списке. Зеркало py. Кейс
minimal (форма только с заголовком) → снапшот +<Attributes/>, сертифицирован
загрузкой в 1С (форма с пустым Attributes грузится). Форма РазблокированиеРеквизитов
→ match. Раундтрип: match 156→157, with diff 3→2 (остаток — 2 GroupList,
осознанно непокрыты).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-06-09 17:15:23 +03:00
parent 1ed23b2a08
commit 24e7116b7d
3 changed files with 7 additions and 3 deletions
@@ -1,4 +1,4 @@
# form-compile v1.93 — Compile 1C managed form from JSON or object metadata
# form-compile v1.94 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param(
[string]$JsonPath,
@@ -4526,7 +4526,8 @@ function Emit-DLParameters {
function Emit-Attributes {
param($attrs, [string]$indent)
if (-not $attrs -or $attrs.Count -eq 0) { return }
# Платформа ВСЕГДА эмитит <Attributes> (100% корпуса; 162 формы — пустой <Attributes/>).
if (-not $attrs -or $attrs.Count -eq 0) { X "$indent<Attributes/>"; return }
X "$indent<Attributes>"
$seenAttrs = @{}
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# form-compile v1.93 — Compile 1C managed form from JSON or object metadata
# form-compile v1.94 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
import copy
@@ -4240,7 +4240,9 @@ def emit_dl_parameters(lines, params, indent):
def emit_attributes(lines, attrs, indent):
# Платформа ВСЕГДА эмитит <Attributes> (100% корпуса; 162 формы — пустой <Attributes/>).
if not attrs or len(attrs) == 0:
lines.append(f'{indent}<Attributes/>')
return
lines.append(f'{indent}<Attributes>')
@@ -8,4 +8,5 @@
</Title>
<AutoTitle>false</AutoTitle>
<AutoCommandBar name="ФормаКоманднаяПанель" id="-1"/>
<Attributes/>
</Form>