Skip to content

Commit 69fb745

Browse files
committed
fix(ci): harden full release validation monitors
1 parent d9b46e0 commit 69fb745

4 files changed

Lines changed: 74 additions & 2 deletions

File tree

‎.github/workflows/full-release-validation.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ jobs:
227227
fi
228228
sleep 30
229229
done
230+
trap - EXIT INT TERM
230231
231232
conclusion="$(gh run view "$run_id" --json conclusion --jq '.conclusion')"
232233
url="$(gh run view "$run_id" --json url --jq '.url')"
@@ -328,6 +329,7 @@ jobs:
328329
fi
329330
sleep 30
330331
done
332+
trap - EXIT INT TERM
331333
332334
conclusion="$(gh run view "$run_id" --json conclusion --jq '.conclusion')"
333335
url="$(gh run view "$run_id" --json url --jq '.url')"
@@ -435,6 +437,7 @@ jobs:
435437
fi
436438
sleep 30
437439
done
440+
trap - EXIT INT TERM
438441
439442
conclusion="$(gh run view "$run_id" --json conclusion --jq '.conclusion')"
440443
url="$(gh run view "$run_id" --json url --jq '.url')"

‎src/agents/live-cache-regression-runner.test.ts‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,53 @@ describe("live cache regression runner", () => {
8383
),
8484
).toBe(false);
8585
});
86+
87+
it("accepts a warmup that already hits the provider cache", () => {
88+
const findings = __testing.evaluateAgainstBaseline({
89+
lane: "image",
90+
provider: "anthropic",
91+
result: {
92+
best: {
93+
hitRate: 0.999,
94+
suffix: "image-hit",
95+
text: "CACHE-OK image-hit",
96+
usage: { cacheRead: 5_742, cacheWrite: 0, input: 3 },
97+
},
98+
warmup: {
99+
hitRate: 0.999,
100+
suffix: "image-warmup",
101+
text: "CACHE-OK image-warmup",
102+
usage: { cacheRead: 5_741, cacheWrite: 0, input: 3 },
103+
},
104+
},
105+
});
106+
107+
expect(findings).toEqual({ regressions: [], warnings: [] });
108+
});
109+
110+
it("still rejects warmups with no cache write or cache hit evidence", () => {
111+
const findings = __testing.evaluateAgainstBaseline({
112+
lane: "image",
113+
provider: "anthropic",
114+
result: {
115+
best: {
116+
hitRate: 0.999,
117+
suffix: "image-hit",
118+
text: "CACHE-OK image-hit",
119+
usage: { cacheRead: 5_742, cacheWrite: 0, input: 3 },
120+
},
121+
warmup: {
122+
hitRate: 0,
123+
suffix: "image-warmup",
124+
text: "CACHE-OK image-warmup",
125+
usage: { cacheRead: 0, cacheWrite: 0, input: 5_741 },
126+
},
127+
},
128+
});
129+
130+
expect(findings).toEqual({
131+
regressions: ["anthropic:image warmup cacheWrite=0 < min=1"],
132+
warnings: [],
133+
});
134+
});
86135
});

‎src/agents/live-cache-regression-runner.ts‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,21 @@ function formatUsage(usage: CacheUsage | undefined) {
359359
return `cacheRead=${usage?.cacheRead ?? 0} cacheWrite=${usage?.cacheWrite ?? 0} input=${usage?.input ?? 0}`;
360360
}
361361

362+
function warmupHasCacheEvidence(params: { floor: LiveCacheFloor; warmup: CacheRun }): boolean {
363+
const cacheRead = params.warmup.usage.cacheRead ?? 0;
364+
const cacheWrite = params.warmup.usage.cacheWrite ?? 0;
365+
if (params.floor.minCacheReadOrWrite !== undefined) {
366+
return Math.max(cacheRead, cacheWrite) >= params.floor.minCacheReadOrWrite;
367+
}
368+
if (params.floor.minCacheRead !== undefined && cacheRead < params.floor.minCacheRead) {
369+
return false;
370+
}
371+
if (params.floor.minHitRate !== undefined && params.warmup.hitRate < params.floor.minHitRate) {
372+
return false;
373+
}
374+
return params.floor.minCacheRead !== undefined || params.floor.minHitRate !== undefined;
375+
}
376+
362377
function assertAgainstBaseline(params: {
363378
lane: BaselineLane;
364379
provider: ProviderKey;
@@ -401,8 +416,12 @@ function assertAgainstBaseline(params: {
401416
}
402417

403418
if (params.result.warmup) {
404-
const warmupUsage = params.result.warmup.usage;
405-
if ((warmupUsage.cacheWrite ?? 0) < (floor.minCacheWrite ?? 0)) {
419+
const warmup = params.result.warmup;
420+
const warmupUsage = warmup.usage;
421+
if (
422+
(warmupUsage.cacheWrite ?? 0) < (floor.minCacheWrite ?? 0) &&
423+
!warmupHasCacheEvidence({ floor, warmup })
424+
) {
406425
recordRegression(
407426
`${params.provider}:${params.lane} warmup cacheWrite=${warmupUsage.cacheWrite ?? 0} < min=${floor.minCacheWrite}`,
408427
);

‎test/scripts/package-acceptance-workflow.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ describe("package artifact reuse", () => {
307307
expect(workflow).toContain("child_rerun_group=all");
308308
expect(workflow).toContain('-f rerun_group="$child_rerun_group"');
309309
expect(workflow).toContain("NORMAL_CI_RESULT: ${{ needs.normal_ci.result }}");
310+
expect(workflow.match(/trap - EXIT INT TERM/g)).toHaveLength(6);
310311
expect(workflow).not.toContain("workflow_ref:");
311312
expect(workflow).not.toContain("inputs.workflow_ref");
312313
});

0 commit comments

Comments
 (0)