Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[FEATURE]: Test that PermissionV2 declines pending requests when its scope closes

未关闭 适合新手
#51,220 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
88/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
testing-qa

调研方向

从 packages/core/test/permission.test.ts 开始,并对比 packages/opencode/test/permission/next.test.ts 中的 V1 测试“pending permission rejects on instance dispose”。在其自己的 Layer.fresh 作用域中构建 PermissionV2 层,创建一个待处理请求,然后关闭该作用域。等待中的 assert 以 DeclinedError 失败且 list() 返回空列表,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Feature hasn't been suggested before.
  • I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request

PermissionV2 registers a finalizer (packages/core/src/permission.ts, the addFinalizer near the top of the layer) that fails every pending request with DeclinedError and clears the map when the scope closes. Nothing in packages/core/test/permission.test.ts exercises it. The V1 equivalent has a test (pending permission rejects on instance dispose in packages/opencode/test/permission/next.test.ts), so a shutdown that leaked waiters would currently go unnoticed in V2.

I checked the behaviour is correct today. This is only a coverage gap, not a bug: with a request pending, closing the scope makes the waiting assert die with DeclinedError and list() returns empty.

I'd like to add one test for this. It needs the layer built in its own scope with Layer.fresh, since the shared test layer would otherwise hold the finalizer. Happy to send the PR if that's fine.

主要语言
TypeScript
星标
210k
派生
27.8k
平均合并
6 小时 50 分钟
30 天内合并 PR
336

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。