1313import type { LeaseRegistry } from '../../../src/daemon/lease-registry.ts' ;
1414import type { SessionStore } from '../../../src/daemon/session-store.ts' ;
1515
16- import type { InMemoryClaimRegistry } from './claim-registry.ts' ;
1716import type { SessionInstance } from './bindings.ts' ;
1817
18+ export type ClaimSnapshot = { deviceKey : string ; session : string } ;
19+
1920export type InvariantFailure = {
2021 invariant : string ;
2122 detail : string ;
@@ -25,7 +26,8 @@ export type InvariantFailure = {
2526export type WorldView = {
2627 sessionStore : SessionStore ;
2728 leaseRegistry : LeaseRegistry ;
28- claims : InMemoryClaimRegistry ;
29+ claimSnapshot : readonly ClaimSnapshot [ ] ;
30+ claimOwner ( deviceKey : string ) : string | undefined ;
2931 instances : readonly SessionInstance [ ] ;
3032 isInstanceLive ( instance : SessionInstance ) : boolean ;
3133 deviceActive : ReadonlyMap < string , number > ;
@@ -169,7 +171,7 @@ class InvariantChecker {
169171 }
170172
171173 private checkNoLeakedClaims ( ) : void {
172- const claims = this . view . claims . snapshot ( ) ;
174+ const claims = this . view . claimSnapshot ;
173175 for ( const claim of claims ) {
174176 if ( ! this . view . sessionStore . get ( claim . session ) ) {
175177 this . fail (
@@ -189,7 +191,7 @@ class InvariantChecker {
189191 private checkLiveClaimsHeld ( ) : void {
190192 for ( const session of this . view . sessionStore . values ( ) ) {
191193 if ( ! session . deviceClaim ) continue ;
192- const owner = this . view . claims . ownerSession ( session . deviceClaim . deviceKey ) ;
194+ const owner = this . view . claimOwner ( session . deviceClaim . deviceKey ) ;
193195 if ( owner !== session . name ) {
194196 this . fail (
195197 'no leaked claims' ,
0 commit comments