mosaic-headless 1.41.0 → 1.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.ja.md CHANGED
@@ -18,7 +18,7 @@
18
18
  <img src="https://img.shields.io/badge/node_properties-120-success?style=flat-square" alt="120 個の node プロパティ">
19
19
  <img src="https://img.shields.io/badge/style_properties-101-success?style=flat-square" alt="101 個のスタイルプロパティ">
20
20
  <img src="https://img.shields.io/badge/responsive_checks-733-blueviolet?style=flat-square" alt="733 件のレスポンシブ検査">
21
- <img src="https://img.shields.io/badge/self--tests-56-blueviolet?style=flat-square" alt="56 項目のセルフテスト">
21
+ <img src="https://img.shields.io/badge/self--tests-62-blueviolet?style=flat-square" alt="62 項目のセルフテスト">
22
22
  </p>
23
23
 
24
24
  <p align="center">
@@ -183,7 +183,7 @@ node type、node プロパティ、スタイルプロパティ、スタイル状
183
183
  | `data/theme-zip-verification.csv` | 22 | Mosaic 自身のテーマ ZIP を往復させて比較 |
184
184
  | `data/conversion-batch.csv` | 19 | あるサイトのすべての Elementor ページを変換・構築・検査 |
185
185
 
186
- - セルフテスト:`python tools/test_mosaic.py`、オフラインの 56 項目(検索、中国語の用語、構築結果の形と拒否ルール、公開されている構築インターフェース、このリポジトリの数値とプライバシー)。
186
+ - セルフテスト:`python tools/test_mosaic.py`、オフラインの 62 項目(検索、中国語の用語、構築結果の形と拒否ルール、公開されている構築インターフェース、このリポジトリの数値とプライバシー)。
187
187
  - evals:Mosaic 1.0.10〜1.0.12 の挙動に関する 16 問。skill ありで 16/16、なしで 0/16。結果:[evals/RESULTS.md](evals/RESULTS.md)。
188
188
  - `SKILL.md`、これらの README、バッジの数値は、`tools/check_numbers.py` がデータと照合しています。詳細:[verification-record.md](references/verification-record.md)。
189
189
 
package/README.ko.md CHANGED
@@ -18,7 +18,7 @@
18
18
  <img src="https://img.shields.io/badge/node_properties-120-success?style=flat-square" alt="120개 node 속성">
19
19
  <img src="https://img.shields.io/badge/style_properties-101-success?style=flat-square" alt="101개 스타일 속성">
20
20
  <img src="https://img.shields.io/badge/responsive_checks-733-blueviolet?style=flat-square" alt="733개 반응형 검사">
21
- <img src="https://img.shields.io/badge/self--tests-56-blueviolet?style=flat-square" alt="56개 자체 테스트">
21
+ <img src="https://img.shields.io/badge/self--tests-62-blueviolet?style=flat-square" alt="62개 자체 테스트">
22
22
  </p>
23
23
 
24
24
  <p align="center">
@@ -183,7 +183,7 @@ node type, node 속성, 스타일 속성, 스타일 상태는 플러그인 소
183
183
  | `data/theme-zip-verification.csv` | 22 | Mosaic 자체 테마 ZIP을 왕복시켜 비교 |
184
184
  | `data/conversion-batch.csv` | 19 | 한 사이트의 모든 Elementor 페이지를 변환, 구축, 검사 |
185
185
 
186
- - 자체 테스트: `python tools/test_mosaic.py`, 오프라인 테스트 56개(조회, 중국어 용어, 구축 결과의 형태와 거부 규칙, 공개된 구축 인터페이스, 이 저장소의 숫자와 개인정보).
186
+ - 자체 테스트: `python tools/test_mosaic.py`, 오프라인 테스트 62개(조회, 중국어 용어, 구축 결과의 형태와 거부 규칙, 공개된 구축 인터페이스, 이 저장소의 숫자와 개인정보).
187
187
  - evals: Mosaic 1.0.10~1.0.12 동작에 관한 16문항. skill 사용 시 16/16, 미사용 시 0/16. 결과: [evals/RESULTS.md](evals/RESULTS.md).
188
188
  - `SKILL.md`, 이 README들, 배지의 숫자는 `tools/check_numbers.py`가 데이터와 대조합니다. 자세한 내용: [verification-record.md](references/verification-record.md).
189
189
 
package/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
  <img src="https://img.shields.io/badge/node_properties-120-success?style=flat-square" alt="120 node properties">
19
19
  <img src="https://img.shields.io/badge/style_properties-101-success?style=flat-square" alt="101 style properties">
20
20
  <img src="https://img.shields.io/badge/responsive_checks-733-blueviolet?style=flat-square" alt="733 responsive checks">
21
- <img src="https://img.shields.io/badge/self--tests-56-blueviolet?style=flat-square" alt="56 self-tests">
21
+ <img src="https://img.shields.io/badge/self--tests-62-blueviolet?style=flat-square" alt="62 self-tests">
22
22
  </p>
23
23
 
24
24
  <p align="center">
@@ -183,7 +183,7 @@ Node types, node properties, style properties and style states are extracted fro
183
183
  | `data/theme-zip-verification.csv` | 22 | Mosaic's own theme ZIP round-tripped and compared |
184
184
  | `data/conversion-batch.csv` | 19 | every Elementor page of a site converted, built and checked |
185
185
 
186
- - Self-test: `python tools/test_mosaic.py`, 56 offline tests (lookups, Chinese terms, the build output's shape and refusals, the public build interface, this repository's numbers and privacy).
186
+ - Self-test: `python tools/test_mosaic.py`, 62 offline tests (lookups, Chinese terms, the build output's shape and refusals, the public build interface, this repository's numbers and privacy).
187
187
  - Evals: 16 questions about Mosaic 1.0.10 to 1.0.12 behaviour; with the skill 16/16, without it 0/16. Results: [evals/RESULTS.md](evals/RESULTS.md).
188
188
  - Every number in `SKILL.md`, these READMEs and their badges is checked against the data by `tools/check_numbers.py`. Detail: [verification-record.md](references/verification-record.md).
189
189
 
package/README.zh-TW.md CHANGED
@@ -18,7 +18,7 @@
18
18
  <img src="https://img.shields.io/badge/node_properties-120-success?style=flat-square" alt="120 個 node 屬性">
19
19
  <img src="https://img.shields.io/badge/style_properties-101-success?style=flat-square" alt="101 個樣式屬性">
20
20
  <img src="https://img.shields.io/badge/responsive_checks-733-blueviolet?style=flat-square" alt="733 條 RWD 檢查">
