openpencil/apps
Fini fef986098e fix(ai): heuristic image-area requires 0 children or icon_font child
Why: Codex stop-time review 2026-05-10 caught a content-erasure bug.
The b9b4126b heuristic accepted "0 or 1 children" with no type check,
so a hero frame named "Hero" with a single CTA button child matched.
Then the queue's update path (line 388-391 of processQueue) clears
\`children: []\` when the photo lands — destroying the legitimate CTA
button under it. Same risk for banners with sale text, covers with
nested frames, etc.

What: tighten the children clause in isImageAreaFrameByHeuristic. A
heuristic frame is now accepted only when:
  - children is undefined / not an array, OR
  - children.length === 0, OR
  - children.length === 1 AND children[0].type === 'icon_font'
    (the typical "broken image" placeholder hint).

Anything else — single non-icon child OR multiple children — means the
frame holds real content and the children:[] erase step would damage
the design. Such frames are now rejected by the heuristic and stay
unchanged on canvas.

3 new it() cases pin the rejection: hero+button, banner+text, and
cover+nested-frame all return false. Existing single-icon-child case
still passes. 38 / 38 tests in image-search-pipeline.test.ts (was 37;
+1; the rejection case adds 1 new it). 1110 / 1110 AI tests pass.
2026-05-09 20:59:53 +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 fix(ai): heuristic image-area requires 0 children or icon_font child 2026-05-09 20:59:53 +08:00