@@ -4,25 +4,24 @@ import { canonicalJson, sha256 } from "../src/core/canonical.ts";
44import { toCsv , toJsonLines } from "../src/export/serialize.ts" ;
55import { verifyRelease } from "../src/export/verify.ts" ;
66import { assignApproachColors } from "./approach-colors.ts" ;
7+ import {
8+ classifyPublicOutcome ,
9+ type PublicAttemptClassificationInput ,
10+ type PublicAttemptOutcome ,
11+ } from "./attempt-outcome.ts" ;
712import { buildStaticSite } from "./build.ts" ;
813import {
914 type FormalReleaseStatus ,
1015 formalReleaseDesignationSchema ,
1116 publicReleaseSchema ,
1217} from "./contracts.ts" ;
1318
14- interface FormalAttempt {
19+ interface FormalAttempt extends PublicAttemptClassificationInput {
1520 attempt_id : string ;
1621 case_id : string ;
1722 system_id : string ;
1823 replicate : number ;
19- generation_state : string ;
20- generation_outcome : string | null ;
2124 generation_error : string | null ;
22- evaluation_status : string | null ;
23- evaluator_strict_success : boolean | null ;
24- strict_success : boolean | null ;
25- generation_budget_status : "compliant" | "exceeded" | "unverifiable" | null ;
2625 evaluation_failure : string | null ;
2726 generation_duration_ms : number | null ;
2827 cost_amount : number | null ;
@@ -35,15 +34,7 @@ interface PublicAttempt {
3534 system_id : string ;
3635 replicate : number ;
3736 lifecycle : string ;
38- outcome :
39- | "accepted"
40- | "quality_failed"
41- | "abstained"
42- | "generation_failed"
43- | "budget_exceeded"
44- | "budget_unverifiable"
45- | "infrastructure_failed"
46- | "not_started" ;
37+ outcome : PublicAttemptOutcome ;
4738 strict_accepted : boolean | null ;
4839 evaluator_strict_accepted ?: boolean | null ;
4940 generation_completed : boolean ;
@@ -96,46 +87,6 @@ async function readJson<T>(path: string): Promise<T> {
9687 return JSON . parse ( await readFile ( path , "utf8" ) ) as T ;
9788}
9889
99- function disposition ( attempt : FormalAttempt ) : PublicAttempt [ "outcome" ] {
100- if ( attempt . generation_state === "planned" ) {
101- return "not_started" ;
102- }
103- const generated =
104- attempt . generation_state === "completed" && attempt . generation_outcome === "succeeded" ;
105- if ( attempt . generation_state === "completed" && attempt . generation_outcome === "abstained" ) {
106- return "abstained" ;
107- }
108- if ( attempt . generation_outcome === "infra_failed" ) {
109- return "infrastructure_failed" ;
110- }
111- if ( attempt . generation_state === "completed" && attempt . generation_outcome !== "succeeded" ) {
112- return "generation_failed" ;
113- }
114- if ( generated && attempt . generation_budget_status === "exceeded" ) {
115- return "budget_exceeded" ;
116- }
117- if ( generated && attempt . generation_budget_status === "unverifiable" ) {
118- return "budget_unverifiable" ;
119- }
120- const evaluatorStrictSuccess = attempt . evaluator_strict_success ?? attempt . strict_success ;
121- if (
122- generated &&
123- attempt . generation_budget_status === "compliant" &&
124- attempt . evaluation_status === "succeeded" &&
125- evaluatorStrictSuccess === true
126- ) {
127- return "accepted" ;
128- }
129- if (
130- generated &&
131- attempt . evaluation_status === "quality_failed" &&
132- evaluatorStrictSuccess === false
133- ) {
134- return "quality_failed" ;
135- }
136- return "infrastructure_failed" ;
137- }
138-
13990function strictValue ( outcome : PublicAttempt [ "outcome" ] ) : boolean | null {
14091 if ( outcome === "accepted" ) {
14192 return true ;
@@ -235,7 +186,7 @@ export async function publishSite(options: {
235186 await readFile ( join ( releaseDirectory , "data" , "attempts.jsonl" ) , "utf8" ) ,
236187 ) ;
237188 const publicAttempts : PublicAttempt [ ] = attempts . map ( ( attempt ) => {
238- const outcome = disposition ( attempt ) ;
189+ const outcome = classifyPublicOutcome ( attempt ) ;
239190 const costUsd =
240191 attempt . generation_state === "planned"
241192 ? 0
0 commit comments