21
- <img src="https://img.shields.io/badge/self--tests-56-blueviolet?style=flat-square" alt="56 項自我測試">
21
+ <img src="https://img.shields.io/badge/self--tests-62-blueviolet?style=flat-square" alt="62 項自我測試">
22
22
  </p>
23
23
 
24
24
  <p align="center">
@@ -183,7 +183,7 @@ node type、node 屬性、樣式屬性、樣式狀態從外掛原始碼抽出(
183
183
  | `data/theme-zip-verification.csv` | 22 | Mosaic 自己的佈景 ZIP 匯出再匯入並比對 |
184
184
  | `data/conversion-batch.csv` | 19 | 一個網站的每個 Elementor 頁面都轉換、建置並檢查 |
185
185
 
186
- - 自我測試:`python tools/test_mosaic.py`,56 項離線測試(查詢、中文用語、建頁產出的結構與拒收規則、對外的建頁介面、本 repo 的數字與隱私)。
186
+ - 自我測試:`python tools/test_mosaic.py`,62 項離線測試(查詢、中文用語、建頁產出的結構與拒收規則、對外的建頁介面、本 repo 的數字與隱私)。
187
187
  - evals:16 題 Mosaic 1.0.10 到 1.0.12 的行為題;有 skill 16/16,沒有 skill 0/16。結果見 [evals/RESULTS.md](evals/RESULTS.md)。
188
188
  - `SKILL.md`、這幾份 README 和徽章上的數字,都由 `tools/check_numbers.py` 對照資料核對。細節見 [verification-record.md](references/verification-record.md)。
189
189
 
package/SKILL.md CHANGED
@@ -6,7 +6,7 @@ license: "MIT"
6
6
  user-invocable: true
7
7
  metadata:
8
8
  author: "moksa (https://moksaweb.com)"
9
- version: "1.41.0"
9
+ version: "1.42.0"
10
10
  homepage: "https://github.com/Moksa1123/mosaic-headless"
11
11
  ---
12
12
 
@@ -21,7 +21,7 @@
21
21
  "license": "MIT",
22
22
  "metadata": {
23
23
  "author": "moksa (https://moksaweb.com)",
24
- "version": "1.41.0",
24
+ "version": "1.42.0",
25
25
  "homepage": "https://github.com/Moksa1123/mosaic-headless"
26
26
  }
27
27
  },
@@ -24,7 +24,7 @@
24
24
  "user-invocable": true,
25
25
  "metadata": {
26
26
  "author": "moksa (https://moksaweb.com)",
27
- "version": "1.41.0",
27
+ "version": "1.42.0",
28
28
  "homepage": "https://github.com/Moksa1123/mosaic-headless"
29
29
  }
30
30
  },
@@ -21,7 +21,7 @@
21
21
  "license": "MIT",
22
22
  "metadata": {
23
23
  "author": "moksa (https://moksaweb.com)",
24
- "version": "1.41.0",
24
+ "version": "1.42.0",
25
25
  "homepage": "https://github.com/Moksa1123/mosaic-headless"
26
26
  }
27
27
  },
@@ -21,7 +21,7 @@
21
21
  "license": "MIT",
22
22
  "metadata": {
23
23
  "author": "moksa (https://moksaweb.com)",
24
- "version": "1.41.0",
24
+ "version": "1.42.0",
25
25
  "homepage": "https://github.com/Moksa1123/mosaic-headless"
26
26
  }
27
27
  },
@@ -21,7 +21,7 @@
21
21
  "license": "MIT",
22
22
  "metadata": {
23
23
  "author": "moksa (https://moksaweb.com)",
24
- "version": "1.41.0",
24
+ "version": "1.42.0",
25
25
  "homepage": "https://github.com/Moksa1123/mosaic-headless"
26
26
  }
27
27
  },
package/data/pending.csv CHANGED
@@ -15,3 +15,7 @@ date,question,why_not_found,asked_by,status
15
15
  2026-11-21,"Should build_site.py look up a post's existing template before binding, instead of always creating a new master and template?","a design decision, not a gap: em925's deploy tool imports build_site, so its behaviour is left unchanged (its md5 is part of em925's agreement). sync_nodes.py + list_bindings.php now cover in-place updates; build_site.py's limits are documented in SKILL.md and references/tools.md","skill 總機 (batch 3 item 20, batch 4 item 32)",open
16
16
  2026-11-24,"Does Mosaic 1.0.14 really answer 503 (Retry-After 30, no-cache) and write no root when the database connection is lost mid-render?","read from the 1.0.14 source and WordPress 7.1.5's wpdb only; measuring it needs the database to go away under a front-end render, not done on the shared demo site",skill 總機 (Mosaic 1.0.14 re-verification),open
17
17
  2026-11-24,Mosaic's own ZIP import of a ~24k-node theme exhausts a 512M PHP memory limit in createTemplates,"measured once on the demo site (1.0.14; the import flow's PHP is unchanged since 1.0.12); how much memory a theme that size needs, or whether Mosaic splits the tick, is not known. theme_import.php handles it",skill 總機 (Mosaic 1.0.14 re-verification),open
18
+ 2026-11-24,"Add a RELEASING.md (rewrite of gutenberg-headless's for this repo: PR, merge, push the tag, CI publishes via OIDC)","a to-do, not a gap: the repo has none, so v1.41.0 followed gutenberg-headless's; skill 總機 asked for it with the next release",skill 總機 (round-button brief 2026-11-24),"closed 2026-11-25: RELEASING.md added with v1.42.0 (PR, merge, push the tag, CI publishes via OIDC)"
19
+ 2026-11-24,Add a references/facts.md entry: WooCommerce coming-soon mode (store pages only) + Mosaic -> store pages answer 406. Woo renders its coming-soon page and returns '' from template_include; Mosaic's themes/mosaic/functions.php forces its index.php anyway; with no archive-product/single-product Mosaic template FrontendRenderer sets status_header(406). Also: does a store page that HAS a Mosaic template print two documents (Woo's page + Mosaic's) while coming-soon is on?,"the 406 is traced from source and read on the demo site (1.0.14, /shop/ and a product page, read-only); the two-document case is predicted from the code only - measuring it needs a store template written on the demo site, which waits for moksa 總機. Do the facts entry with the next release, together with RELEASING.md",skill 總機 (demo /shop/ 406 trace 2026-11-24),closed 2026-11-25: references/facts.md section added with v1.42.0; the two-document case is still open (row below)
20
+ 2026-11-25,Does a WooCommerce store page that HAS a Mosaic template print two documents while coming-soon is on?,"predicted from the code only (references/facts.md, WooCommerce coming soon section); measuring it needs a store template written on the shared demo site, which waits for moksa 總機",skill 總機 (demo /shop/ 406 trace 2026-11-24),open
21
+ 2026-11-25,"Variable-mode switch vs Chrome's visited-link colour, and @property <color> vs var() fallbacks on links","reported by a fourth site (references/facts.md, fourth site); not reproduced here - needs a theme with a mode collection, a visited link and screenshots (getComputedStyle cannot show visited colours)",skill 總機 (sync_nodes interaction target brief 2026-11-25),open
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mosaic-headless",
3
- "version": "1.41.0",
3
+ "version": "1.42.0",
4
4
  "description": "AI-agent skill: build Mosaic Pro (Nextend) WordPress sites by writing the underlying data model directly - 23 custom tables, no visual editor, no DOM. Every node type, style property and node property swept against a live install and asserted on the delivered HTML and compiled CSS. Installs into Claude Code, Cursor, Codex CLI, Gemini CLI, Copilot, Continue, Windsurf and Claude.ai.",
