refactor: enforce non-null constraints on notification fields#1807
Merged
YoshihitoAso merged 3 commits intodev-26.6from Apr 8, 2026
Merged
refactor: enforce non-null constraints on notification fields#1807YoshihitoAso merged 3 commits intodev-26.6from
YoshihitoAso merged 3 commits intodev-26.6from
Conversation
…ate related tests
…d enhance upgrade tests
Coverage Report •
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
db1f5a3 to
4990cc6
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enforces non-null guarantees for persisted notification records by aligning DB constraints, ORM typing, and API schema expectations (issue #1794), while keeping address/account_address nullable for notification types that don’t have an address.
Changes:
- Added an Alembic migration to backfill defaults, delete invalid rows, and set several
notificationcolumns toNOT NULL. - Updated the SQLAlchemy
Notificationmodel and schema typings to reflect non-null fields, and allowedaccount_addressto be nullable in the API schema. - Updated API router serialization/type-check scaffolding and expanded migration/API tests to cover the new constraints and nullable
account_address.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
migrations/versions/93f1494c3975_v26_6_0_feature_1794.py |
Backfills/deletes invalid notifications and applies NOT NULL constraints (incl. JSON-null handling for metainfo). |
app/model/db/notification.py |
Makes several notification columns non-nullable and centralizes datetime formatting used by API serialization. |
app/model/schema/notification.py |
Updates response typing to require non-null fields and to allow account_address to be null. |
app/api/routers/notification.py |
Simplifies notification serialization and removes redundant null assertions now covered by DB/model guarantees. |
docs/ibet_wallet_api.yaml |
Updates OpenAPI schema to allow account_address: null. |
tests/migrations/upgrade_test.py |
Extends migration upgrade test to validate the new notification nullability/backfill/delete behavior. |
tests/app/notification_Notifications_GET_test.py |
Adds coverage for a notification with account_address/address as None and updates expected counts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
YoshihitoAso
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 Description
This PR updates notification nullability for issue #1794.
Fields that should always exist are aligned across the migration, ORM model, and API schema.
addressstays nullable because some notification types do not have an address.✅ Related Issues
🔄 Changes
NOT NULL:notification_typepriorityis_readis_flaggedis_deletedblock_timestampmetainfoprioritywith0and boolean flags withFalsenotification_type,block_timestamp, ormetainfo📌 Checklist