test: address five reviewer nits on tst_settings and tst_util#1502
Conversation
Five of seven CodeRabbit findings on tst_settings.cpp and tst_util.cpp
were valid; applying them and skipping two with a rationale.
tst_settings.cpp:
- getPassStore: tighten the "plausible path" predicate. The old
`startsWith('/') || contains('/')` was redundant and Unix-only;
switch to `QDir::isAbsolutePath || contains('/') || contains('\\')`
so Windows paths with backslashes also satisfy the check.
- setAndGetSavestate (profile-keys check): loop over both profile1 and
profile2 instead of asserting just on profile1. Same git-options
assertions now cover both entries.
tst_util.cpp:
- CHI_SQUARE_PERMISSIVE_THRESHOLD_DF9: add a comment explaining the
threshold derivation (above p=0.995 critical value ~23.59 for df=9
to reduce false failures without losing real bias detection).
- isValidKeyIdInvalid: collapse the 6-line ASSUMED_MAX_KEY_ID_LENGTH /
TOO_LONG_KEY_ID_LENGTH dance into a single `kTooLongKeyIdLength = 41`
constexpr with a one-line comment.
- SshAuthSockGuard: move from `namespace {}` to a named
`namespace testutils`. Qualifies all seven usage sites.
Skipped:
- tst_settings::getPasswordConfigurationDefault: CodeRabbit wanted to
compare against a default-constructed PasswordConfiguration. Verified:
this fails when the developer's persistent QSettings hold a non-default
config (the test class itself warns "Non-portable mode detected: tests
may modify persistent user settings"). The current `>= 0` check is
intentionally permissive for non-isolated test runs. Keep it.
- tst_settings isUseGit assertion flip: CodeRabbit's suggested rewrite
changes the assertions to claim isUseGit auto-detects .git regardless
of the default arg. Verified against qtpasssettings.cpp:707 — the
auto-detect branch is guarded by `&& defaultValue`, so it only fires
when default=true. The current assertions match the production
behaviour. Suggested rewrite would break them.
Build clean, 113/113 settings + 136/136 util tests pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR refines the QtPass test suite across two files: it strengthens path validation in settings tests and reorganizes utility tests with improved documentation, consolidated boundary constants, and namespace-qualified helper functions. ChangesSettings and Utility Test Updates
Possibly related PRs
Suggested labels
Poem
🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Five of seven recent CodeRabbit findings on `tst_settings.cpp` and `tst_util.cpp` were valid; applying them and skipping two with rationale.
Applied
Skipped, with reason
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit