@@ -95,7 +95,7 @@ describe('Element ML Fields', () => {
9595 } ;
9696
9797 expect ( element . id ) . toBe ( 1 ) ;
98- expect ( element ) . not . toHaveProperty ( 'rerank_index ' ) ;
98+ expect ( element ) . not . toHaveProperty ( 'fused_rank_index ' ) ;
9999 expect ( element ) . not . toHaveProperty ( 'heuristic_index' ) ;
100100 expect ( element ) . not . toHaveProperty ( 'ml_probability' ) ;
101101 expect ( element ) . not . toHaveProperty ( 'ml_score' ) ;
@@ -112,13 +112,13 @@ describe('Element ML Fields', () => {
112112 in_viewport : true ,
113113 is_occluded : false ,
114114 z_index : 1 ,
115- rerank_index : 0 ,
115+ fused_rank_index : 0 ,
116116 heuristic_index : 5 ,
117117 ml_probability : 0.95 ,
118118 ml_score : 2.34 ,
119119 } ;
120120
121- expect ( element . rerank_index ) . toBe ( 0 ) ;
121+ expect ( element . fused_rank_index ) . toBe ( 0 ) ;
122122 expect ( element . heuristic_index ) . toBe ( 5 ) ;
123123 expect ( element . ml_probability ) . toBe ( 0.95 ) ;
124124 expect ( element . ml_score ) . toBe ( 2.34 ) ;
@@ -135,13 +135,46 @@ describe('Element ML Fields', () => {
135135 in_viewport : true ,
136136 is_occluded : false ,
137137 z_index : 0 ,
138- rerank_index : 1 ,
138+ fused_rank_index : 1 ,
139139 ml_probability : 0.87 ,
140140 } ;
141141
142- expect ( element . rerank_index ) . toBe ( 1 ) ;
142+ expect ( element . fused_rank_index ) . toBe ( 1 ) ;
143143 expect ( element ) . not . toHaveProperty ( 'heuristic_index' ) ;
144144 expect ( element . ml_probability ) . toBe ( 0.87 ) ;
145145 expect ( element ) . not . toHaveProperty ( 'ml_score' ) ;
146146 } ) ;
147147} ) ;
148+
149+ describe ( 'Snapshot ML Rerank Metadata' , ( ) => {
150+ it ( 'should accept snapshot with ml_rerank metadata' , ( ) => {
151+ const snap = {
152+ status : 'success' as const ,
153+ url : 'https://example.com' ,
154+ elements : [ ] ,
155+ ml_rerank : {
156+ enabled : true ,
157+ applied : false ,
158+ reason : 'low_confidence' ,
159+ candidate_count : 25 ,
160+ top_probability : 0.42 ,
161+ min_confidence : 0.6 ,
162+ is_high_confidence : false ,
163+ tags : {
164+ repeated : true ,
165+ sponsored_ish : true ,
166+ non_sponsored : false ,
167+ pos : true ,
168+ occ : true ,
169+ vocc : false ,
170+ short : true ,
171+ action_ish : false ,
172+ nav_ish : false ,
173+ } ,
174+ } ,
175+ } ;
176+
177+ expect ( snap . ml_rerank . enabled ) . toBe ( true ) ;
178+ expect ( snap . ml_rerank . is_high_confidence ) . toBe ( false ) ;
179+ } ) ;
180+ } ) ;
0 commit comments