Skip to content

Comments

fix(ast_tools): run dprint twice#14723

Closed
overlookmotel wants to merge 1 commit intomainfrom
10-17-fix_ast_tools_run_dprint_twice
Closed

fix(ast_tools): run dprint twice#14723
overlookmotel wants to merge 1 commit intomainfrom
10-17-fix_ast_tools_run_dprint_twice

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Oct 17, 2025

dprint appears to be buggy, and in some cases requires 2 passes to reach a stable state. So run it twice.

This problem discovered in: #14637 (comment)

@github-actions github-actions bot added the A-ast-tools Area - AST tools label Oct 17, 2025
Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added the C-bug Category - Bug label Oct 17, 2025
@overlookmotel overlookmotel marked this pull request as ready for review October 17, 2025 10:49
Copilot AI review requested due to automatic review settings October 17, 2025 10:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses a bug in dprint where it requires two formatting passes to reach a stable output state. The changes refactor the format function to run dprint twice consecutively and improve error handling by separating the formatting logic into a dedicated dprint helper function.

Key Changes:

  • Run dprint twice to ensure stable formatting output
  • Extract dprint execution logic into a separate helper function that returns Result<Vec<u8>, String>
  • Improve error handling by consolidating error reporting in the main format function

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@overlookmotel
Copy link
Member Author

overlookmotel commented Oct 17, 2025

Running dprint twice has a cost, so we'll only merge this if we decide to go forwards with #14637. This problem only seems to occur in some rare cases.

@overlookmotel
Copy link
Member Author

We found a different workaround in #14637, so this is no longer needed.

@overlookmotel overlookmotel deleted the 10-17-fix_ast_tools_run_dprint_twice branch October 17, 2025 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast-tools Area - AST tools C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant