@@ -30,30 +30,6 @@ describe("normalizeCodexUsageSnapshot", () => {
3030 } ) ;
3131 } ) ;
3232
33- it ( "prefers the codex named multi-bucket over the legacy bucket" , ( ) => {
34- const snapshot = normalizeCodexUsageSnapshot ( {
35- providerInstanceId : instanceId ,
36- source : "read" ,
37- checkedAt : "2026-05-04T00:00:00.000Z" ,
38- payload : {
39- rateLimits : {
40- primary : { usedPercent : 90 , windowDurationMins : 300 } ,
41- } ,
42- rateLimitsByName : {
43- codex : {
44- primary : { usedPercent : 25 , windowDurationMins : 300 } ,
45- } ,
46- } ,
47- } ,
48- } ) ;
49-
50- expect ( snapshot ?. windows [ 0 ] ) . toMatchObject ( {
51- kind : "five-hour" ,
52- usedPercent : 25 ,
53- remainingPercent : 75 ,
54- } ) ;
55- } ) ;
56-
5733 it ( "falls back to the top-level rateLimits bucket" , ( ) => {
5834 const snapshot = normalizeCodexUsageSnapshot ( {
5935 providerInstanceId : instanceId ,
@@ -165,12 +141,15 @@ describe("normalizeCodexUsageSnapshot", () => {
165141 ] ) ;
166142 } ) ;
167143
168- it ( "maps Codex named buckets when duration metadata is absent " , ( ) => {
144+ it ( "maps named buckets when limit-id buckets are empty " , ( ) => {
169145 const snapshot = normalizeCodexUsageSnapshot ( {
170146 providerInstanceId : instanceId ,
171147 source : "read" ,
172148 payload : {
173- rateLimits : { } ,
149+ rateLimits : {
150+ primary : { usedPercent : 90 , windowDurationMins : 300 } ,
151+ } ,
152+ rateLimitsByLimitId : { } ,
174153 rateLimitsByName : {
175154 "5-hour limit" : {
176155 primary : { usedPercent : 12 } ,
@@ -200,27 +179,6 @@ describe("normalizeCodexUsageSnapshot", () => {
200179 ] ) ;
201180 } ) ;
202181
203- it ( "falls through empty limit-id buckets to named buckets" , ( ) => {
204- const snapshot = normalizeCodexUsageSnapshot ( {
205- providerInstanceId : instanceId ,
206- source : "read" ,
207- payload : {
208- rateLimits : { } ,
209- rateLimitsByLimitId : { } ,
210- rateLimitsByName : {
211- "5-hour limit" : {
212- primary : { usedPercent : 12 } ,
213- } ,
214- } ,
215- } ,
216- } ) ;
217-
218- expect ( snapshot ?. windows [ 0 ] ) . toMatchObject ( {
219- kind : "five-hour" ,
220- usedPercent : 12 ,
221- } ) ;
222- } ) ;
223-
224182 it ( "sorts fallback limit-id buckets by display priority" , ( ) => {
225183 const snapshot = normalizeCodexUsageSnapshot ( {
226184 providerInstanceId : instanceId ,
@@ -286,12 +244,7 @@ describe("normalizeCodexUsageSnapshot", () => {
286244 primary : { usedPercent : 50 , windowDurationMins : 300 } ,
287245 rateLimitReachedType : null ,
288246 } ,
289- rateLimitsByLimitId : {
290- FiveHourLimit : {
291- primary : { usedPercent : 100 } ,
292- rateLimitReachedType : "primary" ,
293- } ,
294- } ,
247+ rateLimitsByLimitId : { } ,
295248 } ,
296249 } ) ;
297250
0 commit comments