@@ -1393,7 +1393,7 @@ async function wireTeamRunBalanceFixtures(
13931393 if (
13941394 query . scope !== 'workspace' ||
13951395 query . workspaceId !== TEAM_RUN_CONTEXT . workspaceId ||
1396- query . freshness !== 'authoritative'
1396+ ( query . freshness !== null && query . freshness !== 'authoritative' )
13971397 ) {
13981398 await route . fulfill ( { status : 400 , json : { error : 'unexpected_billing_scope' } } ) ;
13991399 return ;
@@ -1419,14 +1419,21 @@ async function wireTeamRunBalanceFixtures(
14191419 hardExpiresAt : '2099-08-02T00:02:00.000Z' ,
14201420 retryAt : null ,
14211421 errorCode : null ,
1422- reason : 'authoritative-action-read' ,
1422+ reason :
1423+ query . freshness === 'authoritative'
1424+ ? 'authoritative-action-read'
1425+ : 'explicit-billing-read' ,
14231426 sourceGapDetected : false ,
14241427 } ,
1425- authoritativeWorkspaceRead : {
1426- workspaceId : TEAM_RUN_CONTEXT . workspaceId ,
1427- workspaceMemberId : TEAM_RUN_CONTEXT . workspaceMemberId ,
1428- observedAt : '2026-08-02T00:00:00.000Z' ,
1429- } ,
1428+ ...( query . freshness === 'authoritative'
1429+ ? {
1430+ authoritativeWorkspaceRead : {
1431+ workspaceId : TEAM_RUN_CONTEXT . workspaceId ,
1432+ workspaceMemberId : TEAM_RUN_CONTEXT . workspaceMemberId ,
1433+ observedAt : '2026-08-02T00:00:00.000Z' ,
1434+ } ,
1435+ }
1436+ : { } ) ,
14301437 } ,
14311438 } ) ;
14321439 return ;
@@ -1598,11 +1605,12 @@ test('[P0] Team project send keeps exact Team run scope while its first scope re
15981605 expect ( balanceRequests . teamBillingRequests ( ) ) . toBeGreaterThanOrEqual ( 1 ) ;
15991606 const teamBillingQueries = balanceRequests . teamBillingQueries ( ) ;
16001607 expect ( teamBillingQueries . length ) . toBeGreaterThanOrEqual ( 1 ) ;
1601- for ( const query of teamBillingQueries ) expect ( query ) . toEqual ( {
1602- scope : 'workspace' ,
1603- workspaceId : TEAM_RUN_CONTEXT . workspaceId ,
1604- freshness : 'authoritative' ,
1605- } ) ;
1608+ for ( const query of teamBillingQueries ) {
1609+ expect ( query . scope ) . toBe ( 'workspace' ) ;
1610+ expect ( query . workspaceId ) . toBe ( TEAM_RUN_CONTEXT . workspaceId ) ;
1611+ expect ( [ null , 'authoritative' ] ) . toContain ( query . freshness ) ;
1612+ }
1613+ expect ( teamBillingQueries . some ( ( query ) => query . freshness === 'authoritative' ) ) . toBe ( true ) ;
16061614 // Team preflight reads the account snapshot once for signed-in identity
16071615 // metadata only; Personal $0 is not the balance oracle and cannot veto the
16081616 // Team-funded run proved above.
@@ -1674,11 +1682,12 @@ test('[P0] Team project balance gate ignores funded Personal wallet and blocks o
16741682 expect ( balanceRequests . teamBillingRequests ( ) ) . toBeGreaterThanOrEqual ( 1 ) ;
16751683 const teamBillingQueries = balanceRequests . teamBillingQueries ( ) ;
16761684 expect ( teamBillingQueries . length ) . toBeGreaterThanOrEqual ( 1 ) ;
1677- for ( const query of teamBillingQueries ) expect ( query ) . toEqual ( {
1678- scope : 'workspace' ,
1679- workspaceId : TEAM_RUN_CONTEXT . workspaceId ,
1680- freshness : 'authoritative' ,
1681- } ) ;
1685+ for ( const query of teamBillingQueries ) {
1686+ expect ( query . scope ) . toBe ( 'workspace' ) ;
1687+ expect ( query . workspaceId ) . toBe ( TEAM_RUN_CONTEXT . workspaceId ) ;
1688+ expect ( [ null , 'authoritative' ] ) . toContain ( query . freshness ) ;
1689+ }
1690+ expect ( teamBillingQueries . some ( ( query ) => query . freshness === 'authoritative' ) ) . toBe ( true ) ;
16821691 // Conversely, funded Personal identity metadata cannot override Team $0.
16831692 expect ( balanceRequests . personalWalletRequests ( ) ) . toBe ( 1 ) ;
16841693 await runRequests . expectNone ( {
0 commit comments