openpencil/apps
Fini 364a722c77 test(ai): extract Type 0 unwrap predicate as pure helper + 10 tests
Why: dd8eb0eb's unwrap pass (Type 0 single-component section root
hoist) was integration-tested via the live Playwright run but had no
unit coverage. The integration test won't catch regressions when
someone tightens the heuristics — and the load-bearing "do nothing"
guards (multi-section, mobile screen, desktop, 0/N children, non-frame
child) are exactly where a careless edit would silently flatten a
multi-page design.

What: split the helper into two — a pure predicate
shouldUnwrapSingleComponentSectionRoot(plan, root) returning bool, and
the existing unwrapSingleComponentSectionRoot(rootNodes, plan) which
calls the predicate then mutates the store. Predicate is exported.

10 new tests cover:
- 3 positive: wrapper id ends -root / wrapper id ends -section /
  wrapper name copies parent name
- 7 negative load-bearing guards: multi-section plan, mobile screen
  (height >= 480), desktop (width > 480), root with 0 children, root
  with multi children, wrapper with no children, wrapper with
  unrelated id+name, wrapper is non-frame (text / icon)

1080 / 1080 AI tests pass (was 1070; +10).
2026-05-09 21:22:00 +08:00
..
cli Merge origin/v0.8.0 into feat/rust-ification 2026-05-03 21:00:00 +08:00
desktop Merge origin/v0.8.0 into feat/rust-ification 2026-05-03 21:00:00 +08:00
web test(ai): extract Type 0 unwrap predicate as pure helper + 10 tests 2026-05-09 21:22:00 +08:00