Conversation
sirtimid
added this pull request to stack #1108
September 15, 2026 22:38
Six positional parameters, four of them functions, two of which take a vat id and return a promise. CLAUDE.md asks for an options bag past two. Shaped like `SubclusterManager`'s and `VatManager`'s, which the rest of this package already uses. No behaviour change: the tests are unchanged apart from the call site. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Review follow-up: `SubclusterManagerOptions` and `VatManagerOptions` are the last declaration before their class. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
sirtimid
force-pushed
the
sirtimid/kernel-router-options-bag
branch
from
September 16, 2026 16:42
d251d5d to
912c82b
Compare
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.
Stacked on #1099, and last in the chain on purpose: three PRs were editing
KernelRouter.tsand this would have conflicted with all of them.KernelRouter's constructor had grown to six positional parameters — four ofthem functions, two of those taking a vat id and returning a promise. CLAUDE.md
asks for an options bag past two arguments. It is now one, shaped like
SubclusterManagerOptionsandVatManagerOptionsin the same package.No behaviour change, and
KernelRouteris not exported from the package's entrypoints, so there is nothing for a consumer to notice:
no-changelog.Changes
KernelRouterOptions, and a destructured constructor.Kernel.tsand two test files.Testing
The evidence that this is a move is that the tests are untouched apart from the
call-site shape: same
it/describecounts, same titles, one diff hunk perfile, confined to the
new KernelRouter(...)expression. The whole@metamask/ocap-kernelsuite passes unchanged.No new tests, deliberately. Every cross-type mis-binding is already a compile
error on the branded id types; the one type-legal swap,
restartVatagainstterminateVat, is caught by the existingrestartVatandterminateVatdescribes in
KernelRouter.test.ts. A new test would double-guard the oneguarded thing.
Two things I checked rather than assumed, both worth recording:
A bag does not make the wiring safer here. I had expected named fields to
prevent silently swapping
restartVatandterminateVat; they do not. The twosignatures are mutually assignable —
reasonbeing optional keeps the requiredarity at 1 either way — so the swap compiles positionally and in the bag alike.
This PR is a readability and convention fix, not a type-safety one.
loggeris a gap the bag's shape can reach. It is optional, so deletinglogger: this.#loggerfromKernel.tscompiles and the whole suite stillpasses — and the router's
warnon a skipped delivery is the only trace of anendpoint that has quietly stopped listening. It is wired correctly here and the
same hole existed for the positional seventh argument, so this is not a
regression; but it is the mistake this kind of conversion invites, and nothing
would catch it. Worth a test on
Kernel's side, which is not this PR.🤖 Generated with Claude Code
Note
Low Risk
Mechanical API refactor with unchanged runtime behavior;
KernelRouteris internal to the package.Overview
Refactors
KernelRouterconstruction from six positional arguments (four callbacks plus optional logger) to a singleKernelRouterOptionsobject, matching patterns likeVatManagerOptionsandSubclusterManagerOptions.Call sites in
Kernel,KernelRouter.test.ts, andKernelRouter.remote-gc.test.tsnow pass named fields (getEndpoint,invokeKernelService,restartVat,terminateVat,logger, etc.) instead of ordered parameters. No routing or delivery behavior changes—only constructor wiring and JSDoc.Reviewed by Cursor Bugbot for commit 912c82b. Bugbot is set up for automated code reviews on this repo. Configure here.