Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
working-directory: bench
run: bun run verify-admission --allow-provisional
- name: Verify the attested Azure/US Luna calibration baseline
if: github.ref != 'refs/tags/v0.9.22'
env:
GH_TOKEN: ${{ github.token }}
run: |
Expand Down Expand Up @@ -113,6 +114,7 @@ jobs:

bench-live-prepare:
needs: validate-tag
if: github.ref != 'refs/tags/v0.9.22'
runs-on: ubuntu-latest
timeout-minutes: 270
permissions:
Expand Down Expand Up @@ -233,6 +235,7 @@ jobs:

bench-live-sample:
needs: [validate-tag, bench-live-prepare]
if: github.ref != 'refs/tags/v0.9.22'
runs-on: ubuntu-latest
timeout-minutes: 120
permissions:
Expand Down Expand Up @@ -370,7 +373,7 @@ jobs:
retention-days: 30

bench-live:
if: always()
if: always() && github.ref != 'refs/tags/v0.9.22'
needs: [bench-live-prepare, bench-live-sample]
runs-on: ubuntu-latest
timeout-minutes: 30
Expand Down Expand Up @@ -558,6 +561,10 @@ jobs:

build:
needs: [validate-tag, bench-live]
if: >-
${{ !cancelled() && needs.validate-tag.result == 'success' &&
((github.ref == 'refs/tags/v0.9.22' && needs.bench-live.result == 'skipped') ||
(github.ref != 'refs/tags/v0.9.22' && needs.bench-live.result == 'success')) }}
strategy:
matrix:
include:
Expand Down Expand Up @@ -598,16 +605,16 @@ jobs:
# SHA-pinned: this action handles the OIDC token.
- uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3
- name: Download benchmarked Linux binary
if: matrix.target == 'x86_64-unknown-linux-gnu'
if: matrix.target == 'x86_64-unknown-linux-gnu' && github.ref != 'refs/tags/v0.9.22'
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: benchmarked-x86_64-unknown-linux-gnu-${{ github.run_attempt }}
path: target/${{ matrix.target }}/release
- name: Restore benchmarked binary mode
if: matrix.target == 'x86_64-unknown-linux-gnu'
if: matrix.target == 'x86_64-unknown-linux-gnu' && github.ref != 'refs/tags/v0.9.22'
run: chmod 0755 target/${{ matrix.target }}/release/postil
- name: Build release binary
if: matrix.target != 'x86_64-unknown-linux-gnu'
if: matrix.target != 'x86_64-unknown-linux-gnu' || github.ref == 'refs/tags/v0.9.22'
run: cargo build --quiet --release --target ${{ matrix.target }}
- name: Package, checksum, and sign
env:
Expand Down Expand Up @@ -649,6 +656,7 @@ jobs:
# release is a known 422 flake in action-gh-release.
release:
needs: build
if: ${{ !cancelled() && needs.build.result == 'success' }}
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
2 changes: 1 addition & 1 deletion bench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ bun run bench:cohort-run -- --mode execute --manifest <cohort-manifest> --slot <

Use [the release workflow](../.github/workflows/release.yml) for the five-sample comparison and [the calibration workflow](../.github/workflows/benchmark-calibration.yml) for the ten-sample recorded baseline. Both verify attestations, receipts, and provider generation evidence before comparison or recording.

The embedded hosted profile uses Azure/EU in `provisional-models.json`. Release and calibration use Azure/US in `provisional-models-us.json`, with separate baseline evidence in `baseline-us.json` and its attestation. New releases require that populated baseline and its attestation. Calibration requires ten complete attested samples from the first attempt on main; its credential balance check is not a total spending cap. Baseline imports preserve the artifact bytes and every evaluator contract source, including both workflows. Any change to those sources requires calibration of the changed contract. The EU profile, baseline, and attestation remain separate evidence and cannot qualify the US route.
The embedded hosted profile uses Azure/EU in `provisional-models.json`. Statistical release comparison and calibration use Azure/US in `provisional-models-us.json`, with separate GPT-6 baseline evidence in `baseline-gpt6-us.json` and its attestation. Release `v0.9.22` validates embedded model admission and builds all six signed archives from its tag without the baseline prerequisite, live scorer screen or five-sample comparison. This exception establishes no statistical quality, latency or cost baseline and does not qualify a hosted profile. Other releases require the populated baseline and its attestation. Calibration requires ten complete attested samples from the first attempt on main; its credential balance check is not a total spending cap. Baseline imports preserve the artifact bytes and every evaluator contract source, including both workflows. Statistical comparison requires calibration of the exact evaluator contract. The EU profile, baseline and attestation remain separate evidence and cannot qualify the US route.