5
5
  "keywords": [
6
6
  "wordpress",
@@ -494,3 +494,87 @@ also checked here against the 1.0.13 source.
494
494
  - The `modal` open state is `:popover-open`, not `dialog[open]` (already above, under
495
495
  1.0.10), and there is no `flex` style key (above, second site): both confirmed again
496
496
  on this site.
497
+
498
+ ## Measured on a fourth site (Mosaic 1.0.13, 2026-11-25)
499
+
500
+ From another site's conversion (an intro animation and a dark mode), handed to this
501
+ skill; each line says what was reproduced here on the demo site (Mosaic 1.0.14).
502
+
503
+ - **An interaction's target is a node ID, and an in-place sync used to break it.**
504
+ `settings.target = {"type": "element", "uuid": ...}` names the target node's `ID`.
505
+ `build_page.py` gives every pinned `nodeID` a fresh random uuid on each run, so a
506
+ spec never knows the live ids. `sync_nodes.py` before 1.42.0 wrote the spec's
507
+ interactions as they were: the targets named this run's random uuids, no node on
508
+ the site, and the animation did nothing (that site: an intro's curtain, horse and
509
+ logo stood still; only the wrapper faded). Reproduced on the demo: built with three
510
+ targets that existed, synced a duration change with 1.41.0 -> all three targets
511
+ MISSING; its read-back did say `@st-intro differs`, but next to two false
512
+ differences (below), so it read as noise. 1.42.0 rewrites spec ids to live ids
513
+ (spec `nodeID` -> attrID -> live `ID`) before writing, refuses a write whose target
514
+ is not a node of the document (or of the master, for a template), and fails the run
515
+ (exit 1) if a written node targets a missing node after the commit. Re-synced on
516
+ the demo with 1.42.0: the three targets were the live ids again, `document.getAnimations()`
517
+ in Chromium had an animation on each, and a dry run after it showed 0 differences.
518
+ - **Two tweens of the same property on one element do not chain.** At page load every
519
+ tween's `initial` is applied at once, so the later one's start value wins and the
520
+ first never shows. Demo, 1.0.14, Chromium: one element with `translateX` 0 -> 100px
521
+ (1.5 s) then 100px -> 200px (1.5 s, delay 1.5 s) stood at 100px from the first
522
+ sample (14 ms) until 1.5 s, then moved 100 -> 200px; a control with one tween
523
+ 0 -> 200px over 3 s started at 0. Each tween is its own Web Animation (both on
524
+ `--mosaic-translate-x`). Use ONE tween with a longer duration (to
525
+ `calc(100vw + <width>)` for "runs off the screen") instead of two legs.
526
+ - **A variable-mode switch is an animation on `<html>`, and Chrome's visited-link
527
+ colour does not see it.** The mode-switch action is an `animation` action with a
528
+ `collectionMode` property meta (`tools/interactions.py` `mode_switch`), and it
529
+ runs as a Web Animation on `<html>` (the demo's `document.getAnimations()` lists one
530
+ targeting `HTML`). That site found that Chrome computes the colour of a VISITED link
531
+ without the animated values: after a switch to dark, links the visitor has opened
532
+ keep the light value and can disappear, and `getComputedStyle` cannot show it (it
533
+ reports the unvisited value, for privacy) - only a screenshot does. Its fix: after
534
+ every switch (and on load) copy the current value of each `--*` variable onto
535
+ `<html style>`. Reported by that site, not reproduced here (needs a theme with a
536
+ mode collection and a visited link).
537
+ - **A colour variable registered as `@property <color>` makes `var(--x, fallback)`
538
+ use the fallback on links** (that site: outlines and colours on `<a>` came out in the
539
+ fallback colour). Write colour variables without a fallback in generated CSS (font
540
+ variables are not affected). Reported by that site, not reproduced here.
541
+ - **Dark mode has to remap Mosaic's front-end colours too.** Mosaic's theme
542
+ stylesheet paints form fields from its own variables:
543
+ `input:where(:not([type=file],[type=checkbox],[type=radio])),textarea,select` get
544
+ `background-color: var(--mosaic-frontend-white)` (#ffffff), `color` from
545
+ `--mosaic-frontend-neutral-800` and the border from `-neutral-300`; `[type=checkbox],
546
+ [type=radio]` get the same white background, and a checked box is `-neutral-900` with
547
+ a `-white` tick (1.0.14 `themes/mosaic/public/style.css`). And
548
+ WooCommerce's fields use its own `--wc-form-color-*`. Without setting those on
549
+ `:root` for the dark mode, inputs and checkboxes stay white (that site). Map
550
+ `--mosaic-frontend-white`, `--mosaic-frontend-black`, `--mosaic-frontend-neutral-*`
551
+ and `--wc-form-color-*` to the mode's tokens.
552
+ - **Stored values `sync_nodes.py` now treats as equal** (demo, 1.0.14): `opacity ".35"`
553
+ is stored `"0.35"`; `url(x)` in `customDeclarations` is stored `url("x")`; an `rgba()`
554
+ keeps `.85` but gains spaces. And **`rel` must be a list**: on a `wysiwyg-link`,
555
+ `"rel": "noopener"` was stored as null and `["noopener"]` was kept (its validator is
556
+ `ValidatorArray`; `data/node-property-verification.csv` already had the list
557
+ APPLIED). `inline_html.py` and `from_elementor.py` wrote a string until 1.42.0, so
558
+ every converted `rel` was lost; they write a list now, and a sync treats an old
559
+ string `rel` against an empty one as no difference (with a note).
560
+
561
+ ## WooCommerce "coming soon" + Mosaic: store pages answer 406 (demo, 2026-11-24)
562
+
563
+ Traced in source and read on the demo (Mosaic 1.0.14, WooCommerce 11.2, read only):
564
+ with WooCommerce's coming-soon mode on for **store pages only**, `/shop/` and every
565
+ product page answer **HTTP 406**.
566
+
567
+ - WooCommerce renders its coming-soon page itself and then returns `''` from the
568
+ `template_include` filter (`ComingSoonRequestHandler.php`, line 117) so WordPress
569
+ loads no theme template.
570
+ - Mosaic's theme ignores that and forces its own `index.php`
571
+ (`themes/mosaic/functions.php`, line 54).
572
+ - With no Mosaic template for the store (`archive-product` / `single-product`, nor a
573
+ generic archive / index one), the renderer throws `TemplateNotFoundException` and
574
+ `FrontendRenderer.php` (line 62) sends `status_header(406)`.
575
+ - A `200` seen with a query string was a cached copy (Varnish HIT), not a fix.
576
+
577
+ What to do: take the store out of coming-soon mode (go live), and give the store its
578
+ Mosaic templates. Not measured: a store page that DOES have a Mosaic template while
579
+ coming-soon is on may print two documents (WooCommerce's page and Mosaic's) - the
580
+ code predicts it; testing it needs a store template written on the demo.
@@ -40,7 +40,7 @@ Every tool in `tools/`, and where the REST session comes from. Moved out of SKIL
40
40
  | `verify_dialog.py` | the modal in a real browser (1.0.9 and 1.0.10 alike: open is read as `:popover-open` or `dialog.open`): does it open, close, answer Esc, remember, cap - and does an OpenStreetMap carry the coordinates it was given |
41
41
  | `verify_popovers.py` | 1.0.10's popover in a real browser: opens, lands where its positioning says, blocks nothing, closes the way closedby says, flips, chains, and ends - every check reads `:popover-open`, never an attribute |
42
42
  | `verify_dialog_lab.py` | the question after "does the modal work": can three nodes be made into a bottom sheet, a side drawer, a corner notice, a full takeover and a gate with no way out - and does each one still fit at phone width, which the page's own width check cannot see |
43
- | `sync_nodes.py` | update a built site IN PLACE: matches the spec to the live master and each page's template by `attrID`, commits only the nodes whose data changed, rebuilds a page's template when its structure changed (one commit, or new tree first and old removed after in batches of 150), refuses a site split across masters or a document with two roots, saves every document's JSON before writing, re-reads and verifies after. Dry run unless `--apply`; `--attr a,b` limits the comparison and the writes to those subtrees. Before comparing it normalises what Mosaic rewrites on save (re-spaced CSS and colours, rewritten svg, keys a type does not keep, interaction ids, build_page's random list-item uuids) and leaves alone the children heal inserts (references/facts.md, third site). Read the dry run before `--apply`: it should list only what you changed. `build_site.py` makes a new master every run, so use this for any change to a site that is already built |
43
+ | `sync_nodes.py` | update a built site IN PLACE: matches the spec to the live master and each page's template by `attrID`, commits only the nodes whose data changed, rebuilds a page's template when its structure changed (one commit, or new tree first and old removed after in batches of 150), refuses a site split across masters or a document with two roots, saves every document's JSON before writing, re-reads and verifies after. Dry run unless `--apply`; `--attr a,b` limits the comparison and the writes to those subtrees. Before comparing it normalises what Mosaic rewrites on save (re-spaced CSS and colours, rewritten svg, keys a type does not keep, interaction ids, build_page's random list-item uuids) and leaves alone the children heal inserts (references/facts.md, third site). Interaction targets (`settings.target = {"type": "element", "uuid": ...}`) and any other reference to a spec node are rewritten to the live node's id before writing (spec `nodeID` -> attrID -> live id); a target that would name a node not in the document (or, for a template, its master) is refused before the commit and fails the run after it (exit 1). Read the dry run before `--apply`: it should list only what you changed. `build_site.py` makes a new master every run, so use this for any change to a site that is already built |
44
44
  | `list_bindings.php` | read only, `wp eval-file tools/list_bindings.php <themeID> > bindings.json`: which template and master serve each post (`wp_mosaic_template_assigns`, which the REST API does not list) - the input `sync_nodes.py` needs |
