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
4 changes: 4 additions & 0 deletions .github/workflows/docs-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
env:
OFFING_SITE_TOOLS: ${{ runner.temp }}/site-tools
run: node --test dist/tests/dashboard-accuracy.test.js
- name: acc-fix-evals
env:
OFFING_SITE_TOOLS: ${{ runner.temp }}/site-tools
run: node --test dist/tests/fix-evals-site.test.js
- name: Check the documentation site
# Mizzen builds the site in a temporary folder and reports every broken link, placeholder, and
# navigation entry. Errors fail the job; warnings stay in the log.
Expand Down
74 changes: 73 additions & 1 deletion .github/workflows/fix-evals.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
name: fix-evals smoke
name: fix-evals

on:
schedule:
- cron: "20 5 * * 1"
workflow_dispatch:
inputs:
refresh:
description: Evaluate the public cohort instead of the smoke fixtures
type: boolean
default: false

permissions: {}

jobs:
fixtures:
if: github.event_name == 'workflow_dispatch' && !inputs.refresh
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
Expand Down Expand Up @@ -39,3 +47,67 @@ jobs:
name: fix-evals-fixture-evidence
path: artifacts/fix-evals
retention-days: 7

evaluate:
if: github.event_name == 'schedule' || inputs.refresh
runs-on: ubuntu-latest
timeout-minutes: 35
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: $/.github/actions/setup
with:
cache: npm
- run: npm run fix-evals -- --out artifacts/fix-evals
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: fix-evals-public-evidence
path: artifacts/fix-evals
if-no-files-found: error
retention-days: 14

