fix(ui): enforce Shadow DOM custom property contract (YPE-5400) - #394
fix(ui): enforce Shadow DOM custom property contract (YPE-5400)#394abharms wants to merge 4 commits into
Conversation
🦋 Changeset detectedLatest commit: f51fe2c The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
2b5f030 to
9bcb473
Compare
| inherits: false; | ||
| initial-value: 0s; | ||
| } | ||
| @property --uninitialized-input { |
There was a problem hiding this comment.
praise: Treating registrations without an initial value as inputs keeps this audit honest instead of mistaking syntax for a supplied runtime value.
For Agents: registration coverage
This focused test distinguishes an initialized
@property --registered-durationfrom@property --uninitialized-input, while also covering nested fallbacks and comment and string lookalikes.
Written by Code Reviewer bot on behalf of Cam.
| @@ -0,0 +1,111 @@ | |||
| import { parse, walk } from 'css-tree'; | |||
|
|
|||
| const referenceOnlyExceptions = new Map([ | |||
There was a problem hiding this comment.
suggestion: Could this allowlist be a grouped set? Its metadata is never read, and the rollout document already owns the same rationale.
For Agents: simplify the exception ledger
referenceOnlyExceptionsis only queried through.has(name). Replacing the map entries with aSetof the nine exact names and short group comments would remove roughly 35–40 lines and one duplicated source of explanatory text without weakening enforcement. The parser and compiled-artifact check should remain unchanged.
Written by Code Reviewer bot on behalf of Cam.
Summary
tw-animate-css, and Radix inputs--radiusdependencyverify:stylesand fail builds on unexplained reference-only custom propertiesRequirement evidence
--yv-*, supported light-DOM inputs, generated Tailwind state, compile-time theme aliases, Radix runtime inputs,tw-animate-cssfallbacks, and forbidden ambient names.--yv-*overrides are supported for light-DOM[data-yv-sdk]components, while the automatically isolatedYouVersionAuthButtongains no public shadow-root token API.--radiusdependency is removed. The separate inert VerseActionPopover animation-property behavior is linked and documented under YPE-5749.verify-styles.jsparsesdist/tailwind.csswithcss-tree, accepts only locally supplied names or nine exact reviewed exceptions, and fails on new unexplained references. Focused tests cover nested references, registrations, parser lookalikes, exact exceptions, and rejection.Review scope
Required outcomes:
Permitted support work:
css-treevalidator and adjacent declaration fileNon-goals:
Please treat a finding as blocking only when it identifies an unmet in-scope requirement, a documented repository-standard violation in added or modified code, or a concrete regression or defect caused or worsened by this diff. Label other valid improvements as non-blocking follow-ups.
Verification
pnpm --filter @youversion/platform-react-ui exec vitest run --project unit src/styles/custom-property-contract.test.ts src/components/ui/input-group.test.tsx— 3/3 passedpnpm --filter @youversion/platform-react-ui build— passed; compiled style verification reports zero unexplained referencespnpm lint— passedpnpm typecheck— passedpnpm turbo test --concurrency=1 -- --maxWorkers=1— passed: core 432/432, hooks 318/318, UI 543/543pnpm turbo build --force— passed, 4/4 build tasks uncached9bcb473— no required findingsThe default concurrent test invocation twice exposed existing five-second timeouts in
bible-reader-controlled.test.tsx; the affected file passed 33/33 in isolation and the complete sequential repository suite passed 1,293/1,293.Compatibility and limitations
--yv-radiusInputGroup selector remains.Jira
Greptile Summary
The PR establishes a compiled-stylesheet custom-property ownership guard for the UI package and documents the audited Shadow DOM contract.
css-tree-based audit of declarations, registrations, references, and exact runtime exceptions.--radiusinput, documents ownership and limitations, and records a UI patch release.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR Inputs[UI, core, Tailwind, and third-party CSS] --> Compile[Compile dist/tailwind.css] Compile --> Mutate[Preserve host revert-layer rule] Mutate --> Bundle[Embed compiled CSS in UI JavaScript] Mutate --> Audit[Parse custom-property declarations and references] Allowlist[Exact reviewed runtime exceptions] --> Audit Audit -->|No unexplained references| Verify[Style verification passes] Audit -->|Unexplained reference| Fail[Build fails]Reviews (4): Last reviewed commit: "test(ui): strengthen custom property con..." | Re-trigger Greptile
Context used: