createNotification returns an id that does not match the file the notify script writes
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 50/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- graphql, typescript
调研方向
Start in NotificationsService.createNotification(), where makeNotificationId() builds the returned id, and compare it with the file name the legacy notify script writes (safe_filename("{event}-{unix timestamp}.notify")). Trace the unread/archive lookup used by archiveNotification and deleteNotification, and check notifyIfUnique for when browser notifications are off. Done when the returned id and type resolve to the file actually written, and repeated notifyIfUnique calls do not duplicate the notification.
由索引模型根据 Issue 内容生成。
描述
Environment
Unraid OS Version: 7.3.4 (API 4.37.9+bedd403a)
Are you using a reverse proxy? No. Tested directly against the server's built-in /graphql endpoint, authenticated with an x-api-key (ADMIN role).
Hardware / setup that may matter: Supermicro X12STH-F, Xeon E-2356G. Settings > Notifications has browser notifications turned off and agents only for every level (normal="4", warning="4", alert="4" in dynamix.cfg). The id mismatch below happens with any settings; the other two problems only show up with browser notifications turned off.
Pre-submission Checklist
- I have verified that my Unraid OS is up to date
- I have tested this issue by accessing my server directly (not through a reverse proxy)
- This is not an Unraid Connect related issue (if it is, please submit via the support form instead)
Issue Description
createNotification returns an id that does not match the notification it creates, so the returned id cannot be used to archive, read or delete it.
NotificationsService.createNotification() builds an id with makeNotificationId() (title + UUIDv7), then hands the notification to the legacy /usr/local/emhttp/webGui/scripts/notify script. The script picks its own file name, safe_filename("{event}-{unix timestamp}.notify"). The service only writes a file under its own id if the script fails, but it always returns its own id. Unchanged on main.
With browser notifications turned off there are two more problems:
- The
notifyscript always writes the archive copy, but only writes an unread copy when the browser bit (entity & 1) is set for that importance level. The mutation still returnstype: UNREAD, but nothing is in the unread list. notifyIfUniqueonly checks the unread list for duplicates, so on these servers it never finds one and creates a new notification every time.
Steps to Reproduce
mutation { createNotification(input: {title: "API test", subject: "s", description: "d", importance: INFO}) { id type } }- Returned id:
<server-id>:API_test_01a19e36-9055-7367-87c9-1014cf3dc06d.notify. File actually written:/tmp/notifications/archive/API_test_1793655738.notify(no unread copy, because of the settings above). mutation { archiveNotification(id: "<returned id>") { id } }fails.mutation { deleteNotification(id: "<returned id>", type: ARCHIVE) { archive { total } } }fails.query { notifications { list(filter: {type: ARCHIVE, offset: 0, limit: 50}) { id title } } }shows the notification with id<server-id>:API_test_1793655738.notify. Deleting with that id works.- Run
notifyIfUniquetwice with the same input. It returns two different ids and two archive files are created (API_dedupe_test_1793656186.notify,API_dedupe_test_1793656187.notify).
Expected Behavior
- The id returned by
createNotificationis the id of the notification that was created, and works witharchiveNotification,deleteNotificationandunreadNotification. - The returned
typematches where the notification actually ended up. notifyIfUniquedoes not create a duplicate when browser notifications are turned off.
Actual Behavior
Step 3:
{"errors":[{"message":"Could not find notification in unreads: API_test_01a19e36-9055-7367-87c9-1014cf3dc06d.notify"}]}
Step 4:
{"errors":[{"message":"ENOENT: no such file or directory, open '/tmp/notifications/archive/API_test_01a19e36-9055-7367-87c9-1014cf3dc06d.notify'"}]}
Additional Context
Possible fixes: have the service compute the same file name the script will use (or pass it to the script), or look up the file the script created and return that id and type. For notifyIfUnique, also check recent archive entries when browser notifications are turned off for that importance level.
- 主要语言
- TypeScript
- 星标
- 123
- 派生
- 25
- 平均合并
- 2 天 16 小时
- 30 天内合并 PR
- 9
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
unraid/api 的其他 Issue
-
Temperature metrics: lm-sensors voltages, fan speeds and power are reported as temperatures (°C)未关闭bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
flash { guid } always fails: resolver no longer returns guid but the schema marks it non-nullable未关闭
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 74/100
yavorsky/unbuilt.app#65 ·
-
CVE security
难度 2/5 1-3 小时 新手友好度 68/100
mckinsey/agents-at-scale-ark#4091 · 1 条评论 ·
维护者通常 1 天内回复
-
factory:subtask
难度 1/5 1 小时以内 新手友好度 94/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
NUS-Project-SaBai/project-sabai#386 ·
维护者通常 3 天内回复
-
android needs clarification
难度 2/5 1-3 小时 新手友好度 72/100
super-productivity/super-productivity#12105 · 3 条评论 ·
维护者通常 1 天内回复