Skip to content

Conversation

@droidmonkey
Copy link
Member

Testing strategy

Type of change

  • ✅ Bug fix (non-breaking change that fixes an issue)

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 race condition in the Auto-Type functionality by reverting a previous change and restructuring how the initial start delay is handled. The key insight is that the initial delay must be executed synchronously before grabbing the active window reference, rather than being queued as an action in the actions list.

Key Changes:

  • Moved initial Auto-Type delay execution from the action queue to direct execution before window capture
  • Introduced file-scoped constants s_minWaitDelay (100ms) and s_maxWaitDelay (10s) for consistent delay validation
  • Updated all delay validation logic to use the new constants instead of local variables

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.42%. Comparing base (967dc59) to head (f48fd6b).
⚠️ Report is 4 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #12738   +/-   ##
========================================
  Coverage    64.42%   64.42%           
========================================
  Files          378      378           
  Lines        39845    39844    -1     
========================================
  Hits         25667    25667           
+ Misses       14178    14177    -1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

int currentTypingDelay = qBound(0, config()->get(Config::AutoTypeDelay).toInt(), maxTypeDelay);
int cumulativeDelay = qBound(0, config()->get(Config::AutoTypeStartDelay).toInt(), maxWaitDelay);
// Take into account the initial delay which is added before any actions are performed
int cumulativeDelay = qBound(s_minWaitDelay, config()->get(Config::AutoTypeStartDelay).toInt(), s_maxWaitDelay);
Copy link
Member

Choose a reason for hiding this comment

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

Can you store this in a variable above? Even if the calculation is unlikely to change, we should not have this complex expressions in two places when it must evaluate to exactly the same result always. Looks like a bug-to-be to me otherwise.

@phoerious
Copy link
Member

phoerious commented Nov 26, 2025

Oh, we're having this random test failure again:

FAIL!  : TestTools::testBackupFilePatternSubstitution(Complex custom time pattern) Compared values are not the same
   Actual   (Tools::substituteBackupFilePath(pattern, dbFilePath)): "./25/KeePassXC_20251126_041909.old.kdbx"
   Expected (expectedSubstitution)                                : "./25/KeePassXC_20251126_041908.old.kdbx"

https://ci.keepassxc.org/buildConfiguration/KeePassXC_UbuntuLinux/276042?showLog=276039_1608_1499&logFilter=debug&logView=flowAware

This seems to be happening when the second lapses during the generation of the test pattern matrix and the actual test execution:

QTest::newRow("Complex custom time pattern")

My recommended fix would be simply to remove the second from the pattern. This could still happen at the minute mark, but it's way less likely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-Type sometimes does not working after upgrade to 2.7.11

3 participants