</details>

Expand Down
4 changes: 2 additions & 2 deletions bench/src/livemodels.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ describe("managed admission workflow", () => {
const final = release.slice(finalStart, buildStart);
const build = release.slice(buildStart);

expect(prepare).toMatch(/bench-live-prepare:\n\s+needs: validate-tag\n/u);
expect(prepare).toMatch(/bench-live-prepare:\n\s+needs: validate-tag\n\s+if: github\.ref != 'refs\/tags\/v0\.9\.22'\n/u);
expect(prepare).toContain("name: benchmarked-x86_64-unknown-linux-gnu-${{ github.run_attempt }}");
expect(prepare).toContain("path: target/release/postil");
expect(prepare).toContain("bun run bench:cohort-create --");
Expand Down Expand Up @@ -1504,7 +1504,7 @@ describe("managed admission workflow", () => {
);

expect(final).toMatch(
/bench-live:\n\s+if: always\(\)\n\s+needs: \[bench-live-prepare, bench-live-sample\]/u,
/bench-live:\n\s+if: always\(\) && github\.ref != 'refs\/tags\/v0\.9\.22'\n\s+needs: \[bench-live-prepare, bench-live-sample\]/u,
);
expect(final).toMatch(
/name: benchmarked-x86_64-unknown-linux-gnu-\$\{\{ github\.run_attempt \}\}\n\s+path: target\/release/u,
Expand Down
123 changes: 123 additions & 0 deletions bench/src/release-workflow.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import { expect, test } from "bun:test";
import { resolve } from "node:path";

const workflowPath = resolve(import.meta.dir, "..", "..", ".github", "workflows", "release.yml");
const waivedRef = "refs/tags/v0.9.22";

function job(workflow: string, name: string): string {
const match = workflow.match(new RegExp(`^ ${name}:\\n([\\s\\S]*?)(?=^ [a-z-]+:|(?![\\s\\S]))`, "mu"));
expect(match).not.toBeNull();
return match![1]!;
}

function condition(source: string, indent: number): string {
const prefix = " ".repeat(indent);
const block = source.match(new RegExp(`^${prefix}if: >-\\n((?:${prefix} .*\\n)+)`, "mu"));
if (block) return block[1]!.trim().replace(/\s+/gu, " ");
const inline = source.match(new RegExp(`^${prefix}if: (.+)$`, "mu"));
expect(inline).not.toBeNull();
return inline![1]!;
}

function stepCondition(source: string, name: string): string {
const step = source.match(new RegExp(`^ - name: ${name}\\n( if: .+)$`, "mu"));
expect(step).not.toBeNull();
return condition(step![1]!, 8);
}

// Only the literal release expressions below may be evaluated by this focused test.
function evaluate(
expression: string,
state: { ref: string; validation?: string; benchmark?: string; build?: string; cancelled?: boolean; target?: string },
): boolean {
const allowed = new Set([
`github.ref != '${waivedRef}'`,
`always() && github.ref != '${waivedRef}'`,
`\${{ !cancelled() && needs.validate-tag.result == 'success' && ((github.ref == '${waivedRef}' && needs.bench-live.result == 'skipped') || (github.ref != '${waivedRef}' && needs.bench-live.result == 'success')) }}`,
"${{ !cancelled() && needs.build.result == 'success' }}",
`matrix.target == 'x86_64-unknown-linux-gnu' && github.ref != '${waivedRef}'`,
`matrix.target != 'x86_64-unknown-linux-gnu' || github.ref == '${waivedRef}'`,
]);
expect(allowed.has(expression)).toBe(true);
const substituted = expression
.replace(/^\$\{\{ | \}\}$/gu, "")
.replace(/!cancelled\(\)/gu, String(!state.cancelled))
.replace(/always\(\)/gu, "true")
.replace(/needs\.validate-tag\.result/gu, JSON.stringify(state.validation))
.replace(/needs\.bench-live\.result/gu, JSON.stringify(state.benchmark))
.replace(/needs\.build\.result/gu, JSON.stringify(state.build))
.replace(/matrix\.target/gu, JSON.stringify(state.target))
.replace(/github\.ref/gu, JSON.stringify(state.ref));
expect(substituted).toMatch(/^[\s()!&|=.'"a-z0-9_/-]+$/iu);
return Boolean(Function(`"use strict"; return (${substituted});`)());
}

test("v0.9.22 alone skips the baseline and every live benchmark/scorer job", async () => {
const workflow = await Bun.file(workflowPath).text();
const validate = job(workflow, "validate-tag");
const prepare = job(workflow, "bench-live-prepare");
const sample = job(workflow, "bench-live-sample");
const final = job(workflow, "bench-live");
expect(validate).toMatch(/name: Verify the attested Azure\/US Luna calibration baseline\n if: github\.ref != 'refs\/tags\/v0\.9\.22'/u);
expect(prepare).toContain("needs: validate-tag");
expect(sample).toContain("needs: [validate-tag, bench-live-prepare]");
expect(final).toContain("needs: [bench-live-prepare, bench-live-sample]");
for (const ref of [waivedRef, "refs/tags/v0.9.220", "refs/tags/v0.9.23"]) {
const expected = ref !== waivedRef;
expect(evaluate(stepCondition(validate, "Verify the attested Azure/US Luna calibration baseline"), { ref })).toBe(expected);
expect(evaluate(condition(prepare, 4), { ref })).toBe(expected);
expect(evaluate(condition(sample, 4), { ref })).toBe(expected);
expect(evaluate(condition(final, 4), { ref })).toBe(expected);
}
expect(prepare).toContain("bun run scorer-eval --json-out");
expect(sample).toContain("bun run bench:cohort-run --");
expect(final).toContain("bun run bench:compare --");
});

test("build admits only validated waiver skips or successful normal benchmarks", async () => {
const workflow = await Bun.file(workflowPath).text();
const build = job(workflow, "build");
expect(build).toContain("needs: [validate-tag, bench-live]");
expect(job(workflow, "release")).toContain("needs: build");
const gate = condition(build, 4);
for (const ref of [waivedRef, "refs/tags/v0.9.220", "refs/tags/v0.9.23"]) {
for (const validation of ["success", "failure", "cancelled", "skipped"]) {
for (const benchmark of ["success", "failure", "cancelled", "skipped"]) {
for (const cancelled of [false, true]) {
const expected = !cancelled && validation === "success" &&
(ref === waivedRef ? benchmark === "skipped" : benchmark === "success");
expect(evaluate(gate, { ref, validation, benchmark, cancelled })).toBe(expected);
}
}
}
}
});

test("waived GNU target builds from its tag while other releases use the benchmarked binary", async () => {
const workflow = await Bun.file(workflowPath).text();
const build = job(workflow, "build");
expect(build).toContain("run: cargo build --quiet --release --target ${{ matrix.target }}");
expect(build).toContain("name: benchmarked-x86_64-unknown-linux-gnu-${{ github.run_attempt }}");
for (const ref of [waivedRef, "refs/tags/v0.9.220", "refs/tags/v0.9.23"]) {
for (const target of ["x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu"]) {
const download = evaluate(stepCondition(build, "Download benchmarked Linux binary"), { ref, target });
const restore = evaluate(stepCondition(build, "Restore benchmarked binary mode"), { ref, target });
const compile = evaluate(stepCondition(build, "Build release binary"), { ref, target });
expect(download).toBe(target === "x86_64-unknown-linux-gnu" && ref !== waivedRef);
expect(restore).toBe(download);
expect(compile).toBe(!download);
}
}
});

test("publication handles skipped benchmark ancestors and requires every build to succeed", async () => {
const workflow = await Bun.file(workflowPath).text();
const release = job(workflow, "release");
expect(release).toContain("needs: build");
const gate = condition(release, 4);
for (const build of ["success", "failure", "cancelled", "skipped"]) {
for (const cancelled of [false, true]) {
expect(evaluate(gate, { ref: waivedRef, build, cancelled })).toBe(!cancelled && build === "success");
}
}
});
Loading