From ad89929efd94fc14cfae8f909b8b023079361941 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sun, 7 Jun 2026 23:10:32 +0300 Subject: [PATCH] =?UTF-8?q?fix(form-compile):=20=D0=B0=D0=BA=D1=82=D1=83?= =?UTF-8?q?=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20allowlist=20?= =?UTF-8?q?knownKeys=20(=D0=BE=D1=84=D0=BE=D1=80=D0=BC=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20+=20autoCmdBar)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allowlist дрейфовал — element-level appearance-ключи (11 канонических + 12 рус.синонимов: textColor/цветтекста/font/шрифт/border/рамка/title*/footer*) читаются через Get-AppearanceValue и НЕ переименовываются, поэтому сыпали ложный warning «unknown key» для валидных свойств закрытого кластера Appearance. Решение самоподдерживающееся: union allowlist с самими структурами appearance — ps1 foreach по appearanceSpec/appearanceSynonyms.Keys после литерала; py доп. проверка `not in APPEARANCE_SPEC/APPEARANCE_SYNONYMS`. Не дрейфует при добавлении новых ключей/синонимов. + статический autoCmdBar. Проверено: appearance-ключи (canonical + рус.синонимы) не предупреждают, реальные опечатки (textColorr/bogusKey) по-прежнему ловятся — оба рантайма. Регресс 36/36 ps1+py. Co-Authored-By: Claude Opus 4.8 (1M context) --- .claude/skills/form-compile/scripts/form-compile.ps1 | 8 +++++++- .claude/skills/form-compile/scripts/form-compile.py | 10 +++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.claude/skills/form-compile/scripts/form-compile.ps1 b/.claude/skills/form-compile/scripts/form-compile.ps1 index 669a0f3e..0313c7b3 100644 --- a/.claude/skills/form-compile/scripts/form-compile.ps1 +++ b/.claude/skills/form-compile/scripts/form-compile.ps1 @@ -1,4 +1,4 @@ -# form-compile v1.72 — Compile 1C managed form from JSON or object metadata +# form-compile v1.73 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$JsonPath, @@ -2468,7 +2468,13 @@ function Emit-Element { "src"=1;"valuesPicture"=1;"loadTransparent"=1;"headerPicture"=1;"footerPicture"=1 # cmdBar-specific "autofill"=1 + # AutoCommandBar-маркер (autofill heuristic) на элементе/таблице + "autoCmdBar"=1 } + # Оформление (цвета/шрифты/граница) — авто-регистрация из самих структур, чтобы allowlist + # не дрейфовал при добавлении новых ключей/синонимов. Канонические + forgiving-синонимы. + foreach ($k in $script:appearanceSpec.Keys) { $knownKeys[$k] = 1 } + foreach ($k in $script:appearanceSynonyms.Keys) { $knownKeys[$k] = 1 } foreach ($p in $el.PSObject.Properties) { if ($p.Name -like '_*') { continue } # внутренние маркеры (напр. _dynList) if (-not $knownKeys.ContainsKey($p.Name)) { diff --git a/.claude/skills/form-compile/scripts/form-compile.py b/.claude/skills/form-compile/scripts/form-compile.py index 8570e1bc..1c65fa27 100644 --- a/.claude/skills/form-compile/scripts/form-compile.py +++ b/.claude/skills/form-compile/scripts/form-compile.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# form-compile v1.72 — Compile 1C managed form from JSON or object metadata +# form-compile v1.73 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import copy @@ -1795,6 +1795,8 @@ KNOWN_KEYS = { "autoRefreshPeriod", "choiceFoldersAndItems", "restoreCurrentRow", "showRoot", "allowRootChoice", "updateOnDataChange", "allowGettingCurrentRowURL", "userSettingsGroup", "rowsPicture", + # AutoCommandBar-маркер (autofill heuristic) на элементе/таблице + "autoCmdBar", } # picture/picField — НИЗКИЙ приоритет: 'picture' это и тип (PictureDecoration), и свойство-иконка @@ -2819,11 +2821,13 @@ def emit_element(lines, el, indent, in_cmd_bar=False): print("WARNING: Unknown element type, skipping", file=sys.stderr) return - # Validate known keys (внутренние маркеры на _ пропускаем) + # Validate known keys (внутренние маркеры на _ пропускаем). Оформление (цвета/шрифты/граница) + # проверяем против самих структур appearance — канонические ключи + forgiving-синонимы, чтобы + # allowlist не дрейфовал при добавлении новых. for p_name in el.keys(): if p_name.startswith('_'): continue - if p_name not in KNOWN_KEYS: + if p_name not in KNOWN_KEYS and p_name not in APPEARANCE_SPEC and p_name not in APPEARANCE_SYNONYMS: print(f"WARNING: Element '{el.get(type_key, '')}': unknown key '{p_name}' -- ignored. Check SKILL.md for valid keys.", file=sys.stderr) name = get_element_name(el, type_key)