45
45
  | `verify_lightbox.py` | the WooCommerce product-image lightbox (PhotoSwipe) at 390 / 820 / 1024 / 1440px: close button flush with the toolbar's top-right corner, counter top-left, spinner out of the flow - WooCommerce's own skin breaks the first at 1024px and below (references/standard-fixes.md) |
46
46
  | `verify_sticky.py` | a sticky element while the page scrolls: rectangle intersection with every `--avoid` element at each step, never past its `--bound` container, actually stuck at `--top` - a computed `position: sticky` passes a column that rides over the whole page |
@@ -284,7 +284,7 @@ def as_button(el, ctx):
284
284
  if link.get("is_external"):
285
285
  data["target"] = "_blank"
286
286
  if link.get("nofollow"):
287
- data["rel"] = "nofollow"
287
+ data["rel"] = ["nofollow"] # a list; a string is dropped on save
288
288
  node = {"type": "button", "data": data,
289
289
  "children": inline_children(s.get("text") or s.get("button_text") or "")}
290
290
  extra = {}
@@ -440,7 +440,7 @@ class Ctx:
440
440
  if link.get("is_external"):
441
441
  data["target"] = "_blank"
442
442
  if link.get("nofollow"):
443
- data["rel"] = "nofollow"
443
+ data["rel"] = ["nofollow"] # a list; a string is dropped on save
444
444
  return {"type": "menu-link", "data": data, "children": [node]}
445
445
 
446
446
  def note(self, el, why):
@@ -95,7 +95,8 @@ def _inline(nodes):
95
95
  if attrs.get("target") in ("_self", "_blank", "_parent", "_top"):
96
96
  data["target"] = attrs["target"]
97
97
  if attrs.get("rel"):
98
- data["rel"] = attrs["rel"]
98
+ # a list: rel's validator is ValidatorArray, a string is dropped on save
99
+ data["rel"] = attrs["rel"].split()
99
100
  out.append({"type": "wysiwyg-link", "data": data, "children": _inline(kids)})
