Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA
TypeScript
Weekly benchmark records can't slip text into the release log or lose a model row (GST-3606) (#4782)
Garry Tanc34b967346f1
diff --git a/changelog.d/stable-benchmark-record-text-hardening.md b/changelog.d/stable-benchmark-record-text-hardening.mdnew file mode 100644index 000000000..a8bc6692f--- /dev/null+++ b/changelog.d/stable-benchmark-record-text-hardening.md@@ -0,0 +1,3 @@+### For contributors++- **A weekly benchmark record can no longer slip text into the release job's log through its error messages, or lose a model row to an odd model name.** When the release tool can't read a record, the reason it prints is now stripped of control characters too, and model names that collide once cleaned make the record unreadable instead of silently dropping a row.diff --git a/crew/lib/release-benchmark.ts b/crew/lib/release-benchmark.tsindex 08dca7543..22e6f9136 100644--- a/crew/lib/release-benchmark.ts+++ b/crew/lib/release-benchmark.ts@@ -45,10 +45,11 @@ export function parseRecord(tag: string, text: string): WeeklyRecord | string {if (!Number.isFinite(start)) return tag + ': window.start is not a time';if (!SHA.test(r.candidate?.sha ?? '') || !SHA.test(r.stable?.sha ?? '')) return tag + ': candidate or stable is not a 40-hex sha';const models = (r.models && typeof r.models === 'object' ? r.models : {}) as Record<string, ModelRow>;- const rows: Record<string, ModelRow> = {};+ const rows: Record<string, ModelRow> = Object.create(null);for (const [id, m] of Object.entries(models)) {if (![m?.n, m?.d, m?.lo, m?.hi].every(num)) return tag + ': model row ' + clean(id) + ' is not numeric';const v = m.vs_none;+ if (clean(id) in rows) return tag + ': model ids ' + JSON.stringify(clean(id)) + ' collide once control characters are stripped';rows[clean(id)] = { host: m.host, n: m.n, d: m.d, lo: m.lo, hi: m.hi, ...(v && [v.d, v.lo, v.hi].every(num) ? { vs_none: { d: v.d, lo: v.lo, hi: v.hi } } : {}) };}if (Object.values(rows).some((m) => m.hi < 0) !== (r.verdict === 'HOLD')) return tag + ': verdict ' + r.verdict + ' disagrees with its model rows (verdict mismatch)';@@ -88,7 +89,7 @@ function summary(r: WeeklyRecord): string {/** What the records say about cutting candidate over stable. A HOLD applies when its commit is in the candidate and not yet on stable. */export function benchmarkStatus(o: { read: Records; git: Git; candidate: string; stable: string | null; now: number; hold?: boolean }): BenchmarkStatus {const mode = ' (' + ((o.hold ?? BENCHMARK.hold) ? 'holding' : 'report only') + ')';- if (!o.read.ok) return { state: 'unreadable', line: 'BENCHMARK: unreadable (' + o.read.why + ')' + mode, record: null };+ if (!o.read.ok) return { state: 'unreadable', line: 'BENCHMARK: unreadable (' + clean(o.read.why) + ')' + mode, record: null };const sorted = newestFirst(o.read.records), r = sorted.find((x) => x.verdict !== 'INCOMPLETE') ?? null, newest = sorted[0];const later = newest && newest !== r ? '; the newer ' + newest.tag + ' is INCOMPLETE (' + (newest.incomplete_reason ?? 'no reason given') + ')' : '';if (!r) return { state: 'none', line: 'BENCHMARK: none (' + (newest ? 'every record is INCOMPLETE' + later : 'no weekly record published yet') + ')' + mode, record: null };diff --git a/crew/test/release-benchmark.test.ts b/crew/test/release-benchmark.test.tsindex 3b4b8ea59..d9628b994 100644--- a/crew/test/release-benchmark.test.ts+++ b/crew/test/release-benchmark.test.ts@@ -71,6 +71,27 @@ describe('release-benchmark: reading the records', () => {expect(injected.line).not.toContain('\n');});+ test('a refused schema or verdict cannot start a workflow command in the unreadable line', () => {+ for (const bad of [{ ...rec('GAIN'), verdict: 'x\n::stop-commands::tok' }, { ...rec('GAIN'), schema: '1\n::add-mask::tok' }]) {+ const why = parseRecord('weekly-2026-w48', JSON.stringify(bad));+ expect(typeof why).toBe('string');+ const s = status({ ok: false, why: why as string });+ expect(s.state).toBe('unreadable');+ expect(s.line).not.toContain('\n');+ }+ });++ test('a __proto__ model row still counts toward the verdict, and model ids that clean alike are refused', () => {+ const held = JSON.stringify(rec('HOLD')).replace('"models":{"claude-opus-5-5"', '"models":{"__proto__":{"n":10,"d":-5,"lo":-8,"hi":-2},"claude-opus-5-5"');+ const r = parseRecord('weekly-2026-w48', held) as WeeklyRecord;+ expect(typeof r).toBe('object');+ expect(Object.keys(r.models)).toEqual(['__proto__', 'claude-opus-5-5']);+ const gain = JSON.stringify(rec('GAIN')).replace('"models":{"claude-opus-5-5"', '"models":{"__proto__":{"n":10,"d":-5,"lo":-8,"hi":-1},"claude-opus-5-5"');+ expect(parseRecord('weekly-2026-w48', gain)).toContain('verdict mismatch');+ const twins = { ...rec('GAIN'), models: { 'm\n': { n: 1, d: -2, lo: -4, hi: -1 }, 'm ': { n: 1, d: 1, lo: 0, hi: 2 } } };+ expect(parseRecord('weekly-2026-w48', JSON.stringify(twins))).toContain('collide');+ });+test('readRecords lists weekly tags only, retries each call once, and any failure makes the whole read unreadable', () => {const calls: string[][] = [];let flaky = 1;diff --git a/docs/releases.md b/docs/releases.mdindex 32d1d6570..820bce06d 100644--- a/docs/releases.md+++ b/docs/releases.md@@ -392,7 +392,8 @@ Every cut plan, dry runs included, prints one `BENCHMARK:` line read from thosereached `stable` is printed, and the choice between fixing forward and [rolling back](#rolling-stable-back) ismade by hand.- A record that can't be read prints `unreadable`, and so does a record whose verdict disagrees with its own model- rows. Every list and download is retried once. A no-gstack comparison (`vs_none`) with a missing or non-numeric+ rows, or two of whose model ids read the same once control characters are stripped (so no row is silently lost).+ Every list and download is retried once. A no-gstack comparison (`vs_none`) with a missing or non-numericnumber is left out of the line instead.**Holding is off for the first two weekly records** (`BENCHMARK.hold` is `false`), so for now the line is only