Skip to content

fix(utils): satisfy Sonar S7497 in timeout shim#4060

Merged
PatStLouis merged 3 commits intoopenwallet-foundation:mainfrom
OpSecId:fix-post-merge-sonarqube-error
Feb 20, 2026
Merged

fix(utils): satisfy Sonar S7497 in timeout shim#4060
PatStLouis merged 3 commits intoopenwallet-foundation:mainfrom
OpSecId:fix-post-merge-sonarqube-error

Conversation

@PatStLouis
Copy link
Contributor

Summary

Fixes the post-merge Sonar failure in acapy_agent/utils/repeat.py (python:S7497). The compatibility shim for asyncio.timeout (Python <3.11) was catching asyncio.CancelledError and raising TimeoutError, which Sonar flags because CancelledError must be re-raised after cleanup.

Changes

  • Remove the compatibility shim — The project now requires Python 3.13 (python = "^3.13"), so asyncio.timeout is always available. The fallback that used call_later + CancelledError was dead code and was the only code path triggering S7497.
  • _timeout_cm() now always returns asyncio.timeout(duration) and the unused asynccontextmanager import is removed.

Resolves

Post-merge Sonar scan failure: "Ensure that the asyncio.CancelledError exception is re-raised after your cleanup code" at L107 in acapy_agent/utils/repeat.py.

…l TimeoutError)

Signed-off-by: Patrick St-Louis <patrick.st-louis@opsecid.ca>
…y (fixes Sonar S7497)

Signed-off-by: Patrick St-Louis <patrick.st-louis@opsecid.ca>
@PatStLouis PatStLouis requested a review from swcurran February 20, 2026 17:03
@sonarqubecloud
Copy link

@PatStLouis PatStLouis merged commit bc8e0e8 into openwallet-foundation:main Feb 20, 2026
12 checks passed
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