@@ -34,7 +34,14 @@ function CohortVerdictDetails({ v }: { v: Record<string, unknown> }) {
3434 const keyDivergence = String ( v . keyDivergence || '' ) ;
3535 const rankings = ( Array . isArray ( v . rankings ) ? v . rankings : [ ] ) as CohortRankingEntry [ ] ;
3636 const reasoning = String ( v . reasoning || '' ) ;
37- const actorCount = Array . isArray ( v . actors ) ? ( v . actors as unknown [ ] ) . length : rankings . length ;
37+ // Schema requires `rankings` to carry ≥ 2 entries, but a malformed
38+ // verdict payload could still arrive empty; the floor of 1 keeps the
39+ // kicker from rendering "Cohort of 0" which would never match the
40+ // banner's actor count and looks like a bug to the user.
41+ const actorCount = Math . max (
42+ 1 ,
43+ Array . isArray ( v . actors ) ? ( v . actors as unknown [ ] ) . length : rankings . length ,
44+ ) ;
3845
3946 return (
4047 < div className = { styles . cohortDetails } >
@@ -57,11 +64,11 @@ function CohortVerdictDetails({ v }: { v: Record<string, unknown> }) {
5764 const color = getActorColorVar ( r . actorIndex ) ;
5865 return (
5966 < li
60- key = { `${ r . rank } -${ r . actorName } ` }
67+ key = { `${ r . rank ?? 'unranked' } -${ r . actorName } - ${ r . actorIndex } ` }
6168 className = { styles . cohortRankingEntry }
6269 style = { { '--actor-color' : color } as CSSProperties }
6370 >
64- < div className = { styles . cohortRankBadge } > #{ r . rank } </ div >
71+ < div className = { styles . cohortRankBadge } > #{ r . rank ?? '?' } </ div >
6572 < div className = { styles . cohortRankBody } >
6673 < div className = { styles . cohortRankName } > { r . actorName } </ div >
6774 < div className = { styles . cohortRankScores } >
0 commit comments