Skip to content

fix: 🐛 resolve SonarCloud issues on the alpha release - #378

Merged
polymesh-bot merged 1 commit into
alphafrom
chore/resolve-sonar-issues
Oct 23, 2026
Merged

polymesh-bot merged 1 commit into
alphafrom
chore/resolve-sonar-issues

Conversation

@prashantasdeveloper

Copy link
Copy Markdown
Contributor

JIRA Link

N/A

Changelog / Description

Resolves the 9 SonarCloud issues that fail the quality gate on #376 (alpha → master).

Reliability (S9383, unhandled promises):

  1. OfflineSubmitterService.updateTransaction now awaits offlineTxRepo.updateTx. It was fire and forget, so a failed status write was never noticed.
  2. The offline recorder, signer and submitter services now attach a .catch to registerListener and log which listener failed to register. The previous unhandled rejection only produced a generic warning. Registration stays in the constructor, so a broker outage still leaves the REST API serving as before. Moving it to onModuleInit was tried and rejected: with the broker down, the app stayed alive but never started serving HTTP.
  3. write-swagger exits with code 1 when the spec can't be written.

Code smells (S7503, async without await):
4. Removed async from LocalSigningService.getHandleByAddress/addSigner, LocalApiKeysRepo.getUserByApiKey/deleteApiKey and PolymeshService.execTransaction. They return settled promises, so errors are still delivered as rejections.

Local verification against alpha as a baseline:

  • Real Artemis broker: one consumer on each of Requests, Signatures and EventsLog on both builds. Invalid messages were rejected and probe events recorded.
  • Broker down: both builds serve HTTP 200. This branch also logs the failed listener registrations.
  • apiKey auth: signer add/duplicate/invalid/lookup and the API key create/use/delete flows return identical responses on both builds.
  • write-swagger: same exit codes, and identical specs apart from generated example timestamps.

Checklist -

  • New Feature ?
  • Updated swagger annotation (if API structure is changed) ?
  • Unit Test (if possible) ?
  • Updated the Readme.md (if required) ?

🤖 Generated with Claude Code

Reliability:
- await the offline transaction status update, which was fire and forget,
  so a failed write no longer goes unnoticed as an unhandled rejection
- log a clear error when an offline service cannot register its message
  listener, instead of leaving the rejection unhandled
- exit with a non zero code when the swagger spec cannot be written

Code smells:
- drop `async` from methods with no `await` in the local signer and API key
  stores and `PolymeshService.execTransaction`, returning settled promises so
  errors are still delivered as rejections
@prashantasdeveloper
prashantasdeveloper requested a review from a team as a code owner October 19, 2026 12:33
@sonarqubecloud

Copy link
Copy Markdown

@prashantasdeveloper

Copy link
Copy Markdown
Contributor Author

/fast-forward

@polymesh-bot
polymesh-bot merged commit 9d8523f into alpha Oct 23, 2026
10 checks passed
@polymesh-bot
polymesh-bot deleted the chore/resolve-sonar-issues branch October 23, 2026 12:32
@polymesh-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 9.0.1-alpha.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

3 participants