Skip to content

notification-service: extract repeated route error messages into constants (kotlin:S1192) - #1552

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1789068079-notification-routes-s1192
Open

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1789068079-notification-routes-s1192

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes two SonarCloud kotlin:S1192 (duplicated string literal) findings in services/notification-service/.../routes/Routes.kt:

  • AZ6OP-RWRoUIIbwnU9eq"Notification ID is required" repeated 3× (GET/PUT/DELETE /{id} handlers)
  • AZ6OP-RWRoUIIbwnU9er"Notification not found" repeated 3× (same three handlers)

Both messages now live as top-level constants in Routes.kt and every call site references them, so the client-facing error text can only diverge in one place:

const val NOTIFICATION_ID_REQUIRED = "Notification ID is required"
const val NOTIFICATION_NOT_FOUND = "Notification not found"

Response bodies are byte-for-byte unchanged.

Test

New routes/RoutesTest.kt boots the routing module under Ktor's test host with a mocked NotificationService (via Koin) and asserts that GET /api/v1/notifications/{id}, PUT /{id}/read, and DELETE /{id} all return 404 with the shared NOTIFICATION_NOT_FOUND body, plus a guard that the constants carry the original messages. It does not compile against main (the constants don't exist there).

cd services/notification-service && ./gradlew build — 35 tests, all green.

Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/295ba1f62fdf4469ba720d4b7bc81fe1
Open in Devin Desktop: https://partner-workshops.devinenterprise.com/desktop/session/295ba1f62fdf4469ba720d4b7bc81fe1?variant=devin
Requested by: @mbatchelor81


Devin Review

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

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.

1 participant