Skip to content

test(security): use claude-code/testing tool noun in public-surface-scrub tests #1855

Closed

Description

@Kaap10

What should happen

The register() tests in plugins/magpie-security/hooks/public-surface-scrub.test.ts should dispatch tool calls via claude-code/testing's native tool noun ($.tool.call({ tool: 'Bash', command: '...' })) rather than hand-building mock on and $ fixtures.

Why

Follow-up to merged PR #1676 (noted by maintainer @potiuk in his approval review):

"One follow-up, not blocking: the register() tests still hand-build on and $ rather than using claude-code/testing's tool noun, so a drift between the mock event and the real one (like the earlier e.input.command bug) would not be caught."

Using $.tool.call tests the real event dispatch pipeline and ensures any future harness event schema drift is caught deterministically.

Which layer

Other / unsure

Boundary conditions

Host APIs invoked by the mod hook ($.session.root(), $.fs.read(), $.env.get()) should be mocked using standard on('session.root', ...) / on('fs.read', ...) / on('env.get', ...) event handlers, with on('tool.call', ...) providing the downstream next(e) fallback target.

Out of scope

No modifications to the public-surface-scrub.ts runtime logic itself; this is strictly a test suite refactoring to eliminate hand-synthesized event objects.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions