"""Проверка .pen после персиста «ссылка без рамки, слот 48, чернила 24» (§10.28, t_a33fce2f). Что доказывается: 1. ФОРМАТ: сериализация бэкапа в формате волны совпадает с бэкапом байт-в-байт, а текущий файл сериализуется в тот же вид (канон — indent 2 + CRLF, снимок `design/` — компакт). 2. МАСТЕР ProjectLink: 48×48, padding [0,0], gap 0, центр, корень $radius-md, знак 24×24, подпись выключена, подложка выключена, РАМКИ НЕТ (`strokeWidth` 0, цвета нет). 3. РЯД ВАРИАНТОВ: PL_site сохраняет ghost-рамку 2 px `$brand-deep`; PL_rustore/PL_vk — без рамки, подложка `$brand-mark` 24×24 + белый символ; PL_primary — заливка `$brand` без рамки. 4. РЯД СОСТОЯНИЙ: четыре слота (default → hover → active → focus) в анатомии знака площадки; hover — только тень `--shadow-btn` (заливки нет); active — без смены цвета; focus — контур 2 px; слот disabled УДАЛЁН (у ссылки этого состояния в проде нет). 5. РЯД КАРТОЧКИ: тот же квадрат 48×48 и знак 24×24, что в окне (компакт 36/20 отменён). 6. ПОДПИСИ строк называют отгруженное состояние. 7. ТОЧЕЧНОСТЬ: набор различий с бэкапом равен задуманному списку — ни добавленных узлов, ни удалённых сверх одного, ни изменённых свойств вне списка. 8. ПАРИТЕТ С ПРОДОМ: правила `src/index.html` и замер отчёта волны подтверждают те же числа. Запуск: py design/link-slot-2026-10-14/verify-pen-linkslot.py """ import json import re import os import sys from pathlib import Path # ⚠️ ИСТОРИЧЕСКАЯ ЗАПИСЬ ВОЛНЫ `t_a33fce2f` (2026-10-14). Скрипт доказывал состояние `.pen` того дня # относительно бэкапа `*.bak-linkslot-20261014` и требовал ghost-рамку у `PL_site`. С тех пор канон # переписывался, а волна `t_15835792` (2026-10-15) сняла эту рамку, поэтому на текущем файле скрипт даёт # ложные провалы. Действующая проверка `.pen` — `py design/glyph-frame-2026-10-15/verify-pen-frame.py`. if os.environ.get("HISTORICAL") != "1": print("историческая проверка .pen волны t_a33fce2f (ждёт ghost-рамку PL_site и бэкап bak-linkslot-20261014)") print("действующая: py design/glyph-frame-2026-10-15/verify-pen-frame.py") print("запуск этой записи как есть: HISTORICAL=1 py design/link-slot-2026-10-14/verify-pen-linkslot.py") sys.exit(0) ROOT = Path("G:/Project/Haevey_Monster_Team_Page") STAMP = "bak-linkslot-20261014" TARGETS = [(ROOT / "Harvey_Monster_Team_Page.pen", " ", "\r\n", "indent 2 + CRLF"), (ROOT / "design" / "Harvey_Monster_Team_Page.pen", None, "", "компакт")] MASTER, PLATE, MARK, LABEL = "EByJw", "p40tIo", "z4oNC", "B9oDO" SITE, PRIMARY, DISABLED = "xv726", "z4XWl", "HZiiG" MARK_INSTANCES = ["PLyfk", "O5Vf0", "C1esB", "zqgsI"] STATES = {"ESknH": "default", "lkOok": "hover", "tn69z": "active", "JIqc4": "focus"} CAPS = ["APqQ5", "X6kox", "c9IKO7"] HOVER_COLOR = "#3A302329" # точечность: свойства, которые волна имела право изменить (id.ключ) EXPECTED_PROPS = { "EByJw.strokeWidth", "EByJw.stroke", "xv726.stroke", "xv726.strokeWidth", "z4XWl.stroke", "z4XWl.strokeWidth", # PLyfk/O5Vf0.descendants уже были в целевом состоянии после волны t_ecca48e2 — правка их не трогала "PLyfk.strokeWidth", "O5Vf0.strokeWidth", "ESknH.descendants", "ESknH.strokeWidth", "lkOok.descendants", "lkOok.strokeWidth", "lkOok.fill", "lkOok.effect", "tn69z.descendants", "tn69z.strokeWidth", "tn69z.fill", "tn69z.stroke", "JIqc4.descendants", "JIqc4.strokeWidth", "JIqc4.stroke", "C1esB.width", "C1esB.height", "C1esB.descendants", "C1esB.strokeWidth", "zqgsI.width", "zqgsI.height", "zqgsI.descendants", "zqgsI.strokeWidth", "APqQ5.content", "X6kox.content", "c9IKO7.content", } EXPECTED_REMOVED = {DISABLED} FAILS = [] def check(cond, msg): print((" ok " if cond else " FAIL ") + msg) if not cond: FAILS.append(msg) def find(node, nid): if isinstance(node, dict): if node.get("id") == nid: return node for c in node.get("children") or []: r = find(c, nid) if r is not None: return r return None def index(node, acc=None, order=None): acc = {} if acc is None else acc order = [] if order is None else order if isinstance(node, dict): if node.get("id"): acc[node["id"]] = {k: v for k, v in node.items() if k != "children"} order.append((node["id"], [c.get("id") for c in node.get("children") or [] if isinstance(c, dict)])) for c in node.get("children") or []: index(c, acc, order) return acc, order def walk(node, fn): if isinstance(node, dict): fn(node) for c in node.get("children") or []: walk(c, fn) def count_nodes(doc): n = [0] walk(doc, lambda x: n.__setitem__(0, n[0] + 1)) return n[0] def dump(doc, indent, eol): text = json.dumps(doc, ensure_ascii=False, indent=indent, separators=None if indent else (",", ":")) return (text if not indent else text.replace("\n", eol)).encode("utf-8") css = (ROOT / "src" / "index.html").read_text(encoding="utf-8") js = (ROOT / "src" / "js" / "main.js").read_text(encoding="utf-8") report = (ROOT / "design" / "link-slot-2026-10-14" / "verify-2026-10-14.md") report_txt = report.read_text(encoding="utf-8") if report.exists() else "" for path, indent, eol, fmt_name in TARGETS: print("===", path.parent.name + "/" + path.name) cur_raw = path.read_bytes() cur = json.loads(cur_raw.decode("utf-8")) bak_path = path.with_suffix(".pen." + STAMP) if not bak_path.exists(): raise SystemExit("нет бэкапа " + bak_path.name) bak = json.loads(bak_path.read_bytes().decode("utf-8")) if dump(bak, indent, eol) != bak_path.read_bytes(): dump(bak, " ", "\r\n").replace # формат не тот — дальше проверять нечего check(False, "формат бэкапа не воспроизводится как " + fmt_name) else: check(True, "формат " + fmt_name + " воспроизводится байт-в-байт (по бэкапу)") check(cur_raw == dump(cur, indent, eol), "текущий файл сериализуется в тот же формат (байт-в-байт)") # 2. мастер master = find(cur, MASTER) check(master is not None, "мастер " + MASTER + " на месте") check(master.get("width") == 48 and master.get("height") == 48, "мастер — квадрат 48×48") check(master.get("padding") == [0, 0] and master.get("gap") == 0, "мастер: padding [0,0], gap 0") check(master.get("justifyContent") == "center" and master.get("alignItems") == "center", "мастер: знак по центру") check(master.get("cornerRadius") == "$radius-md", "мастер: радиус $radius-md") check(master.get("strokeWidth") == 0, "мастер: РАМКИ НЕТ (strokeWidth 0)") check("stroke" not in master, "мастер: цвет рамки снят (нет ключа stroke)") check(find(cur, MARK).get("width") == 24 and find(cur, MARK).get("height") == 24, "мастер: знак 24×24") check(find(cur, LABEL).get("enabled") is False, "мастер: подпись выключена (слот документирован)") check(find(cur, PLATE).get("enabled") is False, "мастер: подложка по умолчанию выключена") # 3. ряд вариантов check(find(cur, SITE).get("stroke") == "$brand-deep" and find(cur, SITE).get("strokeWidth") == 2, "PL_site: ghost-рамка 2 px $brand-deep сохранена (штриховой глиф)") check(find(cur, PRIMARY).get("fill") == "$brand" and find(cur, PRIMARY).get("strokeWidth") == 0, "PL_primary: заливка $brand без рамки") check("stroke" not in find(cur, PRIMARY), "PL_primary: цвет рамки снят") for iid in ["PLyfk", "O5Vf0"]: inst = find(cur, iid) d = inst.get("descendants") or {} ok = (inst.get("strokeWidth") == 0 and "stroke" not in inst and d.get(PLATE, {}).get("enabled") is True and d.get(PLATE, {}).get("width") == 24 and d.get(MARK, {}).get("fill") == "#FFFFFF" and d.get(MARK, {}).get("width") == 24) check(ok, iid + ": без рамки, подложка $brand-mark 24×24 + белый символ 24×24") # 4. ряд состояний wrap = find(cur, "S88VV") ids = [c.get("id") for c in wrap.get("children") or []] check(ids == list(STATES.keys()), "ряд состояний = default, hover, active, focus (disabled удалён): " + str(ids)) for iid, state in STATES.items(): inst = find(cur, iid) d = inst.get("descendants") or {} check(d.get(PLATE, {}).get("enabled") is True and d.get(MARK, {}).get("fill") == "#FFFFFF", state + " (" + iid + "): анатомия знака площадки (подложка + белый символ)") hov = find(cur, "lkOok") eff = hov.get("effect") or {} check("fill" not in hov and hov.get("strokeWidth") == 0, "hover: заливки нет, рамки нет") check(eff.get("type") == "shadow" and eff.get("color", "").upper() == HOVER_COLOR.upper() and (eff.get("offset") or {}).get("y") == 4 and eff.get("blur") == 10, "hover: только тень --shadow-btn (y4 / blur10 / " + HOVER_COLOR + ")") act = find(cur, "tn69z") check("fill" not in act and "stroke" not in act and act.get("strokeWidth") == 0, "active: цвет не меняется (в проде — сдвиг 1 px)") focus = find(cur, "JIqc4") check(focus.get("stroke") == "$brand-deep" and focus.get("strokeWidth") == 2, "focus: контур 2 px $brand-deep") check(find(cur, DISABLED) is None, "слот PL_disabled удалён (состояния disabled у ссылки нет)") # 5. ряд карточки for iid in ["C1esB", "zqgsI"]: inst = find(cur, iid) d = inst.get("descendants") or {} ok = (inst.get("width") == 48 and inst.get("height") == 48 and inst.get("padding") == [0, 0] and inst.get("strokeWidth") == 0 and d.get(MARK, {}).get("width") == 24 and d.get(PLATE, {}).get("width") == 24 and d.get(PLATE, {}).get("cornerRadius") == 7) check(ok, iid + ": квадрат 48×48 и знак 24×24 (единый слот с окном)") # 6. подписи texts = {cid: (find(cur, cid) or {}).get("content", "") for cid in CAPS} check("РАМКИ НЕТ" in texts["APqQ5"] and "24×24" in texts["APqQ5"], "APqQ5: рамки нет, знак 24×24") check("только тень" in texts["X6kox"] and "disabled у ссылки нет" in texts["X6kox"], "X6kox: hover — только тень; disabled у ссылки нет") check("48×48" in texts["c9IKO7"] and "единый слот" in texts["c9IKO7"], "c9IKO7: карточка — тот же слот 48×48, что в окне") # 7. точечность ib, ob = index(bak) ic, oc = index(cur) added = set(ic) - set(ib) removed = set(ib) - set(ic) changed = set() for nid in set(ib) & set(ic): for k in set(ib[nid]) | set(ic[nid]): if ib[nid].get(k) != ic[nid].get(k): changed.add(nid + "." + k) check(not added, "узлов не добавлено (было " + str(len(ib)) + ", стало " + str(len(ic)) + ")") check(removed == EXPECTED_REMOVED, "удалён ровно один узел — " + str(sorted(removed))) extra = changed - EXPECTED_PROPS missed = EXPECTED_PROPS - changed check(not extra, "нет изменённых свойств вне задуманного списка" + (" — лишние: " + str(sorted(extra)) if extra else "")) check(not missed, "все задуманные свойства изменены" + (" — не изменены: " + str(sorted(missed)) if missed else "")) check(count_nodes(cur) == count_nodes(bak) - 1, "узлов: " + str(count_nodes(bak)) + " → " + str(count_nodes(cur))) print(" изменено свойств:", len(changed), "| задумано:", len(EXPECTED_PROPS)) # 8. паритет с продом print("=== паритет .pen ↔ прод") check(bool(re.search(r"\.btn--mark\{border:0;background:none;padding:0\}", css)), "src: .btn--mark — без рамки и заливки") check(bool(re.search(r"\.btn--mark \.btn__icon\{width:100%;height:100%\}", css)), "src: знак площадки заполняет слот (100%)") check(bool(re.search(r"\.case-card__link\{width:48px;min-height:48px", css)) and bool(re.search(r"\.quickview__links \.btn\{width:48px;min-height:48px", css)), "src: слот 48×48 в обеих точках") check(bool(re.search(r"\.btn__icon\{display:block;flex:none;width:24px;height:24px\}", css)), "src: слот глифа темы 24×24") m = re.search(r"rustore:\s*'