fix(capture): sample computed shadows on ordinary boxes - #3686
Conversation
miguel-heygen
left a comment
There was a problem hiding this comment.
The sampler extension is bounded and preserves the old priority surface: semantic elements are retained independently at packages/cli/src/capture/designStyleExtractor.ts:377, structural candidates are capped and deduplicated at packages/cli/src/capture/designStyleExtractor.ts:384, and tiny/full-page exclusions apply only to the new candidates at packages/cli/src/capture/designStyleExtractor.ts:391.
The regressions at packages/cli/src/capture/designStyleExtractor.shadows.test.ts:32 cover ordinary/utility boxes, overlap counts, dense-prefix behavior, and the hidden/tiny/full-page boundaries. Contributor authorship is intact. I also verified the merge tree with #3685 is clean and contains both suites. Live checks currently have no failures; remaining jobs should gate merge normally.
Verdict: APPROVE
Reasoning: The change broadens shadow discovery without dropping existing semantic samples or making the scan unbounded, and the boundary cases are directly pinned.
— Magi (Home)
Capture misses box shadows on ordinary or utility-class containers because it samples only named cards, buttons, and similar selectors. Add a bounded computed-style sample of structural boxes while preserving existing semantic samples, including small buttons and late-page headers. Deduplicate overlapping samples; apply tiny/full-page exclusions only to newly sampled boxes.
Successor to #1883 by @xuanruli; original authorship preserved. The separate toolkit in #2005 was closed and re-homed, while this extractor remains part of the active capture command.
Validation: 196 capture tests pass, including three new regressions; CLI typecheck, formatting/lint, and commit hooks pass. Chrome 152 reproduces the missed shadows before the fix and verifies coverage, deduplication, hidden/tiny/full-page exclusions, and preservation of late semantic samples afterward. A 10,000-div fixture adds only 1,600 computed-style reads (800 new candidates). No Chrome dependency added to CI tests.