Skip to content

fix(turbopack): remove unpure selector err report & invalid selector err#71

Merged
fireairforce merged 1 commit intoutoofrom
remove-err-msg
Nov 6, 2025
Merged

fix(turbopack): remove unpure selector err report & invalid selector err#71
fireairforce merged 1 commit intoutoofrom
remove-err-msg

Conversation

@fireairforce
Copy link
Member

@gemini-code-assist
Copy link

Summary of Changes

Hello @fireairforce, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request aims to refine the error handling within Turbopack's CSS processing, specifically addressing issues related to selector parsing errors. By suppressing certain error reports and broadly ignoring SelectorError instances, the changes prevent potentially misleading or unnecessary error messages from being displayed, improving the robustness and user experience of the CSS compilation process.

Highlights

  • Error Reporting Suppression: The pull request disables the reporting of 'unpure selector' errors that were previously generated by the CssValidator.
  • Broader Selector Error Ignoring: The error handling logic has been updated to ignore all types of lightningcss::error::ParserError::SelectorError during both warning processing and initial CSS parsing, rather than just specific pseudo-class errors like :global.
  • Unused Code Annotation: The report function within CssError has been marked with #[allow(unused)], indicating that the specific error reporting path for CssSelectorInModuleNotPure is no longer actively used due to the other changes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@fireairforce fireairforce merged commit 369a1ab into utoo Nov 6, 2025
11 of 24 checks passed
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request disables error reporting for 'unpure' and invalid CSS selectors in Turbopack. While this may resolve the immediate issues, the changes are quite broad and could have unintended side effects. Specifically, all selector-related errors and warnings from lightningcss are now being silenced, which could hide legitimate bugs from developers and make debugging difficult. Additionally, some code related to selector validation is now dead and should be removed rather than commented out or suppressed with #[allow(unused)].

lightningcss::error::SelectorError::UnsupportedPseudoClass(name),
) if name.as_ref() == "global" => {
// Ignore all SelectorError errors
lightningcss::error::ParserError::SelectorError(..) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This change now ignores all SelectorError warnings. While this may be intended to handle specific cases (like with CSS preprocessors), this is a very broad change that could hide legitimate selector issues from developers. This might make debugging CSS unexpectedly difficult. If possible, it would be safer to only ignore the specific selector errors that are causing problems, rather than all of them.

Comment on lines +543 to +545
if matches!(e.kind, lightningcss::error::ParserError::SelectorError(..)) {
return Ok(ParseCssResult::Unparsable.cell());
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Silently ignoring all SelectorError parsing errors and marking the file as unparsable could lead to a poor developer experience. Developers won't receive any feedback on why their CSS file is failing to parse, which could make debugging very difficult. Consider at least adding a debug! level log here to record the suppressed error, so that the information is not completely lost when troubleshooting.

Comment on lines 459 to +465
let mut validator = CssValidator { errors: Vec::new() };
ss.visit(&mut validator).unwrap();

for err in validator.errors {
err.report(source);
}
// TODO: remove pure selector
// for err in validator.errors {
// err.report(source);
// }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Instead of commenting out the error reporting, it would be cleaner to remove the now-unused code. Since the errors from CssValidator are no longer reported, the instantiation and use of CssValidator on lines 459-460 appear to be dead code and can be removed along with the commented-out loop.

}

impl CssError {
#[allow(unused)]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While #[allow(unused)] silences the compiler warning, the underlying issue is that the report function, and likely the entire CssError enum, are no longer used after the changes in this PR. To improve maintainability, it would be better to remove the CssError enum and its impl block entirely, as they seem to be dead code now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant