@@ -29,8 +29,19 @@ function getScoreColor(percentage: number): string {
2929 return 'text-ctp-red' ;
3030}
3131
32+ /** Sort reports by score (highest first) */
33+ function sortByScore ( reports : MatrixType [ 'reports' ] ) {
34+ return [ ...reports ] . sort ( ( a , b ) => {
35+ const aPercent = getTotalCount ( a ) > 0 ? getPassedCount ( a ) / getTotalCount ( a ) : 0 ;
36+ const bPercent = getTotalCount ( b ) > 0 ? getPassedCount ( b ) / getTotalCount ( b ) : 0 ;
37+ return bPercent - aPercent ;
38+ } ) ;
39+ }
40+
3241/** Summary table showing tier scores for each kernel */
3342export function SummaryTable ( { matrix } : ConformanceMatrixProps ) {
43+ const sortedReports = sortByScore ( matrix . reports ) ;
44+
3445 return (
3546 < div className = "rounded-lg border border-ctp-surface0 overflow-x-auto bg-ctp-mantle" >
3647 < Table >
@@ -47,7 +58,7 @@ export function SummaryTable({ matrix }: ConformanceMatrixProps) {
4758 </ TableRow >
4859 </ TableHeader >
4960 < TableBody >
50- { matrix . reports . map ( ( report ) => {
61+ { sortedReports . map ( ( report ) => {
5162 const passed = getPassedCount ( report ) ;
5263 const total = getTotalCount ( report ) ;
5364 const percentage = total > 0 ? Math . round ( ( passed / total ) * 100 ) : 0 ;
@@ -101,6 +112,7 @@ export function SummaryTable({ matrix }: ConformanceMatrixProps) {
101112
102113/** Detailed matrix showing all tests vs all kernels */
103114export function DetailedMatrix ( { matrix } : ConformanceMatrixProps ) {
115+ const sortedReports = sortByScore ( matrix . reports ) ;
104116 const testNames = getAllTestNames ( matrix ) ;
105117
106118 // Group tests by category for display
@@ -128,7 +140,7 @@ export function DetailedMatrix({ matrix }: ConformanceMatrixProps) {
128140 < TableHeader className = "sticky top-0 z-20 bg-ctp-mantle" >
129141 < TableRow className = "border-ctp-surface0 hover:bg-transparent" >
130142 < TableHead className = "min-w-[200px] sticky left-0 z-30 bg-ctp-mantle text-ctp-subtext0" > Test</ TableHead >
131- { matrix . reports . map ( ( report ) => {
143+ { sortedReports . map ( ( report ) => {
132144 const LanguageIcon = getLanguageIcon ( report . kernel_name , report . language ) ;
133145 return (
134146 < TableHead key = { report . kernel_name } className = "text-center min-w-[80px] text-ctp-subtext0 py-3 bg-ctp-mantle" >
@@ -153,7 +165,7 @@ export function DetailedMatrix({ matrix }: ConformanceMatrixProps) {
153165 < TableCell className = "font-semibold text-xs uppercase tracking-wide sticky left-0 z-10 bg-ctp-surface0 text-ctp-mauve" >
154166 { TIER_DESCRIPTIONS [ tier ] }
155167 </ TableCell >
156- { matrix . reports . map ( ( report ) => (
168+ { sortedReports . map ( ( report ) => (
157169 < TableCell key = { report . kernel_name } className = "bg-ctp-surface0" />
158170 ) ) }
159171 </ TableRow >
@@ -163,7 +175,7 @@ export function DetailedMatrix({ matrix }: ConformanceMatrixProps) {
163175 < TableCell className = "font-mono text-xs sticky left-0 z-10 bg-ctp-mantle text-ctp-text" >
164176 { testName }
165177 </ TableCell >
166- { matrix . reports . map ( ( report ) => {
178+ { sortedReports . map ( ( report ) => {
167179 const test = report . results . find ( ( t ) => t . name === testName ) ;
168180 return (
169181 < TableCell key = { report . kernel_name } className = "text-center" >
0 commit comments