Conversation
…AST analysis via css-tree, linkedom, and oxc-parser
paulirish
commented
Mar 27, 2026
| // Static checks | ||
| test('Static: Implementation must use JS class toggling for fallback', async () => { | ||
| const html = fs.readFileSync(filePath, 'utf-8'); | ||
| expect(html).toMatch(/classList\.(toggle|add|remove)/); |
Member
Author
There was a problem hiding this comment.
imo this one is a big regression in usability.
| test('Legacy ::-webkit-scrollbar has width or height defined for visibility', async () => { | ||
| const html = fs.readFileSync(filePath, 'utf-8'); | ||
| // We check for width or height inside the @supports block to ensure it's part of the correctly implemented fallback | ||
| const legacySizingMatch = html.match(/@supports\s+not\s*\(\s*scrollbar-color\s*:\s*auto\s*\)\s*{[^}]*::-webkit-scrollbar\s*{[^}]*(width|height)\s*:/s); |
Member
Author
There was a problem hiding this comment.
both of these are yuck
|
|
||
| test('scrollbar-gutter: stable is used in CSS', async () => { | ||
| const html = fs.readFileSync(filePath, 'utf-8'); | ||
| expect(html).toMatch(/scrollbar-gutter\s*:\s*stable/); |
Member
Author
There was a problem hiding this comment.
here the new csstree one aint too bad.
and the two right above seem fine too.
…ng by generative AI
Member
Author
|
@micahjo7 wdyt |
micahjo7
reviewed
Mar 31, 2026
|
|
||
| Using template.grader.ts as a framework, write a Playwright test script that directly models the expectations.md requirements. | ||
| You should generate both functional and browser tests, with each test containing only one assertion. | ||
| You should generate both static tests and browser tests, with each test containing only one assertion. |
Collaborator
There was a problem hiding this comment.
we could probably just remove this line
Collaborator
|
this sounds like a great idea! |
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.
Background & Motivation:
Our Playwright-based graders occasionally suffer from intermittent flakiness and slower execution times when spinning up browsers just to assert basic DOM structure or stylesheet attributes. This PR is a major refactor aimed at heavily utilizing static analysis across our grader suite instead of relying solely on browser automation.
linkedomfor blazing fast headless DOM querying.css-treefor CSS AST traversal and@ruleanalysis.ts-morphfor Javascript static evaluation (via a fluent, easy-to-read DOM-like syntax).grader-gen.tsto instruct our AI agent to prioritize these static parsers going forward, complete with hardcoded paths to their.d.tsdefinitions in case the agent needs API hints.The Good:
oxc-parserfelt way too verbose and unmaintainable for simple JS assertions. However, after swappingoxc-parserout forts-morph, the DX and readability are good. good enough that we could keep it as part of the story.The Questionable:
the css-tree blocks mostly are bad. regex isn't better though. i want a cssom approach i think. and tbh linkedom depends on one. maybe there's something there...