Skip to content

Conversation

@brynary
Copy link
Member

@brynary brynary commented Aug 27, 2025

Summary

This PR fixes a bug where the caching mechanism in qlty check was causing inconsistent output messages.

Problem

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

This inconsistency was confusing because the same scenario with --no-cache would 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

  • Added total_targets_count field to Plan, Planner, and Report structs to track the total count
  • Calculate total targets from all driver planners (includes both cached and uncached targets)
  • Updated Report::targets_count() to use the tracked total instead of computing from invocations
  • Updated test in sarif.rs to include the new field

Testing

  • All existing tests pass
  • The output message is now consistent regardless of cache state
  • Cache functionality remains unchanged (it still works as expected)

Test Plan

  • Run qlty check on a clean branch (should show "✔ No issues")
  • Run qlty check again with cache enabled (should still show "✔ No issues", not the "No modified files" message)
  • Run qlty check --no-cache (should show "✔ No issues")
  • Verify cache is still working by checking execution times

🤖 Generated with Claude Code

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]>
@github-actions
Copy link
Contributor

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

@brynary brynary requested a review from noahd1 August 27, 2025 03:09
@brynary
Copy link
Member Author

brynary commented Aug 27, 2025

@noahd1 while I think the PR description is a bit off, I think the fix is correct to unify the behavior

@qltysh
Copy link
Contributor

qltysh bot commented Aug 27, 2025

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
Path File Coverage Δ Indirect
qlty-check/src/planner.rs 0.2
qlty-check/src/processor.rs 0.2
qlty-check/src/report.rs -0.6
qlty-cli/src/format/sarif.rs 0.0
qlty-config/src/library.rs -0.5
qlty-coverage/src/ci/github.rs -0.3
🛟 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.

@qltysh
Copy link
Contributor

qltysh bot commented Aug 27, 2025

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
Path File Coverage Δ Indirect
qlty-check/src/planner.rs 0.2
qlty-check/src/processor.rs 0.2
qlty-check/src/report.rs -0.6
qlty-cli/src/format/sarif.rs 0.0
qlty-config/src/library.rs -0.5
qlty-coverage/src/ci/github.rs -0.3
🛟 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.

@brynary
Copy link
Member Author

brynary commented Sep 9, 2025

@claude resolve the merge conflicts. Cargo.lock is a generated file

@claude
Copy link
Contributor

claude bot commented Sep 9, 2025

Claude encountered an error —— View job

Failed with exit code 1

I'll analyze this and get back to you.

@brynary brynary marked this pull request as ready for review October 14, 2025 13:46
Copilot AI review requested due to automatic review settings October 14, 2025 13:46
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 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_count field 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.

@brynary
Copy link
Member Author

brynary commented Oct 14, 2025

@noahd1 can you please review?

@noahd1
Copy link
Member

noahd1 commented Oct 14, 2025

@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.

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.

3 participants