Skip to content

fix(backend): 表示されない通知が残り通知数として表示されるバグの修正#17530

Open
fruitriin wants to merge 4 commits into
misskey-dev:developfrom
fruitriin:fix/notification-unread-count
Open

fix(backend): 表示されない通知が残り通知数として表示されるバグの修正#17530
fruitriin wants to merge 4 commits into
misskey-dev:developfrom
fruitriin:fix/notification-unread-count

Conversation

@fruitriin
Copy link
Copy Markdown
Contributor

What

通知の残件カウント通知にUI上表示されない通知の数が含まれてしまうのを修正

Why

Fix: #17427

Additional info (optional)

Checklist

  • Read the contribution guide
  • [ x Test working in a local environment
  • (If needed) Add story of storybook
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

fruitriin and others added 3 commits June 3, 2026 09:33
UserEntityService.getNotificationsInfo() が Redis Stream の生エントリ数で未読
を返していたため、packMany で除外される通知 (解決済みフォローリクエスト・
削除済みノート等) もカウントに含まれ、「通知ページに表示は無いのにバッジが
消えない」状態を引き起こしていた (misskey-dev#17427)。

unreadNotificationsCount と i/notifications のレスポンス件数が一致することを
3 シナリオで検証する:

- 承認済みフォローリクエスト通知が packMany で除外されてもバッジに残らない
- mention 通知の件数がバッジと一致する
- メンション元ノートが削除されると mention 通知がバッジから除外される

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
UserEntityService.getNotificationsInfo() は Redis Stream の生エントリ数で
未読カウントを返していたため、packMany で表示時に除外される通知 (削除済み
ノート・解決済みフォローリクエスト・サスペンドされた notifier・削除済み
ロール等) もカウントに含まれていた。結果として「通知ページには何も表示
されないのにバッジに数字だけ残る」状態が発生し、その状態は唯一 "全件既読"
ボタン (notifications/mark-all-as-read) でしか解消できなかった。

NotificationEntityService.packMany と同じバリデータを通した件数を未読数と
して返すように変更する。これにより API レスポンスとバッジカウントが常に
一致し、解決済み通知や元データが消失した通知がカウントから自動的に除外
される。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…viders に追加

PR misskey-dev#17427 で UserEntityService.onModuleInit に
moduleRef.get('NotificationEntityService') を追加したことで、
テストのローカル providers 配列に未登録だった
NotificationEntityService が DI 解決できず unit テストが落ちていた。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 3, 2026
@github-actions github-actions Bot added packages/backend Server side specific issue/PR packages/backend:test labels Jun 3, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

❌ Patch coverage is 44.44444% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 24.89%. Comparing base (e50603e) to head (a2a81d7).

Files with missing lines Patch % Lines
...ges/backend/src/core/entities/UserEntityService.ts 44.44% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #17530      +/-   ##
===========================================
- Coverage    24.93%   24.89%   -0.04%     
===========================================
  Files         1158     1160       +2     
  Lines        39539    39575      +36     
  Branches     11011    11019       +8     
===========================================
- Hits          9858     9854       -4     
- Misses       23780    23817      +37     
- Partials      5901     5904       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fruitriin
Copy link
Copy Markdown
Contributor Author

通知ページを開いても、通知がページングするまで残件が消えないみたいな奇妙な挙動(FEの挙動由来)は残るものの
全て既読以外で消えなくなるみたいな症状は収まったように思います

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

このPRによるapi.jsonの差分
差分はありません。
Get diff files from Workflow Page

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

Backend memory usage comparison

Before GC

Metric base (MB) head (MB) Diff (MB) Diff (%)
VmRSS 305.74 MB 306.61 MB +0.87 MB +0.28%
VmHWM 305.74 MB 306.61 MB +0.87 MB +0.28%
VmSize 23171.02 MB 23171.46 MB 0.43 MB 0%
VmData 1371.23 MB 1371.58 MB +0.34 MB +0.02%

After GC

Metric base (MB) head (MB) Diff (MB) Diff (%)
VmRSS 305.87 MB 306.62 MB +0.75 MB +0.24%
VmHWM 305.87 MB 306.62 MB +0.75 MB +0.24%
VmSize 23171.27 MB 23171.46 MB 0.18 MB 0%
VmData 1371.48 MB 1371.58 MB 0.09 MB 0%

After Request

Metric base (MB) head (MB) Diff (MB) Diff (%)
VmRSS 306.51 MB 307.03 MB +0.52 MB +0.17%
VmHWM 306.51 MB 307.03 MB +0.52 MB +0.17%
VmSize 23171.60 MB 23171.54 MB -0.06 MB 0%
VmData 1371.82 MB 1371.66 MB -0.15 MB -0.01%

See workflow logs for details

…存も providers に追加

NotificationEntityService.onModuleInit が
moduleRef.get('RoleEntityService') / moduleRef.get('ChatEntityService')
を呼ぶため、これらもテストモジュールに登録しないと
`Nest could not find RoleEntityService element` で落ちる。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread packages/backend/test/unit/entities/UserEntityService.ts
@github-project-automation github-project-automation Bot moved this from Todo to Approved in [実験中] 管理用 Jun 5, 2026
@kakkokari-gtyih kakkokari-gtyih changed the title Fix: 表示されない通知が残り通知数として表示されるバグの修正 fix(backend): 表示されない通知が残り通知数として表示されるバグの修正 Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages/backend:test packages/backend Server side specific issue/PR size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Approved

Development

Successfully merging this pull request may close these issues.

通知のバルーンが「全部既読」を押さないと消えない

3 participants