100
101
  elif tag in SPAN_STYLE:
101
102
  out.append({"type": "wysiwyg-span", "data": {},
@@ -18,7 +18,9 @@ What this does, per document (the shared master, and each page's own template):
18
18
  is written to compute them - and matches spec nodes to live nodes by `attrID`
19
19
  (nodes without one by their position under the nearest node that has one);
20
20
  3. same structure, different content -> one commit to that document updating only
21
- the nodes that differ (each node's top-level data keys the spec sets);
21
+ the nodes that differ (each node's top-level data keys the spec sets), with every
22
+ spec node id inside the written data - an interaction's target above all -
23
+ rewritten to the id of the live node it was matched to;
22
24
  4. different structure in a PAGE -> that page's template is rebuilt in ONE commit
23
25
  (old nodes deleted and new ones created together, so the page is never served
24
26
  empty), on the master it already has. A structural change in the master's header
@@ -27,9 +29,11 @@ What this does, per document (the shared master, and each page's own template):
27
29
  Safety: dry run unless --apply. Before writing, every document it will touch is
28
30
  saved as JSON under --backup (a restore source; also take `wp db export` of
29
31
  wp_mosaic_nodes on the host). It refuses a site whose pages sit on more than one
30
- master. After writing it re-reads each document: no extra root, no component
31
- instance newly reduced to override shells, and the diff now empty - otherwise
32
- exit 1. It writes only through the editor's REST routes (an admin request), never
32
+ master. Before a commit, every element target in it must name a node of the
33
+ document (or of the master, for a template). After writing it re-reads each
34
+ document: no extra root, no component instance newly reduced to override shells,
35
+ no written node targeting a node that does not exist, and the diff now empty -
36
+ otherwise exit 1. It writes only through the editor's REST routes (an admin request), never
33
37
  from a front-end render. Pages that use components can be content-synced but not
34
38
  rebuilt here (their overrides need build_site.py's override pass).
35
39
 
@@ -76,6 +80,11 @@ UUID_RE = re.compile(r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]
76
80
  TAG_RE = re.compile(r"<([A-Za-z][\w:.-]*)((?:\s+[^\s=>/]+(?:\s*=\s*(?:\"[^\"]*\"|'[^']*'|[^\s>]+))?)*)\s*(/?)>")
77
81
  ATTR_RE = re.compile(r"([^\s=>/]+)(?:\s*=\s*(\"[^\"]*\"|'[^']*'|[^\s>]+))?")
78
82
  COLOR_FN_RE = re.compile(r"^\s*(?:rgba?|hsla?)\(", re.I)
83
+ LEAD_DOT_RE = re.compile(r"(?<![\w.])\.(\d)")
84
+ URL_ARG_RE = re.compile(r"url\((\"?)([^\")]*)\1\)")
85
+ NUMBERISH_RE = re.compile(r"^[-+]?(?:\d*\.)?\d+[a-z%]*$", re.I)
86
+ # Text keys: words, not values; .35 inside a sentence is left alone.
87
+ TEXT_KEYS = {"text", "v", "url", "alt", "title", "label", "placeholder"}
79
88
  # Data keys a node type does not keep: sent, accepted, and stored as null (button and
80
89
  # menu-link `attributes`, a form label's `forInput`, tabs-menu `accessibleLabel`;
81
90
  # measured 2026-11-21). Compared only when the site does hold a value for them.
@@ -114,8 +123,15 @@ def css_norm(text: str) -> str:
114
123
  # the spaces around them are significant.
115
124
  text = (text or "").replace("'", '"')
116
125
  text = re.sub(r"\s+", " ", text).strip()
117
- text = re.sub(r"\s*([:;,{}()/])\s*", r"\1", text)
118
- return text.rstrip(";")
126
+ text = re.sub(r"\s*([:;,{}()/!>])\s*", r"\1", text)
127
+ text = re.sub(r";+", ";", text)
128
+ text = URL_ARG_RE.sub(lambda m: 'url("%s")' % m.group(2), text) # url(x) is stored as url("x")
129
+ return lead_zero(text).rstrip(";")
130
+
131
+
132
+ def lead_zero(text: str) -> str:
133
+ """.35 and 0.35 are the same number; Mosaic stores 0.35 for a style value of .35."""
134
+ return LEAD_DOT_RE.sub(r"0.\1", text)
119
135
 
120
136
 
121
137
  def svg_norm(text: str) -> str:
@@ -138,6 +154,68 @@ def svg_norm(text: str) -> str:
138
154
  return re.sub(r">\s+<", "><", re.sub(r"\s+", " ", text)).strip()
139
155
 
140
156
 
157
+ def remap_ids(value, id_map: dict):
158
+ """A copy of a spec data value with every spec node id replaced by the live id of the
159
+ node it was matched to. refresh_node_ids gives each pinned nodeID a NEW random uuid on
160
+ every run, and an interaction's `settings.target = {"type": "element", "uuid": ...}`
161
+ carries that uuid; written as is, the target names a node that is not on the site and
162
+ the animation silently does nothing (live site, 2026-11-25: three elements stopped)."""
163
+ def walk(v):
164
+ if isinstance(v, dict):
165
+ return {(id_map.get(k.lower(), k) if isinstance(k, str) else k): walk(x) for k, x in v.items()}
166
+ if isinstance(v, list):
167
+ return [walk(x) for x in v]
168
+ if isinstance(v, str):
169
+ return id_map.get(v.lower(), v)
170
+ return v
171
+ return walk(value)
172
+
173
+
174
+ def id_strings(value) -> set:
175
+ """Every string (and dict key) in a value, lower-cased: to find spec ids left in it."""
176
+ out = set()
177
+
178
+ def walk(v):
179
+ if isinstance(v, dict):
180
+ for k, x in v.items():
181
+ if isinstance(k, str):
182
+ out.add(k.lower())
183
+ walk(x)
184
+ elif isinstance(v, list):
185
+ for x in v:
186
+ walk(x)
187
+ elif isinstance(v, str):
188
+ out.add(v.lower())
189
+ walk(value)
190
+ return out
191
+
192
+
193
+ def element_targets(value) -> list[str]:
194
+ """The node ids a value points at: every {"type": "element", "uuid": <id>}."""
195
+ out = []
196
+
197
+ def walk(v):
198
+ if isinstance(v, dict):
199
+ t = v.get("target")
200
+ if isinstance(t, dict) and t.get("type") == "element" and isinstance(t.get("uuid"), str):
201
+ out.append(t["uuid"])
202
+ for x in v.values():
203
+ walk(x)
204
+ elif isinstance(v, list):
205
+ for x in v:
206
+ walk(x)
207
+ walk(value)
208
+ return out
209
+
210
+
211
+ def dangling_targets(nodes: list[dict], also=()) -> list[tuple[dict, str]]:
212
+ """(node, target id) for every element target that is not a live node of this document
213
+ (or of `also`: the master's node ids, for a template)."""
214
+ known = {n["ID"].lower() for n in nodes if n.get("status") != "delete"} | {x.lower() for x in also}
215
+ return [(n, t) for n in nodes if n.get("status") != "delete"
216
+ for t in element_targets(n.get("data") or {}) if t.lower() not in known]
217
+
218
+
141
219
  def normalise(value, id_map: dict, stable: set, key=None):
142
220
  """A comparable copy of one data value: spec node ids mapped to live ones, run-random
143
221
  uuids renamed in order of appearance, CSS and SVG text normalised."""
@@ -174,7 +252,9 @@ def normalise(value, id_map: dict, stable: set, key=None):
174
252
  if key == "svg":
175
253
  return svg_norm(v)
176
254
  if COLOR_FN_RE.match(v): # rgba(0, 0, 0, 0) is stored for rgba(0,0,0,0)
177
- return re.sub(r"\s+", "", v)
255
+ return lead_zero(re.sub(r"\s+", "", v))
256
+ if key not in TEXT_KEYS and NUMBERISH_RE.match(v.strip()):
257
+ return lead_zero(v.strip()) # opacity ".35" is stored as "0.35"
178
258
  return u(v)
179
259
  return v
180
260
  return walk(value, key)
@@ -274,13 +354,19 @@ def plan(spec_records: list[dict], spec_top: str, live_nodes: list[dict], live_t
274
354
  if struct:
275
355
  return False, struct, updates, notes
276
356
  id_map = {s["ID"].lower(): l["ID"].lower() for s, l, _, _ in pairs}
357
+ write_map = {s["ID"].lower(): l["ID"] for s, l, _, _ in pairs}
358
+ unmatched = {r["ID"].lower() for r in spec_records} - set(id_map)
277
359
  stable = stable_uuids() | {v.lower() for v in VAR_IDS.values()} | {l["ID"].lower() for _, l, _, _ in pairs}
278
360
  for s, l, key, anc in pairs:
279
361
  if not inside(key, anc):
280
362
  continue
281
363
  sd, ld = s.get("data") or {}, l.get("data") or {}
364
+ if isinstance(sd.get("rel"), str) and ld.get("rel") in (None, [], ""):
365
+ notes.append("%s: rel %r is a string - Mosaic keeps rel only as a list (%r); not counted"
366
+ % (key, sd["rel"], sd["rel"].split()))
282
367
  changed = [k for k in sd
283
368
  if not (k in DROPPED_ON_SAVE and ld.get(k) in (None, [], ""))
369
+ and not (k == "rel" and isinstance(sd[k], str) and ld.get(k) in (None, [], ""))
284
370
  and json.dumps(normalise(sd[k], id_map, stable, k), sort_keys=True)
285
371
  != json.dumps(normalise(ld.get(k), id_map, stable, k), sort_keys=True)]
286
372
  extra_keys = [k for k in ld if k not in sd]
@@ -288,8 +374,17 @@ def plan(spec_records: list[dict], spec_top: str, live_nodes: list[dict], live_t
288
374
  notes.append("%s keeps live-only keys %s" % (key, ", ".join(extra_keys)))
289
375
  if changed:
290
376
  merged = dict(ld)
291
- merged.update({k: sd[k] for k in changed})
377
+ # spec node ids -> live ids, so an interaction target names the node that is
378
+ # actually on the site, not this run's random uuid
379
+ merged.update({k: remap_ids(sd[k], write_map) for k in changed})
380
+ lost = id_strings({k: merged[k] for k in changed}) & unmatched
381
+ if lost:
382
+ struct.append("%s: %s points at spec node(s) not on the site (%s) - a target "
383
+ "outside --attr that does not exist yet?" % (key, ", ".join(changed), ", ".join(sorted(lost))[:80]))
384
+ continue
292
385
  updates.append((dict(l, _key=key), merged, changed))
386
+ if struct:
387
+ return False, struct, [], notes
293
388
  return True, struct, updates, notes
294
389
 
295
390
 
@@ -348,6 +443,7 @@ class Run:
348
443
  self.batch, self.pause = max(1, batch), max(0.0, pause)
349
444
  self.failed = False
350
445
  self.wrote = 0
446
+ self._master_ids: dict[str, set] = {}
351
447
 
352
448
  def commit_batches(self, instance: str, what: str, key: str, records: list[dict], label: str) -> bool:
353
449
  """Commit in batches of self.batch records: one request carrying ~420 deletes was
@@ -371,6 +467,14 @@ class Run:
371
467
  return False
372
468
  return True
373
469
 
470
+ def master_ids(self, master_id: str) -> set:
471
+ """The master's node ids: a template's interaction may target a header node."""
472
+ if master_id not in self._master_ids:
473
+ doc = self.read("masterDocumentInstance/%s" % master_id, "masterDocumentInstance")
474
+ self._master_ids[master_id] = {n["ID"] for n in doc.get("node/master/%s" % master_id) or []
475
+ if n.get("status") != "delete"}
476
+ return self._master_ids[master_id]
477
+
374
478
  def read(self, instance: str, what: str) -> dict:
375
479
  return unwrap(self.client.get(instance), what)
376
480
 
@@ -390,12 +494,44 @@ class Run:
390
494
  self.wrote += 1
391
495
  return True
392
496
 
393
- def verify(self, instance: str, what: str, key: str, before_shells: int, recheck) -> None:
497
+ def targets_ok(self, label: str, records: list[dict], live_ids: set, also=()) -> bool:
498
+ """Before a commit: every element target in what is about to be written names a
499
+ node that will exist (live, or created in this same write)."""
500
+ known = {x.lower() for x in live_ids} | {x.lower() for x in also}
501
+ known |= {r["newRevisionRecord"]["ID"].lower() for r in records
502
+ if r["newRevisionRecord"].get("status") != "delete"}
503
+ known -= {r["newRevisionRecord"]["ID"].lower() for r in records
504
+ if r["newRevisionRecord"].get("status") == "delete"}
505
+ bad = [(r["newRevisionRecord"], t) for r in records if r["newRevisionRecord"].get("status") != "delete"
506
+ for t in element_targets(r["newRevisionRecord"].get("data") or {}) if t.lower() not in known]
507
+ for n, t in bad[:8]:
508
+ print(" REFUSE %s: %s targets %s, which is not on the site" % (label, (n.get("data") or {}).get("attrID") or n["ID"][:8], t))
509
+ if bad:
510
+ self.failed = True
511
+ return not bad
512
+
513
+ def verify(self, instance: str, what: str, key: str, before_shells: int, recheck,
514
+ wrote=(), also=()) -> None:
394
515
  doc = self.read(instance, what)
395
516
  nodes = doc.get(key) or []
396
517
  if extra_roots(nodes):
397
518
  print(" FAIL %s now has more than one root" % what)
398
519
  self.failed = True
520
+ # The data diff alone can miss a target that points nowhere (both sides can carry
521
+ # an id that is not a node), so every element target is checked against the
522
+ # document's node ids (and the master's, for a template).
523
+ wrote = {x.lower() for x in wrote}
524
+ mine, older = [], []
525
+ for n, t in dangling_targets(nodes, also):
526
+ (mine if n["ID"].lower() in wrote else older).append((n, t))
527
+ for n, t in mine[:8]:
528
+ print(" FAIL %s: %s targets %s - no such node in the document"
529
+ % (what, (n.get("data") or {}).get("attrID") or n["ID"][:8], t))
530
+ if mine:
531
+ self.failed = True
532
+ for n, t in older[:8]:
533
+ print(" note %s: %s (not written by this run) targets %s - no such node"
534
+ % (what, (n.get("data") or {}).get("attrID") or n["ID"][:8], t))
399
535
  after = all_shell_instances(nodes)
400
536
  if after > before_shells:
401
537
  print(" FAIL %s: %d component instance(s) newly reduced to override shells - restore from %s"
@@ -447,11 +583,13 @@ def sync_shell(run: Run, site: dict, master_id: str, surface, comps) -> None:
447
583
  print(" update %s %s (%s)" % (ln["_key"], ln["type"], ", ".join(changed)))
448
584
  if not (updates and run.apply):
449
585
  return
450
- print(" backup %s" % run.save(label, doc))
451
586
  before = all_shell_instances(nodes)
452
587
  records = [{"newRevisionRecord": {k: v for k, v in dict(ln, data=merged).items() if not k.startswith("_")},
453
588
  "originalRevisionRecord": {k: v for k, v in ln.items() if not k.startswith("_")}}
454
589
  for ln, merged, _ in updates]
590
+ if not run.targets_ok(label, records, {n["ID"] for n in nodes if n.get("status") != "delete"}):
591
+ return
592
+ print(" backup %s" % run.save(label, doc))
455
593
  if run.commit_batches(instance, "masterDocumentInstance", key, records, label):
456
594
  def recheck(new_nodes):
457
595
  left = []
@@ -460,7 +598,8 @@ def sync_shell(run: Run, site: dict, master_id: str, surface, comps) -> None:
460
598
  same, struct, ups, _ = plan(recs, "SPEC-TOP", new_nodes, region_parent[region], run.attrs)
461
599
  left += struct + ["%s differs" % u[0]["_key"] for u in ups]
462
600
  return left
463
- run.verify(instance, "masterDocumentInstance", key, before, recheck)
601
+ run.verify(instance, "masterDocumentInstance", key, before, recheck,
602
+ wrote={r["newRevisionRecord"]["ID"] for r in records})
464
603
 
465
604
 
466
605
  def sync_page(run: Run, page: dict, binding: dict, surface, comps) -> None:
@@ -490,10 +629,13 @@ def sync_page(run: Run, page: dict, binding: dict, surface, comps) -> None:
490
629
  print(" update %s %s (%s)" % (ln["_key"], ln["type"], ", ".join(changed)))
491
630
  if not (updates and run.apply):
492
631
  return
493
- print(" backup %s" % run.save(label, doc))
494
632
  records = [{"newRevisionRecord": {k: v for k, v in dict(ln, data=merged).items() if not k.startswith("_")},
495
633
  "originalRevisionRecord": {k: v for k, v in ln.items() if not k.startswith("_")}}
496
634
  for ln, merged, _ in updates]
635
+ if not run.targets_ok(label, records, {n["ID"] for n in nodes if n.get("status") != "delete"},
636
+ run.master_ids(master_id)):
637
+ return
638
+ print(" backup %s" % run.save(label, doc))
497
639
  ok = run.commit_batches(instance, "templateDocumentInstance", key, records, label)
498
640
  else:
499
641
  print("%s: structure changed (%d difference(s)) - rebuild template %s on master %s"
@@ -519,6 +661,10 @@ def sync_page(run: Run, page: dict, binding: dict, surface, comps) -> None:
519
661
  deletes = [{"newRevisionRecord": dict(n, status="delete"), "originalRevisionRecord": n}
520
662
  for n in depth_order(old)]
521
663
  creates = [{"newRevisionRecord": r, "originalRevisionRecord": None} for r in new] # parents first
664
+ records = deletes + creates
665
+ if not run.targets_ok(label, records, {n["ID"] for n in nodes if n.get("status") != "delete"},
666
+ run.master_ids(master_id)):
667
+ return
522
668
  if len(deletes) + len(creates) <= run.batch:
523
669
  ok = run.commit(instance, doc, key, deletes + creates, label)
524
670
  how = "in one commit"
@@ -536,7 +682,8 @@ def sync_page(run: Run, page: dict, binding: dict, surface, comps) -> None:
536
682
  new_root = next((n for n in new_nodes if n["type"] == "template-internal" and n.get("status") != "delete"), None)
537
683
  s2, st2, ups2, _ = plan(r2, "SPEC-TOP", new_nodes, new_root["ID"] if new_root else "", run.attrs)
538
684
  return st2 + ["%s differs" % u[0]["_key"] for u in ups2]
539
- run.verify(instance, "templateDocumentInstance", key, before, recheck)
685
+ run.verify(instance, "templateDocumentInstance", key, before, recheck,
686
+ wrote={r["newRevisionRecord"]["ID"] for r in records}, also=run.master_ids(master_id))
540
687
  body = run.client.page(page["slug"])
541
688
  print(" page %s: %s, %d bytes" % (page["slug"], "OK" if len(body) >= MIN_HEALTHY_BYTES else "BROKEN", len(body)))
542
689
  if len(body) < MIN_HEALTHY_BYTES:
@@ -588,6 +588,89 @@ class SyncNodesPlan(unittest.TestCase):
588
588
  self.assertNotEqual(self.sn.svg_norm('<svg a="1"><path d="M0"/></svg>'),
589
589
  self.sn.svg_norm('<svg a="1"><path d="M1"/></svg>'))
590
590
 
591
+ # 2026-11-25, live site: a sync of a changed intro animation wrote run-random uuids
592
+ # into settings.target, so three animated elements pointed at nodes that do not exist
593
+ def opener_spec(self, duration):
594
+ t = self.rich_tree()
595
+ opener = t["children"][-1]
596
+ opener["data"]["interactions"][0]["settings"]["duration"] = duration
597
+ return t
598
+
599
+ def test_interaction_target_is_written_as_the_live_id(self):
600
+ live = self.as_stored(self.flat(self.opener_spec(300), "L"))
601
+ btn = next(n for n in live if (n.get("data") or {}).get("attrID") == "r-btn")
602
+ same, struct, updates, _ = self.sn.plan(self.flat(self.opener_spec(900), "S"), "S", live, "L")
603
+ self.assertTrue(same, struct)
604
+ self.assertEqual([(u[0]["data"].get("attrID"), u[2]) for u in updates], [("r-opener", ["interactions"])])
605
+ merged = updates[0][1]
606
+ self.assertEqual(self.sn.element_targets(merged), [btn["ID"]])
607
+ # and the document after that write has no dangling target
608
+ after = [dict(n, data=merged) if n["ID"] == updates[0][0]["ID"] else n for n in live]
609
+ self.assertEqual(self.sn.dangling_targets(after), [])
610
+
611
+ def test_the_old_write_left_a_dangling_target_and_is_caught(self):
612
+ # what 1.41.0 wrote: the spec's value as is - its target is this run's random uuid
613
+ live = self.as_stored(self.flat(self.opener_spec(300), "L"))
614
+ spec = self.flat(self.opener_spec(900), "S")
615
+ raw = next(r for r in spec if (r.get("data") or {}).get("attrID") == "r-opener")["data"]["interactions"]
616
+ after = [dict(n, data=dict(n["data"], interactions=raw))
617
+ if (n.get("data") or {}).get("attrID") == "r-opener" else n for n in live]
618
+ bad = self.sn.dangling_targets(after)
619
+ self.assertEqual(len(bad), 1)
620
+ self.assertEqual(bad[0][0]["data"]["attrID"], "r-opener")
621
+ # a target in the master counts as present for a template
622
+ self.assertEqual(self.sn.dangling_targets(after, also={bad[0][1]}), [])
623
+
624
+ def test_target_to_a_node_outside_attr_that_is_not_on_the_site_is_refused(self):
625
+ live = self.as_stored(self.flat(self.opener_spec(300), "L"))
626
+ spec = self.opener_spec(900)
627
+ spec["children"][4]["data"]["attrID"] = "r-btn-renamed" # the target is not on the site
628
+ same, struct, updates, _ = self.sn.plan(self.flat(spec, "S"), "S", live, "L", {"r-opener"})
629
+ self.assertFalse(same)
630
+ self.assertEqual(updates, [])
631
+ self.assertTrue(any("not on the site" in s for s in struct), struct)
632
+
633
+ def test_run_refuses_a_write_with_a_dangling_target(self):
634
+ run = self.sn.Run(None, True, "unused")
635
+ rec = {"newRevisionRecord": {"ID": "n1", "data": {"interactions": [
636
+ {"settings": {"target": {"type": "element", "uuid": "nowhere"}}}]}}, "originalRevisionRecord": None}
637
+ import contextlib
638
+ import io
639
+ with contextlib.redirect_stdout(io.StringIO()):
640
+ self.assertFalse(run.targets_ok("t", [rec], {"a", "b"}))
641
+ self.assertTrue(run.failed)
642
+ run2 = self.sn.Run(None, True, "unused")
643
+ self.assertTrue(run2.targets_ok("t", [rec], {"nowhere"}))
644
+
645
+ def test_stored_rewrites_are_not_differences(self):
646
+ # 2026-11-25, live site: opacity ".35" is stored "0.35"; url(x) as url("x");
647
+ # rgba(...,.85) keeps or drops its zero
648
+ self.assertEqual(self.sn.css_norm("mask:url(/a.webp) center/contain;transition:opacity .2s"),
649
+ self.sn.css_norm('mask: url("/a.webp") center / contain;\ntransition: opacity 0.2s;'))
650
+ self.assertEqual(self.sn.css_norm("color:red!important;;"), self.sn.css_norm("color: red !important;"))
651
+ n = lambda v, k="opacity": self.sn.normalise(v, {}, set(), k)
652
+ self.assertEqual(n(".35"), n("0.35"))
653
+ self.assertEqual(n("rgba(255,255,255,.85)", "color"), n("rgba(255, 255, 255, 0.85)", "color"))
654
+ self.assertNotEqual(n(".35"), n("0.36"))
655
+ self.assertNotEqual(n("Price .35", "text"), n("Price 0.35", "text")) # words are not values
656
+
657
+ def test_string_rel_is_not_a_difference_but_a_list_is_written(self):
658
+ # measured on the demo (1.0.14, 2026-11-25): rel "noopener" is stored as null,
659
+ # ["noopener"] is kept (rel's validator is ValidatorArray)
660
+ def tree(rel):
661
+ return {"type": "text", "data": {"attrID": "l-root"}, "children": [
662
+ {"type": "wysiwyg-link", "data": {"attrID": "l-a", "url": "/a/", "rel": rel},
663
+ "children": [{"type": "wysiwyg-text", "data": {"text": "a"}}]}]}
664
+ live = self.flat(tree(None), "L")
665
+ same, _, updates, notes = self.sn.plan(self.flat(tree("noopener"), "S"), "S", live, "L")
666
+ self.assertEqual(updates, [])
667
+ self.assertTrue(any("only as a list" in x for x in notes), notes)
668
+ same, _, updates, _ = self.sn.plan(self.flat(tree(["noopener"]), "S"), "S", live, "L")
669
+ self.assertEqual([u[2] for u in updates], [["rel"]])
670
+ import inline_html
671
+ link = inline_html.inline_children('<a href="/x/" rel="noopener nofollow">x</a>')[0]
672
+ self.assertEqual(link["data"]["rel"], ["noopener", "nofollow"])
673
+
591
674
  def test_override_shell_counter(self):
592
675
  shell = {"parentType": "override", "parentID": "I", "status": "publish",
593
676
  "data": {"override": {"originalID": "X"}}}