openpencil/scripts/ab-corpus
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
..
__tests__ Merge origin/v0.8.0 into feat/rust-ification 2026-05-03 21:00:00 +08:00
clients Merge origin/v0.8.0 into feat/rust-ification 2026-05-03 21:00:00 +08:00
apply.ts Merge origin/v0.8.0 into feat/rust-ification 2026-05-03 21:00:00 +08:00
build-prompt.ts Merge origin/v0.8.0 into feat/rust-ification 2026-05-03 21:00:00 +08:00
inspect-contrast-hits.ts fix(ai): retune contrast thresholds to 2.5/2.0 — kill 35/41 false positives 2026-05-10 14:45:00 +08:00
inspect-issue-category.ts fix(ai): contrast detector skips effectively-transparent wrapper fills 2026-05-10 14:55:00 +08:00
inspect-shape.ts fix(ai): contrast detector skips effectively-transparent wrapper fills 2026-05-10 14:55:00 +08:00
measure-prompt-sizes.ts Merge origin/v0.8.0 into feat/rust-ification 2026-05-03 21:00:00 +08:00
real-model.ts Merge origin/v0.8.0 into feat/rust-ification 2026-05-03 21:00:00 +08:00
replay-detectors.ts fix(ai): retune contrast thresholds to 2.5/2.0 — kill 35/41 false positives 2026-05-10 14:45:00 +08:00
run.ts Merge origin/v0.8.0 into feat/rust-ification 2026-05-03 21:00:00 +08:00
stub-model.ts Merge origin/v0.8.0 into feat/rust-ification 2026-05-03 21:00:00 +08:00
write-report.ts Merge origin/v0.8.0 into feat/rust-ification 2026-05-03 21:00:00 +08:00