fix(permission): stop logging full rulesets during evaluation#17293
Open
notzenco wants to merge 2 commits intoanomalyco:devfrom
Open
fix(permission): stop logging full rulesets during evaluation#17293notzenco wants to merge 2 commits intoanomalyco:devfrom
notzenco wants to merge 2 commits intoanomalyco:devfrom
Conversation
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates PermissionNext.evaluate() logging to avoid serializing the full merged permission ruleset (which can be large/noisy) while still providing useful debug context about what matched.
Changes:
- Log the matched
ruleand totalrulescount instead of logging the entirerulesetobject inPermissionNext.evaluate(). - Add a regression test asserting the log line includes
rule=andrules=<n>and does not includeruleset=.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/opencode/src/permission/next.ts | Refines evaluate() logging payload to reduce log size and avoid full ruleset serialization. |
| packages/opencode/test/permission-next.test.ts | Adds coverage to ensure evaluate() logs the matched rule and rule count (and not the full ruleset). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+21
to
+27
| await sleep(50) | ||
|
|
||
| const line = (await Bun.file(Log.file()).text()) | ||
| .trim() | ||
| .split("\n") | ||
| .findLast((x) => x.includes("service=permission") && x.includes(`pattern=${pattern}`)) | ||
|
|
|
Stop creating mediocre solutions, you're one of the many who end up damaging the program. |
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.
Issue for this PR
Closes #17218
Type of change
What does this PR do?
PermissionNext.evaluate()was logging the entire merged ruleset on every call. On installs with lots ofexternal_directoryrules, that makes each permission log line very large and causes the log directory to grow much faster than it should.This keeps the permission evaluation log, but only records the matched rule and the merged rule count. That still shows why a permission check resolved the way it did without dumping the full ruleset into every log line.
I also added a small config dependency guard after the Windows e2e failure on this branch. When a local
.opencodedirectory is already inside a repo with@opencode-ai/pluginavailable from a parent install, we now skip creating a second local install just for that directory.How did you verify your code works?
rule=andrules=but noruleset=Config.needsInstall()skips a local.opencodedir when the plugin is already available from a parent installbun test test/permission-next.test.ts test/permission-task.test.ts test/config/config.test.tsbun typecheckScreenshots / recordings
N/A
Checklist