test(extension): derive vat krefs in the e2e rather than hardcoding them - #1024
Merged
Conversation
`should collect garbage` asserted that Carol's root is `ko6` and Bob's is `ko5`, and that their promises are `kp4` and `kp3`. Since #983 launches subcluster vats in parallel, each root is exported when its own vat's launch finishes, so those assignments swap between runs and the test failed whenever they came back the other way round. The vat ids are stable — they are handed out in config order — so the krefs are now looked up from the dump by owner. The erefs are derived too, in full rather than by prefix: a c-list entry's reverse direction is keyed by eref and valued by kref, so matching on the kref alone also hits the owning vat's own entry for the same object, which broke the negative assertions once that vat outlived the one under test. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
Coverage Report
File CoverageNo changed files found. |
grypez
approved these changes
Aug 13, 2026
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.
Fixes a pre-existing e2e flake on
main, surfaced while rebasing the #1020–#1023 stack. Small and self-contained so the whole stack inherits it.The defect
control-panel.test.ts›should collect garbageasserted that Carol's root object isko6and Bob's isko5, and that their promises arekp4andkp3:Since #983, subcluster vats launch in parallel. Each vat's root is exported when its own launch finishes, so which of
ko5/ko6belongs to Bob and which to Carol changes between runs. When they come back the other way round, the test fails — anddatabase-inspector.test.tsfails alongside it, because it reads the same kv dump.Observed directly: a failing run had
ko6.owner = v2andko5.owner = v3, the exact inverse of what is asserted.The vat ids themselves are stable — they are handed out in config order, so alice is always
v1— so only the object and promise krefs need deriving.Approach
Three small helpers read the dump and look up what the assertions used to hardcode:
rootKrefOf(dump, vatId)by owner,promiseKrefOf(dump, vatId)by c-list entry, anderefOf(dump, vatId, kref).The erefs are derived in full rather than matched by prefix. A c-list entry's reverse direction is keyed by eref and valued by kref, so a loose
,"value":"ko5"}also matches the owning vat's ownv2.c.o+0entry. That passed while both vats were alive and broke the negative assertions the moment one outlived the other — which is what the test checks after terminating v3.Testing
yarn lintclean. Extension e2e run three times: the kref failure is gone, and the two clean runs finish in ~50s rather than ~2.7m because no retries are needed.What this does not fix. The extension e2e suite has separate instability that this change does not touch and does not claim to:
object-registry.test.tsfailures, and a UI timing flake whereTerminated vat "v1"does not render because the panel is still showing query output. One of the three runs hit those. They are unrelated to kref assignment and were present before this change.Checklist
README.md,CHANGELOG.md) as appropriate — test-only change, no changelog entryNote
Low Risk
Test-only change to e2e assertions and helpers; no production or runtime behavior is modified.
Overview
Fixes flaky
should collect garbageassertions incontrol-panel.test.tsthat assumed fixed kernel refs (ko5/ko6,kp3/kp4) for Bob and Carol. Parallel subcluster launches mean those object and promise krefs can swap between runs while vat ids (v2/v3) stay stable.Adds helpers to parse the Database Inspector kv dump and derive root krefs (via
.owner), promise krefs (via c-list), and v1’s erefs (full c-list lookup so reverse entries don’t false-match). The garbage-collection expectations are built from those values instead of literals.Reviewed by Cursor Bugbot for commit d8e81f7. Bugbot is set up for automated code reviews on this repo. Configure here.