From 0fad51c6f158cf449ac2712cfc0b658b524b7cc5 Mon Sep 17 00:00:00 2001 From: Postil Maintainer Date: Thu, 19 Nov 2026 13:46:28 +0000 Subject: [PATCH] Allow the Luna upgrade without statistical calibration --- .github/workflows/release.yml | 16 +++- bench/README.md | 2 +- bench/src/livemodels.test.ts | 4 +- bench/src/release-workflow.test.ts | 123 +++++++++++++++++++++++++++++ 4 files changed, 138 insertions(+), 7 deletions(-) create mode 100644 bench/src/release-workflow.test.ts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 46f0e92..71e6512 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: | @@ -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: @@ -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: @@ -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 @@ -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: @@ -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: @@ -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 diff --git a/bench/README.md b/bench/README.md index 9776173..adf8864 100644 --- a/bench/README.md +++ b/bench/README.md @@ -119,7 +119,7 @@ bun run bench:cohort-run -- --mode execute --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. diff --git a/bench/src/livemodels.test.ts b/bench/src/livemodels.test.ts index bbeed77..2e8beb0 100644 --- a/bench/src/livemodels.test.ts +++ b/bench/src/livemodels.test.ts @@ -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 --"); @@ -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, diff --git a/bench/src/release-workflow.test.ts b/bench/src/release-workflow.test.ts new file mode 100644 index 0000000..adf6ef4 --- /dev/null +++ b/bench/src/release-workflow.test.ts @@ -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"); + } + } +});