Test the live updates stream (/api/events)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 86/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- node.js, typescript
调研方向
阅读 apps/api/src/routes.ts,查看 broadcast() 和 /api/events 路由,然后检查 Client 类以及 tests/api.test.mjs 中现有的 API 测试模式。添加对未认证访问、incident 更新和 playbook 保存的测试覆盖。使用 reader 读取每个流并取消它,以便 npm test 退出。验证预期的事件类型和 incident id,并且 npm test 通过后,即为完成。
由索引模型根据 Issue 内容生成。
描述
The task
When someone changes a playbook or an incident, everyone sees it live: the browser keeps GET /api/events open, a Server-Sent Events stream, and the server pushes an event on every change. Nothing tests this stream. Add a test, so that a change to the server cannot silently stop live updates.
Where to look
apps/api/src/routes.ts:broadcast()near the top writesevent: changewith{ type, id }as data; the/api/eventsroute needs a signed-in user (roleviewer)tests/api.test.mjs: theClientclass keeps the session cookie.fetchcan read a stream: readres.bodywith a reader and split the text on blank lines (\n\n), each block is one event
Cancel the reader at the end of the test, or the test run will not exit.
Done when
- Opening
/api/eventswithout a session gets401 - With a session, after an analyst changes an incident (for example its name,
POST /api/incidents/:id/meta), anevent: changearrives withtypeincidentand the incident'sid - After an editor saves a playbook draft, an event arrives with
typeplaybook -
npm testpasses, and exits on its own
Mentor
@0b3l1X-SolidGeeks
- 主要语言
- TypeScript
- 星标
- 0
- 派生
- 1
- 平均合并
- 9 分钟
- 30 天内合并 PR
- 10
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
SolidGeeks/muster 的其他 Issue
-
good first issue help wanted
难度 2/5 1-3 小时 新手友好度 88/100
SolidGeeks/muster#15 ·
维护者通常 1 天内回复
-
good first issue help wanted
难度 2/5 1-3 小时 新手友好度 86/100
SolidGeeks/muster#14 ·
维护者通常 1 天内回复
查看 SolidGeeks/muster 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
awslabs/visual-asset-management-system#804 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
restatedev/sdk-typescript#813 ·
-
bug desktop P1 session XS
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
Merit-Systems/x402scan#1312 ·
-
type:bug
难度 2/5 1-3 小时 新手友好度 78/100
Azure/apiops-cli#331 ·
维护者通常 3 天内回复