Skip to content

fix: allow numeric lockExpires in push notification validation#384

Merged
andreabadesso merged 2 commits intomasterfrom
fix/push-notification-lockExpires-validation
Mar 17, 2026
Merged

fix: allow numeric lockExpires in push notification validation#384
andreabadesso merged 2 commits intomasterfrom
fix/push-notification-lockExpires-validation

Conversation

@andreabadesso
Copy link
Copy Markdown
Collaborator

@andreabadesso andreabadesso commented Mar 16, 2026

Summary

  • Fixes Opsgenie alert #50062: "Invalid payload while handling push notification request"
  • The Joi schema used .valid(null) for lockExpires, which creates a whitelist accepting only null — rejecting valid numeric timestamps from time-locked outputs
  • Changed to .allow(null) so both null and non-negative integers are accepted
  • Added test case for numeric lockExpires values

Test plan

  • Verify existing push notification tests still pass
  • Confirm the new test with numeric lockExpires passes
  • Deploy and verify the Opsgenie alert stops recurring

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Fixed wallet service validation to properly accept null values for lock expiration timestamps in push notification requests.
  • Tests

    • Added test coverage to verify correct handling and processing of expiration timestamps in push notifications.

Joi .valid(null) creates a whitelist that only accepts null, rejecting
valid numeric timestamps for time-locked outputs. Changed to .allow(null)
so both null and non-negative integers are accepted.

Fixes Opsgenie alert #50062.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 96c8e563-7a9d-4f11-87a6-bdea33c8a3c8

📥 Commits

Reviewing files that changed from the base of the PR and between 1693af7 and 23915b5.

📒 Files selected for processing (2)
  • packages/wallet-service/src/api/txPushNotificationRequested.ts
  • packages/wallet-service/tests/txPushNotificationRequested.test.ts

📝 Walkthrough

Walkthrough

This change modifies the wallet service's transaction push notification API by adjusting how null values are validated for the lockExpires parameter using Joi's .allow(null) method, and adds a new test suite validating that numeric lockExpires timestamps are accepted and trigger push notifications correctly.

Changes

Cohort / File(s) Summary
Validation Method Update
packages/wallet-service/src/api/txPushNotificationRequested.ts
Changed lockExpires validation from .valid(null) to .allow(null) to modify how null values are permitted while maintaining numeric and minimum constraints.
Test Suite Addition
packages/wallet-service/tests/txPushNotificationRequested.test.ts
Added "validation lockExpires" test suite with tests verifying that numeric epoch lockExpires values are accepted and trigger exactly one push notification invocation (with test block duplication).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A rabbit hops through validation schemes,
Where lockExpires now flows through Joi's streams,
From .valid(null) to .allow() we change,
Tests multiply to keep things in range! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: allowing numeric lockExpires values in push notification validation by changing the Joi schema validation rule.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/push-notification-lockExpires-validation
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@andreabadesso andreabadesso self-assigned this Mar 17, 2026
@andreabadesso andreabadesso added the bug Something isn't working label Mar 17, 2026
@andreabadesso andreabadesso moved this from Todo to In Progress (Done) in Hathor Network Mar 17, 2026
@andreabadesso andreabadesso requested review from glevco and luislhl March 17, 2026 02:13
@glevco glevco moved this from In Progress (Done) to In Review (WIP) in Hathor Network Mar 17, 2026
@luislhl luislhl moved this from In Review (WIP) to In Review (Done) in Hathor Network Mar 17, 2026
@andreabadesso andreabadesso merged commit 2cb922e into master Mar 17, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from In Review (Done) to Waiting to be deployed in Hathor Network Mar 17, 2026
@andreabadesso andreabadesso deleted the fix/push-notification-lockExpires-validation branch March 17, 2026 16:16
@andreabadesso andreabadesso moved this from Waiting to be deployed to Done in Hathor Network Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants