[FEATURE]: Test that PermissionV2 declines pending requests when its scope closes
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- testing-qa
Research direction
Start in packages/core/test/permission.test.ts and compare the V1 test, pending permission rejects on instance dispose, in packages/opencode/test/permission/next.test.ts. Build the PermissionV2 layer in its own Layer.fresh scope, create a pending request, then close the scope. Done means the waiting assert fails with DeclinedError and list() returns empty.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- TypeScript
- Stars
- 210k
- Forks
- 27.8k
- Avg merge
- 8h 43m
- Merged PRs (30d)
- 380
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from anomalyco/opencode
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
anomalyco/opencode#51159 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
All issues in anomalyco/opencode
Similar issues
-
resources
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
railmapgen/rmg-palette#2445 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
danielmiessler/LifeOS#2242 ·
Maintainers usually reply within 5 days
-
good first issue hacktoberfest help wanted translation
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
callstackincubator/appduct#129 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100