Skip to content

Conversation

@grypez
Copy link
Contributor

@grypez grypez commented Feb 3, 2026

refactor(kernel-test): Convert vat source files to TypeScript

Summary

  • Convert test vat source files from JavaScript to TypeScript with proper type annotations
  • Add TestPowers type and unwrapTestLogger utility for test vats that need structured logging

Changes

ocap-kernel:

  • Add buildRootObject parameter types

kernel-test:

  • Rename all 38 vat source files from .js to .ts
  • Add TypeScript type annotations to all vat source files
  • Create test-powers.ts with TestPowers type and unwrapTestLogger utility
  • Update vats to use TestPowers for typed logger access

cli:

  • Update vat bundler glob pattern to include .ts files (still matches .js, too)

Note

Medium Risk
Mostly test and tooling changes, but it touches the CLI bundling glob and exports new public types from @metamask/ocap-kernel, which could affect downstream builds if assumptions about source extensions or type exports differ.

Overview
Test vats are now authored in TypeScript and bundled from .ts sources. The CLI bundleDir command expands its glob to include *.{js,ts} so vat bundles can be generated directly from TS entrypoints.

kernel-test vats were converted from .js to .ts with stronger typing and standardized logging. A new TestPowers type plus unwrapTestLogger helper centralize structured test logging, and vats add explicit parameter/service/baggage types (including durable Baggage use).

ocap-kernel exposes additional public types. VatPowers and Baggage are now exported from @metamask/ocap-kernel to support typed vat power signatures in tests.

Written by Cursor Bugbot for commit 30f557f. This will update automatically on new commits. Configure here.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 77.92%
⬇️ -9.81%
5989 / 7686
🔵 Statements 77.88%
⬇️ -9.72%
6086 / 7814
🔵 Functions 76.47%
⬇️ -9.61%
1547 / 2023
🔵 Branches 77.88%
⬇️ -6.09%
2163 / 2777
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/cli/src/commands/bundle.ts 92.3%
🟰 ±0%
50%
🟰 ±0%
100%
🟰 ±0%
92.3%
🟰 ±0%
72
packages/kernel-test/src/test-powers.ts 0% 100% 0% 0% 23-25
packages/kernel-test/src/vats/async-generator-iterator-vat.ts 0% 100% 0% 0% 22-49
packages/kernel-test/src/vats/endowment-fetch.ts 0% 100% 0% 0% 15-36
packages/kernel-test/src/vats/logger-vat.ts 0% 0% 0% 0% 21-31
packages/kernel-test/src/vats/persistence-counter-vat.ts 0% 0% 0% 0% 23-51
packages/kernel-test/src/vats/persistence-worker-vat.ts 0% 0% 0% 0% 24-54
packages/kernel-test/src/vats/powers-vat.ts 0% 0% 0% 0% 19-21
packages/kernel-test/src/vats/subcluster-vat.ts 0% 0% 0% 0% 19-38
packages/ocap-kernel/src/index.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
packages/ocap-kernel/src/types.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
Generated in workflow #3549 for commit 30f557f by the Vitest Coverage Report Action

@grypez grypez force-pushed the grypez/typescript-vats branch 3 times, most recently from 83a13ec to 38d9d6f Compare February 3, 2026 20:40
@grypez grypez force-pushed the grypez/typescript-vats branch from 38d9d6f to 6f883aa Compare February 3, 2026 20:41
@grypez grypez marked this pull request as ready for review February 3, 2026 20:55
@grypez grypez requested a review from a team as a code owner February 3, 2026 20:55
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

@grypez grypez enabled auto-merge February 3, 2026 21:21
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.

2 participants