@@ -65,7 +65,7 @@ const fixture = Effect.fn("AntigravityUsageTest.fixture")(function* (
6565 userId ?: string ;
6666 userInfoAt ?: number ;
6767 missingToken ?: boolean ;
68- authMethod ?: "oauth-personal" | "gemini-api-key" ;
68+ authMethod ?: "oauth-personal" | "oauth-business" | " gemini-api-key";
6969 } = { } ,
7070) {
7171 const fs = yield * FileSystem . FileSystem ;
@@ -330,11 +330,12 @@ describe("Antigravity subscription limits", () => {
330330 } ) . pipe ( Effect . scoped , Effect . provide ( Layer . mergeAll ( NodeServices . layer , NodeCrypto . layer ) ) ) ,
331331 ) ;
332332
333- // Oracle: the existing endpoint merge keeps the most-used reading.
334- it . effect ( "keeps the used endpoint reading and its reset over an untouched reading " , ( ) =>
333+ // Oracle: workspace sign-ins are metered on cloudcode-pa, so its reading wins even when less used .
334+ it . effect ( "reports a business account's quota from the endpoint it is metered on " , ( ) =>
335335 Effect . gen ( function * ( ) {
336336 yield * TestClock . setTime ( DateTime . toEpochMillis ( DateTime . makeUnsafe ( "2026-10-21T10:16:04Z" ) ) ) ;
337337 const { probe } = yield * fixture ( {
338+ authMethod : "oauth-business" ,
338339 summaryByHost : {
339340 "daily-cloudcode-pa.googleapis.com" : {
340341 buckets : [
@@ -383,9 +384,8 @@ describe("Antigravity subscription limits", () => {
383384 id : "3p-weekly" ,
384385 label : "Claude & GPT (shared) · Weekly" ,
385386 kind : "weekly" ,
386- usedPercent : 50 ,
387+ usedPercent : 0 ,
387388 windowDurationMins : 10080 ,
388- resetsAt : "2026-10-27T10:16:04.000Z" ,
389389 } ,
390390 ] ) ;
391391 } ) . pipe ( Effect . scoped , Effect . provide ( Layer . mergeAll ( NodeServices . layer , NodeCrypto . layer ) ) ) ,
@@ -474,7 +474,43 @@ describe("Antigravity subscription limits", () => {
474474 const byId = new Map ( limits . windows . map ( ( window ) => [ window . id , window ] ) ) ;
475475 expect ( byId . get ( "gemini-weekly" ) ?. label ) . toBe ( "Gemini · Weekly" ) ;
476476 expect ( byId . get ( "3p-5h" ) ?. usedPercent ) . toBeCloseTo ( 70 ) ;
477- expect ( byId . get ( "3p-weekly" ) ?. usedPercent ) . toBe ( 100 ) ;
477+ expect ( byId . get ( "3p-weekly" ) ?. usedPercent ) . toBe ( 50 ) ;
478+ } ) . pipe ( Effect . scoped , Effect . provide ( Layer . mergeAll ( NodeServices . layer , NodeCrypto . layer ) ) ) ,
479+ ) ;
480+
481+ // Oracle: reported payloads for a personal sign-in, whose runtime meters on the daily endpoint.
482+ it . effect ( "reports a personal account's quota from the daily endpoint it is metered on" , ( ) =>
483+ Effect . gen ( function * ( ) {
484+ yield * TestClock . setTime ( DateTime . toEpochMillis ( DateTime . makeUnsafe ( "2026-11-07T12:00:00Z" ) ) ) ;
485+ const argon = ( remainingFraction : number , resetTime : string ) => ( {
486+ groups : [
487+ {
488+ displayName : "Gemini 4 Argon" ,
489+ buckets : [
490+ {
491+ bucketId : "gemini-argon-wtu-weekly" ,
492+ window : "weekly" ,
493+ remainingFraction,
494+ resetTime,
495+ } ,
496+ ] ,
497+ } ,
498+ ] ,
499+ } ) ;
500+ const { probe } = yield * fixture ( {
501+ authMethod : "oauth-personal" ,
502+ summaryByHost : {
503+ "daily-cloudcode-pa.googleapis.com" : argon ( 0.8623059 , "2026-11-14T08:41:35Z" ) ,
504+ "cloudcode-pa.googleapis.com" : argon ( 0 , "2026-11-08T18:27:14Z" ) ,
505+ } ,
506+ } ) ;
507+ expect ( ( yield * probe ) . windows ) . toEqual ( [
508+ expect . objectContaining ( {
509+ id : "gemini-argon-wtu-weekly" ,
510+ usedPercent : expect . closeTo ( 13.77 , 2 ) ,
511+ resetsAt : "2026-11-14T08:41:35.000Z" ,
512+ } ) ,
513+ ] ) ;
478514 } ) . pipe ( Effect . scoped , Effect . provide ( Layer . mergeAll ( NodeServices . layer , NodeCrypto . layer ) ) ) ,
479515 ) ;
480516
0 commit comments