Skip to content

test(kernel): two-kernel revocation test - #1028

Open
sirtimid wants to merge 2 commits into
mainfrom
sirtimid/test-cross-kernel-revocation
Open

test(kernel): two-kernel revocation test #1028
sirtimid wants to merge 2 commits into
mainfrom
sirtimid/test-cross-kernel-revocation

Conversation

@sirtimid

@sirtimid sirtimid commented Aug 24, 2026

Copy link
Copy Markdown
Member

Closes #995.

Revocation is one of the core ocap properties, but nothing previously tested it across the boundary where it matters most — an object exported from kernel A and held by a remote kernel B. This PR adds that test at two levels.

Changes

  • packages/kernel-test/src/vats/revocation-target-vat.ts — new test vat that exports a target exo and a bystander exo, issues ocap URLs for both in bootstrap, and exposes getTarget() / getBystander() so the test can extract the kernel-level KRef for revocation.
  • packages/kernel-test/src/remote-comms.test.ts — new integration test 'revokes a cross-kernel object held by a remote peer' added to the existing two-kernel harness (DirectNetworkService, no relay required). Covers the five-step scenario from the issue: export → B invokes → A revokes via kernel.revoke() → B's next call fails with OBJECT_REVOKED → bystander unaffected.
  • packages/kernel-node-runtime/test/e2e/remote-comms.test.ts — new describe('Revocation') block in the real-relay e2e suite. Uses two instances of remote-vat.js on kernel A (Target + Bystander) and a Sender vat on kernel B, exercising the same five steps over a live libp2p relay.

Testing

The integration test runs in yarn workspace @ocap/kernel-test test and passes in ~2.6 s using the in-memory DirectNetworkService mock. The e2e test runs via yarn workspace @metamask/kernel-node-runtime test:e2e:ci (which starts the relay + bundle server) and passes in ~5.9 s over a real libp2p relay. Both test suites pass with no regressions.

🤖 Generated with Claude Code


Note

Low Risk
Test-only additions; no production kernel or remote-comms behavior changes in this diff.

Overview
Adds end-to-end and integration tests that exercise ocap revocation when an object exported from kernel A is held and invoked by kernel B.

A new revocation-target-vat test vat issues ocap URLs for a revocable target and an unrelated bystander, and exposes getTarget() so tests can obtain a KRef and call kernel1.revoke(). Both suites follow the same five-step flow: remote ping succeeds, revocation on the exporter, the peer’s next call rejects with OBJECT_REVOKED, and calls to the bystander still succeed.

Coverage lands in kernel-test (two-kernel harness with DirectNetworkService) and kernel-node-runtime e2e (real relay, Target/Bystander/Sender vats via sendRemoteMessage).

Reviewed by Cursor Bugbot for commit 1ef30b6. Bugbot is set up for automated code reviews on this repo. Configure here.

sirtimid and others added 2 commits August 24, 2026 18:09
Add a two-kernel revocation test to both the fast integration harness
and the full e2e suite, covering the five-step scenario from issue #995:
export an object via ocap URL, assert the remote peer can invoke it,
revoke it through the public kernel.revoke API, assert the peer's next
invocation fails with OBJECT_REVOKED, and assert an unrelated bystander
object is unaffected.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@sirtimid
sirtimid requested a review from a team as a code owner August 24, 2026 16:20
@sirtimid sirtimid added the no-changelog Indicates that no changelog updates are required, and that related CI checks should be skipped. label Aug 24, 2026
@sirtimid sirtimid changed the title test(kernel): two-kernel revocation test (#995) test(kernel): two-kernel revocation test Aug 24, 2026
@sirtimid
sirtimid enabled auto-merge August 24, 2026 16:28
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 72.55%
⬇️ -0.08%
9697 / 13365
🔵 Statements 72.4%
⬇️ -0.08%
9860 / 13617
🔵 Functions 72.99%
⬇️ -0.14%
2276 / 3118
🔵 Branches 66.91%
⬇️ -0.04%
3990 / 5963
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/kernel-test/src/vats/revocation-target-vat.ts 0% 0% 0% 0% 23-55
Generated in workflow #4670 for commit 1ef30b6 by the Vitest Coverage Report Action

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

Labels

no-changelog Indicates that no changelog updates are required, and that related CI checks should be skipped.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No test covers revoking an object held by a remote peer

1 participant