Skip to content

fix(check): skip exported config for formatters when workspace file exists#2711

Open
marschattha wants to merge 2 commits intomainfrom
ma/fix-formatter-exported-config-precedence
Open

fix(check): skip exported config for formatters when workspace file exists#2711
marschattha wants to merge 2 commits intomainfrom
ma/fix-formatter-exported-config-precedence

Conversation

@marschattha
Copy link
Copy Markdown
Member

@marschattha marschattha commented Mar 3, 2026

Summary

  • For formatters, the exported config was always symlinked into the staging area (since it starts empty), ignoring any pre-existing file in the workspace root
  • This was inconsistent with linter behavior, where a pre-existing workspace file takes precedence
  • Now checks if the file exists in the workspace root before symlinking the exported config, so the workspace file wins for both linters and formatters

Test plan

  • Typecheck, format, and lint all pass
  • Tests pass

🤖 Generated with Claude Code

@qltysh
Copy link
Copy Markdown
Contributor

qltysh bot commented Mar 3, 2026

Qlty

Coverage Impact - ubuntu-latest

⬆️ Merging this pull request will increase total coverage on main by 0.04%.

Modified Files with Diff Coverage (1)

RatingFile% DiffUncovered Line #s
Coverage rating: B Coverage rating: B
qlty-check/src/executor.rs87.5%325
Total87.5%
🤖 Increase coverage with AI coding...

In the `ma/fix-formatter-exported-config-precedence` branch, add test coverage for this new code:

- `qlty-check/src/executor.rs` -- Line 325

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

Copy link
Copy Markdown
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 aligns config precedence behavior between linters and formatters by preventing exported formatter configs from being staged when an equivalent config file already exists in the workspace root.

Changes:

  • Detects an existing workspace-root config file corresponding to an exported config.
  • Skips symlinking exported configs into the staging area for formatters when the workspace file exists (so the workspace file should win).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@qltysh
Copy link
Copy Markdown
Contributor

qltysh bot commented Mar 3, 2026

Qlty

Coverage Impact - macos-15

⬆️ Merging this pull request will increase total coverage on main by 0.04%.

Modified Files with Diff Coverage (1)

RatingFile% DiffUncovered Line #s
Coverage rating: B Coverage rating: B
qlty-check/src/executor.rs87.5%325
Total87.5%
🤖 Increase coverage with AI coding...

In the `ma/fix-formatter-exported-config-precedence` branch, add test coverage for this new code:

- `qlty-check/src/executor.rs` -- Line 325

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@marschattha marschattha force-pushed the ma/fix-formatter-exported-config-precedence branch from df74cf5 to 806a384 Compare March 4, 2026 19:51
Copy link
Copy Markdown
Member

@noahd1 noahd1 left a comment

Choose a reason for hiding this comment

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

Not saying this is an issue per se .. but just wanting to understand:

  • if you previously were using formatting with a shared config, the shared config would win.
  • now, your local config file will win, and formatting may look different for you than previously
  • how does a customer know which config file "won" when these situations occur? Do we save it to any of our tables / output?

@marschattha
Copy link
Copy Markdown
Member Author

marschattha commented Mar 4, 2026

  • if you previously were using formatting with a shared config, the shared config would win.

Correct

  • now, your local config file will win, and formatting may look different for you than previously

Correct, if there is someone who has a shared config and repo based config that is different it can look different based on said config, and there is also the situation where a plugin has both linters and formatters, prior to this PR, formatter would be using the exported config and linter would be using the repo level config.

  • how does a customer know which config file "won" when these situations occur? Do we save it to any of our tables / output?

There is a lack of visibility there I believe since we added supported for a number of different options but haven't made it clear in one place, the debug logs can add some light to it I believe as it logs when it symlinks/copies files.

@marschattha marschattha requested a review from noahd1 March 4, 2026 21:30
Base automatically changed from ma/fix-exported-config-cleanup to main March 4, 2026 21:30
…xists

Load repository config files into the staging area before exported
configs so that workspace files take precedence. The existing
to.exists() guard in load_config_file_from naturally skips the
exported config when the workspace file is already present,
making formatter behavior consistent with linters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@marschattha marschattha force-pushed the ma/fix-formatter-exported-config-precedence branch from 806a384 to c5783fb Compare March 4, 2026 21:34
@marschattha marschattha marked this pull request as ready for review March 4, 2026 21:35
@noahd1
Copy link
Copy Markdown
Member

noahd1 commented Mar 4, 2026

  • how does a customer know which config file "won" when these situations occur? Do we save it to any of our tables / output?

There is a lack of visibility there I believe since we added supported for a number of different options but haven't made it clear in one place, the debug logs can add some light to it I believe as it logs when it symlinks/copies files.

So for some unknown subset of users who have both local configs and shared configs, all their PRs may start failing with formatting errors when a new config takes precedence where it hadn't previously. I think we may need to hold off on this change for the moment until we are wide eyed about the potential impact, even if it's the right change.

Copy link
Copy Markdown
Member

@brynary brynary left a comment

Choose a reason for hiding this comment

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

Can we please start with a test that would fail without this fix?

…r exported config

Verify that workspace config files take precedence over exported
config files for both linters and formatters. The test uses distinct
issue messages ("WORKSPACE" vs "EXPORTED") so a failure directly
indicates which plugin used the wrong config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

4 participants