test(opencode): add unit coverage for permission mapping helpers#1050
Merged
test(opencode): add unit coverage for permission mapping helpers#1050
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
nhopeatall
approved these changes
Mar 25, 2026
Collaborator
nhopeatall
left a comment
There was a problem hiding this comment.
LGTM — Clean, thorough unit test coverage for three small pure functions. Tests correctly mirror the source implementation in src/backends/opencode/permissions.ts, covering all five permission types across all three helpers plus an integration group that validates the pipeline. All 35 tests pass, CI is green, and the file follows existing test conventions in tests/unit/backends/.
🕵️ claude-code · claude-opus-4-6 · run details
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tests/unit/backends/opencode-permissions.test.tswith 35 unit tests covering the three pure helper functions insrc/backends/opencode/permissions.tsedit,bash,webfetch,external_directory, anddoom_loopdenybuildPermissionConfigoutput directly intoresolvePermissionDecisionCard: https://trello.com/c/nWKVcaVe/562-as-a-developer-i-want-unit-coverage-for-opencode-permission-mapping-so-that-tool-approval-behavior-stays-deterministic
Test plan
buildPermissionConfig— covers default deny, capability-gated allow foredit/bash/webfetch, unconditional deny fordoom_loop/external_directorynormalizePermissionDecision— mapsallow → alwaysanddeny → rejectresolvePermissionDecision— per-type allow/deny routing for all five known types; unknown types resolve to denybuildPermissionConfig → resolvePermissionDecisionpipelinevitest run --project unit-backends tests/unit/backends/opencode-permissions.test.tspasses (35/35)npm run lint— no errorsnpm run typecheck— no errors🤖 Generated with Claude Code
🕵️ claude-code · claude-sonnet-4-6 · run details