Commit ec3d701
fix(ocap-kernel): accept durable/virtual/faceted vrefs in isVRef (#949)
## Summary
- Widens `isVRef` to match the full vref grammar produced by
`@agoric/swingset-liveslots`'s `parseVatSlot` — durable (`o+d10/1`),
virtual (`o+v3/4`), and faceted (`o+d10/1:0`) forms.
- Previously the regex was `^[op][+-]\d+$`, which rejected any vat using
`defineDurableKind`. The branding refactor in #917 made `isVRef`
load-bearing through `EndpointMessageStruct`, `insistERef`, and
`parseReachableAndVatSlot`, so any vat using durable kinds would fail
outgoing-send validation and persisted-slot reads. Existing
kernel-internal tests didn't exercise this path; the bug surfaced when a
vat in a downstream branch used `defineDurableKind` for a public facet
and bootstrap died with `not a valid endpoint message`.
`isKRef` and `isRRef` are unchanged — kernel and remote allocators don't
emit durability suffixes.
## Test plan
- [x] `yarn workspace @MetaMask/ocap-kernel test` (2341 passing locally)
- [x] Live verification: a vat using `VatData.defineDurableKind` for its
public facet now boots cleanly through `launchSubcluster` (previously
failed at the first outgoing eventual-send from `bootstrap`)
- [ ] CI green
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes core reference validation (`isVRef`/`insistERef`) used at RPC
and message translation boundaries; a regex bug could either reject
valid traffic or inadvertently accept malformed refs.
>
> **Overview**
> Fixes vat reference validation to accept the full liveslots vref
grammar, including durable (`o+d10/1`), virtual (`o+v3/4`), and faceted
(`o+d10/1:0`) object refs.
>
> Updates `isVRef` to a stricter grammar-aware regex (only allowing
durability/subid/facet syntax on `o+`), expands unit tests for
`isVRef`/`insistVRef`/`isERef`/`insistERef`, and records the fix in the
changelog to prevent endpoint message validation from breaking vats that
use durable kinds.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
9c1cffa. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent eeae1ee commit ec3d701
3 files changed
Lines changed: 48 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
602 | 602 | | |
603 | 603 | | |
604 | 604 | | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
611 | 620 | | |
612 | 621 | | |
613 | 622 | | |
| |||
616 | 625 | | |
617 | 626 | | |
618 | 627 | | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
619 | 638 | | |
620 | 639 | | |
621 | 640 | | |
| |||
624 | 643 | | |
625 | 644 | | |
626 | 645 | | |
627 | | - | |
| 646 | + | |
628 | 647 | | |
629 | 648 | | |
630 | 649 | | |
| |||
680 | 699 | | |
681 | 700 | | |
682 | 701 | | |
683 | | - | |
| 702 | + | |
684 | 703 | | |
685 | 704 | | |
686 | 705 | | |
| |||
698 | 717 | | |
699 | 718 | | |
700 | 719 | | |
701 | | - | |
| 720 | + | |
702 | 721 | | |
703 | 722 | | |
704 | 723 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
105 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
106 | 120 | | |
107 | 121 | | |
108 | 122 | | |
| |||
139 | 153 | | |
140 | 154 | | |
141 | 155 | | |
142 | | - | |
| 156 | + | |
| 157 | + | |
143 | 158 | | |
144 | 159 | | |
145 | 160 | | |
| |||
0 commit comments