refactor(agent-client): move test-only permission overrides to agent-testing#1709
Open
Scra3 wants to merge 2 commits into
Open
refactor(agent-client): move test-only permission overrides to agent-testing#1709Scra3 wants to merge 2 commits into
Scra3 wants to merge 2 commits into
Conversation
…testing The permission-override mechanism (overridePermissions field, the overrideCollectionPermission / overrideActionPermission / clearPermissionOverride methods, and the *PermissionsOverride types) was only ever used by agent-testing, yet it lived on the production RemoteAgentClient base class — exposing no-op methods on the prod client API. Move it to TestableAgentBase (agent-testing), the sole consumer: - agent-client: drop the field/methods/types from RemoteAgentClient and the dead overridePermissions param from createRemoteAgentClient. - agent-testing: TestableAgentBase now holds overridePermissions + the override methods; the types live in a new permission-overrides module used by the sandbox and createAgentTestClient. BREAKING CHANGE: @forestadmin/agent-client no longer exports createRemoteAgentClient's overridePermissions option nor the PermissionsOverride / CollectionPermissionsOverride / SmartActionPermissionsOverride types (test-only; use @forestadmin/agent-testing). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
f73495f to
94bcb10
Compare
|
Coverage Impact This PR will not change total coverage. Modified Files with Diff Coverage (1)
🛟 Help
|
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.

Context
The permission-override mechanism on
RemoteAgentClient— theoverridePermissionsfield, theoverrideCollectionPermission/overrideActionPermission/clearPermissionOverridemethods, and the*PermissionsOverridetypes — is purely a test affordance. Its only consumer isagent-testing(sandbox +createAgentTestClient).In production (
mcp-server,workflow-executor)overridePermissionsis alwaysundefined, so these public methods are no-ops polluting the prod client API.Change
Move the whole block to
TestableAgentBase(agent-testing), its sole consumer:RemoteAgentClient, and the deadoverridePermissionsparam fromcreateRemoteAgentClient(no caller —agent-testingusesnew TestableAgentBase(...), not the factory).TestableAgentBasenow ownsoverridePermissions+ the override methods; the types live in a newpermission-overrides.tsmodule, imported byforest-server-sandbox.tsandcreateAgentTestClient.agent-clientto a newagent-testing/test/testable-agent-base.test.ts.Breaking change
@forestadmin/agent-clientno longer exports theoverridePermissionsoption ofcreateRemoteAgentClient, nor thePermissionsOverride/CollectionPermissionsOverride/SmartActionPermissionsOverridetypes. These were test-only — consumers should use@forestadmin/agent-testing. No known production consumer used them (verified: onlyagent-testingimported them).Tests
testable-agent-base.test.ts6 pass (moved override tests).🤖 Generated with Claude Code
Note
Move permission override types and methods from
agent-clienttoagent-testingoverrideCollectionPermission,overrideActionPermission,clearPermissionOverride, and related types fromRemoteAgentClientin agent-client and its public exports.TestableAgentBasesubclass in agent-testing, which accepts anoverridePermissionscallback and re-implements the three override methods.agent-testingno longer depends onagent-clientfor them.createRemoteAgentClientno longer acceptsoverridePermissions; callers relying on this parameter must switch toTestableAgentBase.Macroscope summarized feaed65.