review:
needs: evaluate
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: $/.github/actions/setup
with:
cache: npm
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: fix-evals-public-evidence
path: artifacts/fix-evals
- name: Archive evidence only when the measured numbers change
run: |
set -euo pipefail
npm run build --silent
node dist/benchmarks/fix-evals/archive.js artifacts/fix-evals "$(date -u +%F)" --changed
- name: Open a reviewable evidence refresh
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
branch="automation/fix-evals-${GITHUB_RUN_ID}"
if [ -z "$(git status --porcelain -- benchmarks/fix-evals/results/)" ]; then exit 0; fi
if gh pr view "$branch" --json number >/dev/null 2>&1; then exit 0; fi
gh auth setup-git
if ! git ls-remote --exit-code --heads origin "refs/heads/$branch" >/dev/null; then
git switch -c "$branch"
git add -- benchmarks/fix-evals/results/
git -c user.name='github-actions[bot]' -c user.email='41898282+github-actions[bot]@users.noreply.github.com' commit -m 'test: refresh fix evaluation evidence'
git push origin "HEAD:refs/heads/$branch"
fi
printf 'Review the pinned outcomes and raw evidence from %s/%s/actions/runs/%s.\n\nThe results update only after this pull request is reviewed and merged.\n' \
"$GITHUB_SERVER_URL" "$GITHUB_REPOSITORY" "$GITHUB_RUN_ID" > "$RUNNER_TEMP/fix-evals-pr.md"
gh pr create --base main --head "$branch" --title 'test: refresh fix evaluation evidence' --body-file "$RUNNER_TEMP/fix-evals-pr.md"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ docs/_data/dashboard-maturity.json
docs/_data/dashboard-comparison.json
docs/_data/comparison.json
docs/_data/comparison-losses.json
docs/_data/fix-evals.json
docs/_data/fix-evals-*.json
docs/api/v1/
dist/*
coverage/
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ Requirements: Node.js 22 or newer.
</tr>
</table>

**Fix evaluation, November 28, 2026.** [50 of 60 pinned repositories were measured, and workflow validation stayed green in all 45 GitHub Actions fixer cases](https://github.com/velella-sh/offing/blob/main/benchmarks/fix-evals/results/2026-11-28/report.json). [See per-fixer and agent results](https://velella.sh/offing/fix-evals/).

## What it covers

Runtimes, package manifests and lockfiles, CI and infrastructure files across:
Expand Down
63 changes: 63 additions & 0 deletions benchmarks/fix-evals/archive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { execFile } from "node:child_process";
import { copyFile, mkdir, mkdtemp, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
import { join, resolve } from "node:path";
import { promisify } from "node:util";

import { sha256 } from "./evaluate.js";
import { fixEvalReport, latestFixEval } from "./site.js";

const execute = promisify(execFile);

async function readReport(path: string) {
const text = await readFile(path, "utf8");
const raw: unknown = JSON.parse(text);
return fixEvalReport.parse(raw);
}

function counts(result: Awaited<ReturnType<typeof readReport>>) {
const { selected, repositories, excluded, fixers } = result;
return JSON.stringify({ selected, repositories, excluded, fixers });
}

async function archive(source: string, date: string, publishOnlyChanges: boolean): Promise<void> {
if (!/^\d{4}-\d{2}-\d{2}$/u.test(date)) throw new Error("Expected a run date in YYYY-MM-DD form.");
const result = await readReport(join(source, "report.json"));
const last = await latestFixEval(".").catch(() => undefined);
if (publishOnlyChanges && last !== undefined && counts(result) === counts(await readReport(last.path))) {
process.stdout.write("Fix evaluation metrics unchanged.\n");
return;
}
const directory = resolve("benchmarks/fix-evals/results");
await mkdir(directory, { recursive: true });
const stage = await mkdtemp(join(directory, ".run-"));
try {
await writeSnapshot(source, stage, result);
await rename(stage, join(directory, date));
} finally {
await rm(stage, { force: true, recursive: true });
}
process.stdout.write(`Recorded fix evaluation for ${date}.\n`);
}

async function writeSnapshot(source: string, target: string, result: Awaited<ReturnType<typeof readReport>>) {
const evidence = join(target, "evidence.tar.gz");
await execute("tar", ["--numeric-owner", "--no-xattrs", "-czf", evidence, "-C", source, "."], {
env: { PATH: process.env.PATH, COPYFILE_DISABLE: "1" },
timeout: 60_000,
});
if ((await stat(evidence)).size > 20 * 1024 * 1024)
throw new Error("Fix evaluation evidence archive exceeds 20 MiB.");
const evidenceSha256 = sha256(await readFile(evidence));
await writeFile(join(target, "report.json"), `${JSON.stringify({ ...result, evidenceSha256 }, null, 2)}\n`);
const failures = new Set(result.fixers.flatMap(({ failures }) => failures.map(({ repository }) => repository)));
if (failures.size > 0) await mkdir(join(target, "failures"));
for (const id of failures) {
await copyFile(join(source, id, "evidence.json"), join(target, "failures", `${id}.json`));
}
}

const [source, date, flag] = process.argv.slice(2);
if (source === undefined || date === undefined || (flag !== undefined && flag !== "--changed")) {
throw new Error("Usage: archive <raw-results-directory> <YYYY-MM-DD> [--changed]");
}
await archive(resolve(source), date, flag === "--changed");
126 changes: 126 additions & 0 deletions benchmarks/fix-evals/cohort.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import { readFile } from "node:fs/promises";

import { z } from "zod";

import { profiles } from "../../src/test-runners/profiles.js";
import type { Commands, Input } from "./evaluate.js";

const command = z.tuple([z.string().min(1)]).rest(z.string());
const sha = z.string().regex(/^[a-f0-9]{40}$/u);
const digest = z.string().regex(/^[a-f0-9]{64}$/u);
const selection = z.object({
offingCommit: sha,
repositories: z
.array(
z.object({
repository: z.string().regex(/^[a-z0-9][a-z0-9_.-]*\/[a-z0-9][a-z0-9_.-]*$/iu),
commit: sha,
patches: z.array(z.object({ paths: z.array(z.string()).min(1) })).min(1),
baseline: z.discriminatedUnion("kind", [
z.object({
kind: z.literal("isolated"),
image: z.string(),
lockSha256: z.string().optional(),
checks: z.array(z.object({ command })).min(1),
provider: z
.object({
url: z
.string()
.regex(
/^https:\/\/github\.com\/digitalocean\/terraform-provider-digitalocean\/releases\/download\/[\w.]+\/terraform-provider-digitalocean_[\w.]+_linux_amd64\.zip$/u,
),
sha256: digest,
})
.optional(),
schemas: z
.object({
repository: z.literal("yannh/kubernetes-json-schema"),
commit: sha,
directory: z.string().regex(/^v[\d.]+-standalone-strict$/u),
files: z.array(z.string().regex(/^[a-z0-9-]+\.json$/u)).min(1),
})
.optional(),
}),
z.object({ kind: z.literal("upstream") }),
]),
}),
)
.min(60),
});

export interface Candidate {
input: Input;
commands?: Commands;
paths?: ReadonlySet<string>;
image?: string;
assets?: readonly Asset[];
}

export interface Asset {
url: string;
path: string;
sha256?: string;
}

type Baseline = z.infer<typeof selection>["repositories"][number]["baseline"];

const goCheck = (action: "build" | "test"): Commands["build"] => [
"sh",
"-ec",
"mkdir -p /work/go-tmp /work/go-cache && export GOTMPDIR=/work/go-tmp GOCACHE=/work/go-cache && go " +
action +
" -mod=vendor ./...",
];

function execution(baseline: Baseline): Omit<Candidate, "input" | "paths"> & { profile: Input["profile"] } {
if (baseline.kind === "upstream") return { profile: null };
if (baseline.image === profiles["github-actions"].image) return { profile: "github-actions" };
if (baseline.image === profiles.go.image) {
return { profile: "go", commands: { build: goCheck("build"), test: goCheck("test") } };
}
const [first, second] = baseline.checks;
if (baseline.provider && first && /^docker\.io\/hashicorp\/terraform@sha256:[a-f0-9]{64}$/u.test(baseline.image)) {
return {
profile: "terraform",
image: baseline.image,
commands: { build: first.command },
assets: [{ ...baseline.provider, path: ".offing-tool.zip" }],
};
}
if (baseline.schemas && first?.command[0] === "/usr/local/bin/kubeconform") {
const { repository, commit, directory, files } = baseline.schemas;
const assets = [...new Set([...files, "ingress-networking-v1.json"])].map((file) => ({
url: `https://raw.githubusercontent.com/${repository}/${commit}/${directory}/${file}`,
path: `.offing-kubeconform-schemas/${file}`,
}));
return { profile: "kubernetes", commands: { build: first.command }, assets };
}
if (
baseline.image === profiles.npm.image &&
baseline.lockSha256 === undefined &&
baseline.checks.length === 2 &&
first?.command[0] === "node" &&
first.command[1] === "--check" &&
second !== undefined
) {
return { profile: "npm", commands: { build: first.command, test: second.command } };
}
return { profile: null };
}

export async function readCohort(): Promise<{ revision: string; candidates: Candidate[] }> {
const data = selection.parse(JSON.parse(await readFile("benchmarks/fix-evals/selection.json", "utf8")));
const candidates = data.repositories.map(({ repository, commit, baseline, patches }) => {
const id = repository.toLowerCase().replace(/[^a-z0-9]+/gu, "-");
const { profile, ...setup } = execution(baseline);
return {
input: { id, repository, commit, profile },
paths: new Set(patches.flatMap(({ paths }) => paths)),
...setup,
};
});
if (new Set(candidates.map(({ input }) => input.id)).size !== candidates.length) {
throw new Error("Duplicate fix-evals case ID.");
}
return { revision: data.offingCommit, candidates };
}
Loading
Loading