@@ -6,25 +6,63 @@ import { validateRawResult } from './schema.ts';
66import type { BenchmarkResult } from './types.ts' ;
77
88/**
9- * The evidence/ios-snapshot branch tip is mutable; this annotated tag and the full commit SHA
10- * below are the durable, immutable ref the corpus is pinned to . Re-tag (a new suffix, a new
11- * commit) if the corpus is ever re-measured — never move this tag .
9+ * Each corpus is pinned by an annotated tag on the mutable `evidence/ios-snapshot` branch tip plus
10+ * the full evidence commit below . Re-tag (a new suffix, a new commit) if a corpus is ever
11+ * re-measured — never move these tags .
1212 */
13- const EVIDENCE_TAG = 'refs/tags/evidence/ios-snapshot/71fb2483f' ;
14- const EVIDENCE_COMMIT = '2d4baf461aa8897d49c6d4683cd16d8f43588ae8' ;
15- export const DEFAULT_EVIDENCE_DIR = path . join ( import . meta. dirname , 'evidence' ) ;
16- export const EVIDENCE_FIXTURE_PATH = path . join ( import . meta. dirname , 'evidence-fixture.v1.json' ) ;
13+ export type PublishedCorpus = {
14+ /** Revision the leg measured, as a full SHA. */
15+ revision : string ;
16+ /** Durable ref the corpus is fetched from. */
17+ tag : string ;
18+ /** Evidence-branch commit holding the files. */
19+ commit : string ;
20+ /** Corpus file name -> sha256. */
21+ files : Readonly < Record < string , string > > ;
22+ } ;
23+
24+ const BASELINE_CORPUS : PublishedCorpus = {
25+ revision : '71fb2483f30d90e615e949601c836aeebbf450c5' ,
26+ tag : 'refs/tags/evidence/ios-snapshot/71fb2483f' ,
27+ commit : '2d4baf461aa8897d49c6d4683cd16d8f43588ae8' ,
28+ files : {
29+ 'ios-snapshot-cold-local-71fb2483f.json' :
30+ '532a83247bfbf8ee47039f80ac429f067c84679e92c781768c1044da1ae6e9bf' ,
31+ 'ios-snapshot-warm-relaunch-local-71fb2483f.json' :
32+ '6d299e8baec69662dca2c1ad8f1348e4361d5afaa781080e9a6b9b3dac362cbf' ,
33+ 'ios-snapshot-proxy-71fb2483f.json' :
34+ 'b11b7a07be9e4dcf003f3af66943682a6733c6f21f5f43d3d9e88b3fb37b51a7' ,
35+ } ,
36+ } ;
1737
18- /** Raw results published on the evidence branch, keyed by file name; measured at 71fb2483f. */
19- export const PUBLISHED_EVIDENCE : Readonly < Record < string , string > > = {
20- 'ios-snapshot-cold-local-71fb2483f.json' :
21- '532a83247bfbf8ee47039f80ac429f067c84679e92c781768c1044da1ae6e9bf' ,
22- 'ios-snapshot-warm-relaunch-local-71fb2483f.json' :
23- '6d299e8baec69662dca2c1ad8f1348e4361d5afaa781080e9a6b9b3dac362cbf' ,
24- 'ios-snapshot-proxy-71fb2483f.json' :
25- 'b11b7a07be9e4dcf003f3af66943682a6733c6f21f5f43d3d9e88b3fb37b51a7' ,
38+ const CONVERGENCE_FINAL_CORPUS : PublishedCorpus = {
39+ revision : '7c434b575837e3291c51315bf9bb8b54c8ce7568' ,
40+ tag : 'refs/tags/evidence/ios-snapshot/7c434b575' ,
41+ commit : '96d4951c19fbe009ba19d192a9774668edcc3f56' ,
42+ files : {
43+ 'ios-snapshot-cold-local-7c434b575.json' :
44+ '4663897ee5104569ad54e2ac803c216b284280c1c70fd82a8b2cf7b675d8a8bd' ,
45+ 'ios-snapshot-first-interaction-local-7c434b575.json' :
46+ '87c686336f5581e3f18111e160cf7b733cd726b41e79ed6d8e5b53e2ab40c3fb' ,
47+ 'ios-snapshot-warm-relaunch-local-7c434b575.json' :
48+ 'd49df3c3c943178f016a2b958449b257c6d46a44c8ffdf8fab75c1634ae1ebce' ,
49+ 'ios-snapshot-proxy-7c434b575.json' :
50+ '5b5353831851f3a0f60e19d6bfd0cf50db47c3c4db52a283024c10bb17e71573' ,
51+ } ,
2652} ;
2753
54+ export const PUBLISHED_CORPORA : readonly PublishedCorpus [ ] = [
55+ BASELINE_CORPUS ,
56+ CONVERGENCE_FINAL_CORPUS ,
57+ ] ;
58+
59+ /** Raw results published on the evidence branch, keyed by file name across every corpus. */
60+ export const PUBLISHED_EVIDENCE : Readonly < Record < string , string > > = Object . fromEntries (
61+ PUBLISHED_CORPORA . flatMap ( ( corpus ) => Object . entries ( corpus . files ) ) ,
62+ ) ;
63+ export const DEFAULT_EVIDENCE_DIR = path . join ( import . meta. dirname , 'evidence' ) ;
64+ export const EVIDENCE_FIXTURE_PATH = path . join ( import . meta. dirname , 'evidence-fixture.v1.json' ) ;
65+
2866export type EvidenceFile = {
2967 file : string ;
3068 sha256 : string ;
@@ -35,9 +73,31 @@ export type EvidenceFile = {
3573 errors : string [ ] ;
3674} ;
3775
38- export function fetchEvidenceCommand ( file = '< file>' ) : string {
76+ function corpusFetchCommand ( corpus : PublishedCorpus , file : string ) : string {
3977 const destination = path . posix . join ( 'scripts/ios-snapshot-benchmark/evidence' , file ) ;
40- return `git fetch origin ${ EVIDENCE_TAG } && git show ${ EVIDENCE_COMMIT } :${ file } > ${ destination } ` ;
78+ return `git show ${ corpus . commit } :${ file } > ${ destination } ` ;
79+ }
80+
81+ /**
82+ * The fetch recipe for one corpus file. An unknown name falls back to the newest corpus, which is
83+ * what a generic hint should recommend.
84+ */
85+ export function fetchEvidenceCommand ( file = '<file>' ) : string {
86+ const corpus =
87+ PUBLISHED_CORPORA . find ( ( candidate ) => file in candidate . files ) ?? PUBLISHED_CORPORA . at ( - 1 ) ! ;
88+ return `git fetch origin ${ corpus . tag } && ${ corpusFetchCommand ( corpus , file ) } ` ;
89+ }
90+
91+ /** One shell line per corpus that holds any of `files`, so a hint never names the wrong commit. */
92+ function fetchEvidenceCommands ( files : readonly string [ ] ) : string {
93+ const lines : string [ ] = [ ] ;
94+ for ( const corpus of PUBLISHED_CORPORA ) {
95+ const missing = files . filter ( ( file ) => file in corpus . files ) ;
96+ if ( missing . length === 0 ) continue ;
97+ const fetches = missing . map ( ( file ) => corpusFetchCommand ( corpus , file ) ) ;
98+ lines . push ( `git fetch origin ${ corpus . tag } && ${ fetches . join ( ' && ' ) } ` ) ;
99+ }
100+ return lines . join ( '\n' ) ;
41101}
42102
43103export function listEvidenceFiles ( dir : string ) : string [ ] {
@@ -133,8 +193,8 @@ export function checkEvidenceCorpus(dir: string, files: EvidenceFile[], isDefaul
133193 const missing = missingPublishedEvidence ( files ) ;
134194 if ( missing . length > 0 ) {
135195 throw new Error (
136- `${ dir } is missing published evidence file(s): ${ missing . join ( ', ' ) } . Fetch them with: ` +
137- `${ fetchEvidenceCommand ( ) } ` ,
196+ `${ dir } is missing published evidence file(s): ${ missing . join ( ', ' ) } .\n ` +
197+ `Fetch them with:\n ${ fetchEvidenceCommands ( missing ) } ` ,
138198 ) ;
139199 }
140200 }
@@ -144,7 +204,10 @@ function runEvidenceReport(argv: string[]): void {
144204 const { dir, isDefault } = readEvidenceDirOption ( argv ) ;
145205 const files = readEvidenceDir ( dir ) ;
146206 if ( files . length === 0 ) {
147- throw new Error ( `${ dir } holds no evidence; fetch it with: ${ fetchEvidenceCommand ( ) } ` ) ;
207+ throw new Error (
208+ `${ dir } holds no evidence; fetch it with:\n` +
209+ `${ fetchEvidenceCommands ( Object . keys ( PUBLISHED_EVIDENCE ) ) } ` ,
210+ ) ;
148211 }
149212 process . stdout . write ( renderEvidenceReport ( dir , files ) ) ;
150213 checkEvidenceCorpus ( dir , files , isDefault ) ;
0 commit comments