mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-08 09:48:20 +01:00
* refactor(eval-history): share pass-rate history loading as loadPassRateHistory() eval:pass-rates' main block loaded local dirs or the weekly trial-outcomes artifacts inline. Move that into an exported function returning records, scope and fetch errors, so the off-ship sweep reads the same history the same way. Behavior unchanged. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * feat(ship-measure): the measurement bar and the weekly off-ship sweep CLI Decide each diagnostic measurement with one bar (scripts/lib/measure-bar.ts): MEETS at 9/10; MEETS-qualified at 8/10 when every red is a mechanical provider error, judge noise or a cited model miss; EXTEND at 7/10 (or an unqualified 8/10) for one more batch on identical inputs, decided once on the pooled 20; BELOW otherwise and for any timeout, hang, regression or fixable cause. Behavior uses 12 trials (11/10/9; 22/20 of 24); judge counts median-panel outputs. A batch with more than 30% provider-evidence failures is void and redispatched once. Below-strict reds nobody classified return needs-classify. ship-measure gains classify (append-only records; provider refused without evidence), decide and extend (refuses a changed identity, names the field, never a third batch), exit codes 5 and 6, and a pooling identity (frozen tree, runner, CLI, model, CI image, Bun, policy and harness versions). ship-measure sweep ranks main's gate cases by their cost to the all-green probability from eval:pass-rates history, measures the top K with the same runner and bar under a weekly cap shared with the last 7 days of sweep reports (ship_measure_sweep_cases, ship_measure_sweep_budget_usd), and writes a report with the predicted all-green probability before and after. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * feat(ship): the measure loop decides by the bar's exit codes Step 4 branches on MEETS/MEETS-qualified, needs-classify (with the qualifying and fix-round classes), EXTEND once and BELOW; the rest of the loop prose is tightened to offset most of the growth. ship's union size cap moves from 1.495 to 1.4975 (measured 281,058 / 187,706 = 1.4973). Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * ci: weekly eval-sweep workflow on main Mondays 12:00 UTC and on dispatch (k, cap_usd, dry_run): runs ship-measure sweep in the published CI image by digest with the census's paid-eval setup, downloads the last 7 days of sweep reports first so the weekly cap holds across runs, uploads the report and captures, and writes the job summary. Read-only grants; it never pushes or opens a pull request. One sweep at a time repository-wide, never cancelled mid-spend. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs: the measurement bar table and the weekly sweep Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * chore: v1.91.33.0 Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * ci(temp): run eval-sweep on push to this branch (K=2, $25) for end-to-end validation Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * Revert "ci(temp): run eval-sweep on push to this branch (K=2, $25) for end-to-end validation" This reverts commitf4c58f2869. * ci: classify eval-sweep.yml, the sweep CLI and actionlint labels as free-only PR inputs None is read by a PR-gate case, so a change to them selects no paid case instead of restoring the full gate (test/free-fixtures.test.ts workflow inventory). Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(ship-measure): the selection preflight accepts name-mode cases A case registered beside others in its file lists its trial shard as <file>#<id>~t1, not <file> (trial 1), so the preflight refused every name-mode case (for example ship-exploratory-late-input) before any paid trial. Accept both forms. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * ci(temp): run eval-sweep on push to this branch (K=2, $25) for end-to-end validation Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * Revert "ci(temp): run eval-sweep on push to this branch (K=2, $25) for end-to-end validation" This reverts commit9619734307. * test: record the test-pr-profile.ts change as non-behavioral for HARNESS_VERSION Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs(changelog): the name-mode preflight fix Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(ship-measure): a partly funded sweep row shows the trials that ran Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test(sweep): the fake single-case command is a Bun script, so it runs on Windows The Windows free lane runs test/ship-measure-sweep.test.ts; CreateProcess cannot exec a shebang shell stub, so every fake trial errored and the cap stopped the sweep after one trial. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test(plan-mode-no-op): the CEO sub-test reviews a fixed pasted plan Without a plan, plan-ceo-review reviewed the checkout's branch diff, so its pre-question work (audit and landscape searches) grew with whatever PR the gate ran on. On this PR it timed out at 300s in 3 of 10 trials while still researching the diff (ship-measure baseline 7/10). With a fixed small plan, the same way the devex sub-test already runs, it measured 10/10 (CEO sub-test 83-255s). No budget or threshold changed. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(ship-measure): each diagnostic trial gets its own EVALS_RUN_ID Evidence-retaining cases (functional QA, docs faults) refuse to start without EVALS_RUN_ID, which only CI sets, so measuring them locally ran 0/10 sessions. qa-functional-cli-report, red once in this PR's gate, measured 10/10 once the trials started ($11.13). Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --------- Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
70 lines
4.5 KiB
TypeScript
70 lines
4.5 KiB
TypeScript
/**
|
|
* Free checks of the seeded-flake fixture the paid case drives (CEO-3,
|
|
* ENG-13), measured through the real scripts/ship-measure.ts CLI: unsorted it
|
|
* measures 7 of 10 with failures that name the line, which the bar sends to
|
|
* needs-classify and, classified fixable, to a fix round; parallel trials claim
|
|
* unique slots that reset per round, an unrelated edit still measures 7 of 10
|
|
* and leaves the gate red, and only the sorting fix measures 10 of 10 and turns
|
|
* the gate green.
|
|
*/
|
|
import { afterAll, describe, expect, test } from 'bun:test';
|
|
import * as fs from 'node:fs';
|
|
import * as os from 'node:os';
|
|
import * as path from 'node:path';
|
|
import { spawnSync } from 'node:child_process';
|
|
import { SEEDED_CASE, SEEDED_LINE, SORTED_FIX, UNRELATED_EDIT, createSeededFixture, readFixtureRuns } from './helpers/ship-measure-seeded-fixture';
|
|
|
|
const ROOT = path.resolve(import.meta.dir, '..');
|
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'seeded-flake-'));
|
|
afterAll(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
|
|
describe('seeded-flake fixture (free)', () => {
|
|
test('measures 7/10 unsorted, 7/10 after an unrelated edit, 10/10 after the sort; the gate follows', () => {
|
|
const { repo, log } = createSeededFixture(root);
|
|
const state = path.join(root, 'state');
|
|
const env = { ...process.env, GSTACK_HOME: state, GSTACK_STATE_ROOT: state, SEEDED_FLAKE_LOG: log };
|
|
const measure = (round: string) => spawnSync(process.execPath, ['run', path.join(ROOT, 'scripts/ship-measure.ts'), 'measure', '--case', SEEDED_CASE,
|
|
'--round', round, '--command', './evals.sh case {case}', '--cost-per-trial', '0', '--jobs', '10'], { cwd: repo, env, encoding: 'utf8', timeout: 120_000 });
|
|
const gate = () => spawnSync('./evals.sh', ['gate'], { cwd: repo, env, encoding: 'utf8', timeout: 30_000 });
|
|
const roundDir = (round: string) => path.join(repo, '.context/ship-measure', SEEDED_CASE, round);
|
|
|
|
expect(spawnSync('git', ['status', '--porcelain'], { cwd: repo, encoding: 'utf8', timeout: 10_000 }).stdout).toBe('');
|
|
expect(gate().status).toBe(1);
|
|
|
|
const baseline = measure('baseline');
|
|
expect(baseline.stdout).toContain(`DIAGNOSTIC ${SEEDED_CASE} baseline: observed 7/10 trials (baseline); needs-classify`);
|
|
expect(baseline.status).toBe(5);
|
|
const failed = fs.readdirSync(roundDir('baseline')).filter(t => /^t\d+$/.test(t))
|
|
.map(t => JSON.parse(fs.readFileSync(path.join(roundDir('baseline'), t, 'trial.json'), 'utf8'))).filter(t => !t.passed);
|
|
expect(failed).toHaveLength(3);
|
|
for (const trial of failed) {
|
|
expect(trial.failureCause).toBe('assertion');
|
|
expect(trial.failureDetail).toContain(`src/priorities.js:${SEEDED_LINE} returns loadTasks(seed) in storage order`);
|
|
}
|
|
const slotsOf = (dir: string) => readFixtureRuns(log).filter(r => r.kind === 'case' && r.measureDir?.startsWith(dir)).map(r => r.slot).sort((a, b) => a! - b!);
|
|
expect(slotsOf(roundDir('baseline'))).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
|
expect(readFixtureRuns(log).filter(r => r.kind === 'case' && r.result === 'fail').map(r => r.slot).sort()).toEqual([2, 5, 9]);
|
|
const classify = spawnSync(process.execPath, ['run', path.join(ROOT, 'scripts/ship-measure.ts'), 'classify', '--case', SEEDED_CASE, '--round', 'baseline',
|
|
'--trials', failed.map(t => t.trial).join(','), '--class', 'fixable', '--evidence', `src/priorities.js:${SEEDED_LINE} returns storage order`], { cwd: repo, env, encoding: 'utf8', timeout: 60_000 });
|
|
expect(classify.stdout).toContain('BELOW (fix round)');
|
|
expect(classify.status).toBe(1);
|
|
|
|
fs.writeFileSync(path.join(repo, 'src/priorities.js'), UNRELATED_EDIT);
|
|
const control = measure('round-1');
|
|
expect(control.stdout).toContain(`DIAGNOSTIC ${SEEDED_CASE} round-1: observed 7/10 trials`);
|
|
expect(control.status).toBe(5);
|
|
expect(slotsOf(roundDir('round-1'))).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
|
expect(gate().status).toBe(1);
|
|
|
|
fs.writeFileSync(path.join(repo, 'src/priorities.js'), SORTED_FIX);
|
|
const fixed = measure('round-2');
|
|
expect(fixed.stdout).toContain(`DIAGNOSTIC ${SEEDED_CASE} round-2: observed 10/10 trials`);
|
|
expect(fixed.stdout).toContain('; MEETS');
|
|
expect(fixed.status).toBe(0);
|
|
expect(gate().status).toBe(0);
|
|
const runs = readFixtureRuns(log);
|
|
expect(runs.filter(r => r.kind === 'gate').map(r => `${r.sorted}:${r.result}`)).toEqual(['0:fail', '0:fail', '1:pass']);
|
|
expect(runs.filter(r => r.kind === 'case' && r.measureDir?.startsWith(roundDir('round-2'))).every(r => r.sorted === '1' && r.result === 'pass')).toBe(true);
|
|
});
|
|
});
|