openpencil/scripts
Fini 5a841f011f fix(ai): contrast detector skips effectively-transparent wrapper fills
Codex stop-hook review caught: the detectTextBgContrast ancestor walk
treated any wrapper with a solid `fill` entry as the bg color, even
when the fill was effectively invisible. The classic miss case:

  page { fill: cream }
    └─ wrapper { fill: [{ type: 'solid', color: '#FFFFFF', opacity: 0 }] }
        └─ text { fill: cream }

Without the guard, the detector picked the wrapper's white fill as bg
and reported a healthy contrast ratio against the cream text — masking
the real cream-on-cream failure that lives one level up.

firstSolidColor() now skips fills with `opacity === 0` and 8-hex colors
whose alpha byte is `00` (e.g. `#FFFFFF00`). Both produce no visible
color, so the ancestor walk continues past them to the real bg.

Semi-transparent fills (opacity 0.5, 8-hex alpha 80, etc.) are out of
scope — the detector still treats them as opaque rather than trying to
math the layered composite. Tests pin both: opacity=0.5 + alpha=80
stay treated as bg.

4 new test cases cover the fix plus the boundary (opacity=0.5, alpha=80
should NOT be skipped). Full corpus replay shows 14 hits unchanged on
the 470-row corpus — no false-positive regression introduced.
2026-05-10 14:55:00 +08:00
..
ab-corpus fix(ai): contrast detector skips effectively-transparent wrapper fills 2026-05-10 14:55:00 +08:00
bundle-skill.ts V0.7.1 (#102) 2026-04-13 21:30:23 +08:00
ensure-agent-native.cjs fix(ci): always source-build agent-native and bundle to napi/ root 2026-04-26 19:20:48 +08:00
measure-v0-hex-coverage.ts Merge origin/v0.8.0 into feat/rust-ification 2026-05-03 21:00:00 +08:00
patch-srvx-bun.ts V0.7.3 (#111) 2026-04-15 22:19:12 +08:00
publish-beta.sh V0.7.0 (#95) 2026-04-11 23:25:13 +08:00
smoke-v1-pipeline.ts Merge feat/rust-ification into v0.8.0 (Step 0 Rust workspace bootstrap) 2026-05-04 21:00:00 +08:00
unpublish.sh V0.7.0 (#95) 2026-04-11 23:25:13 +08:00