-
Notifications
You must be signed in to change notification settings - Fork 259
fix: ensure consistent output messages regardless of cache state #2354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The caching mechanism was causing inconsistent output messages. When all targets were cached, the output would show "No modified files for checks were found on your branch" instead of "✔ No issues" as it does when using --no-cache. This fix tracks the total number of targets (both cached and uncached) throughout the pipeline to ensure the correct output message is displayed consistently, making the cache an implementation detail that doesn't affect user-visible output. Changes: - Add total_targets_count field to Plan, Planner, and Report structs - Calculate total targets from all driver planners (includes both cached and uncached) - Update Report::targets_count() to use the tracked total instead of computing from invocations - Update test in sarif.rs to include the new field 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
|
No issue mentions found. Please mention an issue in the pull request description. Use GitHub automation to close the issue when a PR is merged |
|
@noahd1 while I think the PR description is a bit off, I think the fix is correct to unify the behavior |
|
Diff Coverage for ubuntu-latest: The code coverage on the diff in this pull request is 100.0%. Total Coverage for ubuntu-latest: This PR will not change total coverage. File Coverage Changes
🛟 Help
|
|
Diff Coverage for macos-15: The code coverage on the diff in this pull request is 100.0%. Total Coverage for macos-15: This PR will not change total coverage. File Coverage Changes
🛟 Help
|
|
@claude resolve the merge conflicts. Cargo.lock is a generated file |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
There was a problem hiding this 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 fixes a bug where the caching mechanism in qlty check was causing inconsistent output messages. When all targets were cached, the output would incorrectly show "No modified files for checks were found on your branch" instead of the expected "✔ No issues" message.
Key changes:
- Added
total_targets_countfield to track total number of targets (cached and uncached) throughout the pipeline - Updated
Report::targets_count()method to use the tracked total instead of computing from invocations - Ensured cache remains an implementation detail without affecting user-visible output
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| qlty-check/src/planner.rs | Added total_targets_count field and calculation logic to track all targets |
| qlty-check/src/planner/plan.rs | Added total_targets_count field to Plan struct |
| qlty-check/src/planner/config.rs | Updated test helper to initialize new field |
| qlty-check/src/processor.rs | Pass total_targets_count from plan to report |
| qlty-check/src/report.rs | Added field and simplified targets_count() method |
| qlty-cli/src/format/sarif.rs | Updated test to initialize new field |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
@noahd1 can you please review? |
|
@brynary The code change is minimal, but as someone less familiar with the cache and generally this code, I'd probably look for either a new test to exercise some behavior or a changed test, but I don't see that here. Seems like a good test would be running the same check twice, once without a cache and once with a cache and verifying that the results are the same. |
Summary
This PR fixes a bug where the caching mechanism in
qlty checkwas causing inconsistent output messages.Problem
When all targets were cached, the output would incorrectly show:
Instead of the expected:
This inconsistency was confusing because the same scenario with
--no-cachewould show the correct "✔ No issues" message.Solution
The fix tracks the total number of targets (both cached and uncached) throughout the pipeline, ensuring that the cache remains an implementation detail without affecting user-visible output.
Changes Made
total_targets_countfield toPlan,Planner, andReportstructs to track the total countReport::targets_count()to use the tracked total instead of computing from invocationssarif.rsto include the new fieldTesting
Test Plan
qlty checkon a clean branch (should show "✔ No issues")qlty checkagain with cache enabled (should still show "✔ No issues", not the "No modified files" message)qlty check --no-cache(should show "✔ No issues")🤖 Generated with Claude Code