Skip to content

refactor(agent-client): move test-only permission overrides to agent-testing#1709

Open
Scra3 wants to merge 2 commits into
mainfrom
refactor/move-permission-overrides-to-testing
Open

refactor(agent-client): move test-only permission overrides to agent-testing#1709
Scra3 wants to merge 2 commits into
mainfrom
refactor/move-permission-overrides-to-testing

Conversation

@Scra3

@Scra3 Scra3 commented Jun 25, 2026

Copy link
Copy Markdown
Member

Context

The permission-override mechanism on RemoteAgentClient — the overridePermissions field, the overrideCollectionPermission / overrideActionPermission / clearPermissionOverride methods, and the *PermissionsOverride types — is purely a test affordance. Its only consumer is agent-testing (sandbox + createAgentTestClient).

In production (mcp-server, workflow-executor) overridePermissions is always undefined, so these public methods are no-ops polluting the prod client API.

Change

Move the whole block to TestableAgentBase (agent-testing), its sole consumer:

  • agent-client: remove the field, the 3 methods, the 3 types from RemoteAgentClient, and the dead overridePermissions param from createRemoteAgentClient (no caller — agent-testing uses new TestableAgentBase(...), not the factory).
  • agent-testing: TestableAgentBase now owns overridePermissions + the override methods; the types live in a new permission-overrides.ts module, imported by forest-server-sandbox.ts and createAgentTestClient.
  • Tests for the override methods moved from agent-client to a new agent-testing/test/testable-agent-base.test.ts.

Breaking change

@forestadmin/agent-client no longer exports the overridePermissions option of createRemoteAgentClient, nor the PermissionsOverride / CollectionPermissionsOverride / SmartActionPermissionsOverride types. These were test-only — consumers should use @forestadmin/agent-testing. No known production consumer used them (verified: only agent-testing imported them).

Tests

  • agent-client: 317 pass (override tests removed).
  • agent-testing: new testable-agent-base.test.ts 6 pass (moved override tests).
  • Both build; mcp-server builds against the trimmed agent-client. Lint clean.

🤖 Generated with Claude Code

Note

Move permission override types and methods from agent-client to agent-testing

  • Removes overrideCollectionPermission, overrideActionPermission, clearPermissionOverride, and related types from RemoteAgentClient in agent-client and its public exports.
  • Moves these capabilities into a new TestableAgentBase subclass in agent-testing, which accepts an overridePermissions callback and re-implements the three override methods.
  • Extracts the permission override types into a local permission-overrides.ts module so agent-testing no longer depends on agent-client for them.
  • Risk: createRemoteAgentClient no longer accepts overridePermissions; callers relying on this parameter must switch to TestableAgentBase.

Macroscope summarized feaed65.

…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>
@Scra3 Scra3 force-pushed the refactor/move-permission-overrides-to-testing branch from f73495f to 94bcb10 Compare June 25, 2026 12:30
@qltysh

qltysh Bot commented Jun 25, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

This PR will not change total coverage.

Modified Files with Diff Coverage (1)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
packages/agent-testing/src/testable-agent-base.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant