Skip to content

test: add PassStoreGuard and fix count initialization in util tests#972

Merged
annejan merged 1 commit intomainfrom
fix/test-util-findings
Apr 11, 2026
Merged

test: add PassStoreGuard and fix count initialization in util tests#972
annejan merged 1 commit intomainfrom
fix/test-util-findings

Conversation

@nogeenhenk
Copy link
Copy Markdown
Contributor

@nogeenhenk nogeenhenk commented Apr 11, 2026

User description

Summary

Fixed 4 AI findings in tests/auto/util/tst_util.cpp:

  1. getRecipientListBasic - Added PassStoreGuard for cleanup
  2. getRecipientListWithComments - Added PassStoreGuard for cleanup
  3. getRecipientStringCount - Changed count initialization from -1 to 0
  4. Comment fix - Updated comment to reflect actual check

Also fixed in previous tests:

  • getGpgIdPathBasic, getGpgIdPathSubfolder, getGpgIdPathNotFound - Added PassStoreGuard

CodeAnt-AI Description

Keep utility tests isolated and verify recipient counting starts from a valid value

What Changed

  • Utility tests now restore the previous pass store setting after they run, so they do not affect later tests.
  • The recipient-count test now starts from zero and checks that the parsed recipient count is updated to the expected number.
  • A comment was updated to match the actual count check.

Impact

✅ Fewer test side effects
✅ More reliable util test results
✅ Clearer recipient count checks

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • Tests
    • Improved test robustness with enhanced cleanup and restoration mechanisms.
    • Refined test initialization for improved accuracy.

@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai bot commented Apr 11, 2026

CodeAnt AI is reviewing your PR.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: f7fddf0e-372e-49fe-9abd-8001ca8b8cc9

📥 Commits

Reviewing files that changed from the base of the PR and between 318ddf9 and c6cc4c0.

📒 Files selected for processing (1)
  • tests/auto/util/tst_util.cpp

📝 Walkthrough

Walkthrough

Test file modifications ensure proper pass store state cleanup in two test methods. A PassStoreGuard is introduced to save and restore the pass store state, and an initial count parameter is adjusted from -1 to 0 with corresponding comment clarification.

Changes

Cohort / File(s) Summary
Test Cleanup
tests/auto/util/tst_util.cpp
Introduce PassStoreGuard in getRecipientListWithComments() for state restoration; adjust initial count parameter from -1 to 0 in getRecipientStringCount() and update comment to clarify test intent.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested labels

size:XS

Poem

🐰 A guard stands watch, the pass-store won't stray,
Cleanup assured at the end of the day,
With counts reset and comments made clear,
These tests now shine, with nothing to fear!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding PassStoreGuard and fixing count initialization in util tests, matching the actual modifications in tst_util.cpp.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/test-util-findings

Comment @coderabbitai help to get the list of available commands and usage tips.

@codeant-ai codeant-ai bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Apr 11, 2026
@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai bot commented Apr 11, 2026

CodeAnt AI finished reviewing your PR.

@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 20.923%. remained the same — fix/test-util-findings into main

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 26.99%. Comparing base (318ddf9) to head (c6cc4c0).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #972   +/-   ##
=======================================
  Coverage   26.99%   26.99%           
=======================================
  Files          39       39           
  Lines        3286     3286           
=======================================
  Hits          887      887           
  Misses       2399     2399           
Flag Coverage Δ
qtpass 26.99% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@annejan annejan merged commit 4ad25c9 into main Apr 11, 2026
26 checks passed
@annejan annejan deleted the fix/test-util-findings branch April 11, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants