fix: pr-bug-scan validated finding from #2437#2445
Open
buf0-bot[bot] wants to merge 1 commit into
Open
Conversation
Fixed jsxElementReports: spread className now overrides earlier explicit className (later wins); expressionHasStyledScrollbarLiteral skips conditional/short-circuit branches so a conditional scrollbar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated fix-PR from pr-bug-scan for parent #2437.
Fixer status:
FIXED_WITH_REPROSummary: Fixed jsxElementReports: spread className now overrides earlier explicit className (later wins); expressionHasStyledScrollbarLiteral skips conditional/short-circuit branches so a conditional scrollbar class no longer waives inline-style checks.
Blocked proof link:
config/scripts/styled-scrollbars/styled-scrollbar-jsx-check.mjs:248-260 (C1: ??= replaced with later-wins assignment) and :128-148 (C2: scrollbar literal walk now stops at conditional/&&/||/?? boundaries so it can't cover unconditional inline overflow)Typecheck:
skippedProof (from validator)
code_analysisclassName="scrollbar-sleek"followed by a spread attribute{...{ className: 'overflow-y-auto' }}— at runtime React's later spread overrides className, so the element renders withoverflow-y-autoand no scrollbar class.classExpression = jsxAttributeExpression(attribute), while spread branch doesclassExpression ??= spreadPropExpressions(...).at(-1)??=is a no-op once classExpression is already assigned by the earlier explicit classNamecode_analysis<div className={enabled && 'scrollbar-sleek'} style={{ overflowY: 'auto' }} />. Whenenabled === false, className is falsy and only the inlineoverflowY: 'auto'is applied, so the native scrollbar shows.enabled && 'scrollbar-sleek'expression; styleExpressions collects the inline{ overflowY: 'auto' }some(token in STYLED_SCROLLBAR_CLASSES)walk and returns true regardless of theenabled &&guardReproduction
node -e "import('/tmp/orca-bug-scan-wt/pr-2437-1779303893/config/scripts/styled-scrollbars/styled-scrollbar-jsx-check.mjs').then(m=>{console.log(m.reportUnstyledScrollbars('E.tsx',\"export function E(){return <div className=\\\"scrollbar-sleek\\\" {...{className:'overflow-y-auto'}}/>}\").length)})"Generated by
pr-bug-scan(proof-machine architecture). Human approval required before merge.