Clearer errors for GitHub email-privacy pushes, approval refusals and bisect case names (#4748)

/ship now tells you to fix your commit email when GitHub refuses a push
with GH007, instead of sending you into a pointless merge;
`gstack-approvals` says which `--owner-ref` check failed; and the merge
queue's bisect accepts a red judge case whose name has a space.

Why: three small, plainly correct fixes from outside reports (#4738,
#4718 with #4720, #4724 for #3580), taken as one batch.

Nothing to do.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: Barack-zero-to-one <121355791+Barack-zero-to-one@users.noreply.github.com>
Review-Finding: p1/outside-voice#1 reader=outside-voice
Review-Finding: p1/outside-voice#2 reader=outside-voice
Review-Finding: p1/adversarial-native#1 reader=adversarial-native
Review-Finding: p1/adversarial-native#3 reader=adversarial-native
Review-Finding: p1/specialist-batched#1 reader=testing
This commit is contained in:
authored and GitHub committed 2026-11-23 19:26:27 +00:00
1 parent 0d6cc1be56
commit 100e109ccd
14 files changed
+174 -21

No files matched your search

+1 -2
View File
@@ -32,7 +32,7 @@ import { MAX_BISECT_CASES, MAX_PREFIXES, RELEASE_BISECT_ARTIFACT, RELEASE_BISECT
import type { ReleaseGatePolicy } from '../../lib/release-gate-policy';
import { loadPolicyFromBase, mergePolicy, validatePolicy } from '../../lib/ship-policy';
import {
NOTES_REF, fetchNotes, nowIso, persist, repoIdentity,
CASE_ID, NOTES_REF, fetchNotes, nowIso, persist, repoIdentity,
type PrefixResult, type ReleaseBisect, type ReleaseBisectRound, type ReleaseRecord,
} from './ship-queue-train-record';
@@ -47,7 +47,6 @@ export const MAX_BISECT_ROUNDS = 4;
/** An open gate (a run past its budget, or a red gate's running bisect) on an older commit is finished first for this many cadences; after that it stops holding up main's head. */
export const OPEN_GATE_CADENCES = 3;
const SHA = /^[0-9a-f]{40}$/;
const CASE_ID = /^[A-Za-z0-9 _.:/-]{1,128}$/;
const HOUR = 3_600_000;
const GH_MS = 60_000;
+2
View File
@@ -69,6 +69,8 @@ export interface TrainRecord {
landing?: Record<string, LandingRecord>;
effects: Array<{ at: string; what: string }>; error: string | null; created_at: string; updated_at: string;
}
/** A gate case id a bisect can name: a judge case id holds a space ("<skill>/SKILL.md workflow") and no comma, which joins the cases dispatch input; train bisect, the release bisect and the CI route (crew/scripts/train-gate.ts) share it. */
export const CASE_ID = /^[A-Za-z0-9 _.:/-]{1,128}$/;
export type AttemptPurpose = 'gate' | 'rebuild' | 'infra-redispatch' | 'bisect';
export type GateOutcome = 'PENDING' | 'GREEN' | 'RED' | 'INCOMPLETE';
export interface CasePanel {
+9 -4
View File
@@ -19,7 +19,7 @@ import {
checkRun, downloadJson, execFor, asRun, remoteBranchSha, repoSlug, runView, type CheckInfo, type RunInfo,
} from './ship-queue-train-github';
import {
attemptsOf, loadBisect, nowIso, persist, trainDir, trainFile,
CASE_ID, attemptsOf, loadBisect, nowIso, persist, trainDir, trainFile,
type AttemptRecord, type BisectRecord, type CasePanel, type GateOutcome, type PrefixResult, type TrainRecord,
} from './ship-queue-train-record';
import {
@@ -222,11 +222,16 @@ function bisectOutcome(env: TrainEnv, t: TrainRecord, b: BisectRecord): TrainOut
/** The commits a bisect tests: T0 and the plain prefixes, or for a stamped train T0 and S_1..S_k, the chain its gate ran. */
const bisectPrefixes = (t: TrainRecord) => t.stamped ? [t.prefixes[0]!, ...t.stamped] : t.prefixes;
/** Why a red attempt's cases cannot be bisected, or null: each red case must be a case id one of the gate's own panels holds. */
export function redCasesOutsidePlan(red: Pick<AttemptRecord, 'red_cases' | 'panels'>): string | null {
const id = red.red_cases.find(c => !CASE_ID.test(c) || !red.panels.some(p => p.case === c));
return id === undefined ? null : `red case ${id} is not in the gate's plan`;
}
/** Validate bisect inputs: red cases from the gate's own plan, every prefix an ancestor of train/<nonce>'s head. */
function bisectInputs(env: TrainEnv, t: TrainRecord, red: AttemptRecord): string | null {
for (const id of red.red_cases) {
if (!/^[A-Za-z0-9_.:/-]{1,128}$/.test(id) || !red.panels.some(p => p.case === id)) return `red case ${id} is not in the gate's plan`;
}
const outside = redCasesOutsidePlan(red);
if (outside) return outside;
const ref = `refs/gstack/${t.branch}`;
const f = git(env.ctx.repoRoot, ['fetch', '--no-tags', '-q', env.remote, `+refs/heads/${t.branch}:${ref}`]);
if (!f.ok) return `cannot fetch ${t.branch}: ${f.err.slice(0, 120)}`;
+1 -2
View File
@@ -29,7 +29,7 @@ import { normalizeLockfile } from '../../lib/evidence-bundle';
import { stampMentions, rewriteStamps, versionAtRef } from '../../lib/restamp';
import { loadPolicyFromHead, matchesAny, type ShipPolicy } from '../../lib/ship-policy';
import type { BisectPrefixRecord, TrainGateRecord } from '../lib/ship-queue-train-verdict';
import type { CasePanel } from '../lib/ship-queue-train-record';
import { CASE_ID, type CasePanel } from '../lib/ship-queue-train-record';
import { E2E_TIERS, LLM_JUDGE_TOUCHFILES } from '../../test/helpers/touchfiles-data';
import { panelVerdict } from '../../test/helpers/eval-store';
import { UNRECORDED_SHARD_MS, nonceScope, plannedSerialMs } from '../../scripts/eval-bg';
@@ -41,7 +41,6 @@ import { paidSelectionEnv } from '../../scripts/lib/paid-select';
import { ROOT } from '../../scripts/lib/paid-types';
const SHA = /^[0-9a-f]{40}$/;
const CASE_ID = /^[A-Za-z0-9 _.:/-]{1,128}$/;
export const JUDGE_FILE = 'test/skill-llm-eval.test.ts';
/** T1 caps a train at 6 PRs, so a bisect has at most 7 prefixes (T0..T6). */
export const MAX_PREFIXES = 7;
+19 -1
View File
@@ -11,7 +11,7 @@ import { DEFAULT_POLICY, TRAIN_KEYS_VERSION, validatePolicy } from '../../lib/sh
import { fillDue, orderSlots, parseOrder, parsePins, prsArgs } from '../lib/ship-queue-train';
import { gstackPaidSelection, skillOwnCases, touchedSkills } from '../lib/ship-queue-train-ready';
import { normalizeRemoteUrl, repoIdentity, type TrainSlot } from '../lib/ship-queue-train-record';
import { INFRA_REDISPATCH, REBUILD_ONCE, classifyBisect, classifyGate } from '../lib/ship-queue-train-verdict';
import { INFRA_REDISPATCH, REBUILD_ONCE, classifyBisect, classifyGate, redCasesOutsidePlan } from '../lib/ship-queue-train-verdict';
import { EVAL_POLICY } from '../../test/helpers/periodic-exclude-data';
import { COMPLETE, FAIL, PASS, TRAIN_BLOCK } from '../../test/helpers/ship-queue-train-fixture';
import { spawnSync } from 'node:child_process';
@@ -270,3 +270,21 @@ describe("eval-bg nonce key: purpose and screen policy", () => {
expect(dispatchPlan('gate', { sha: SHA, baseRef: 'main', baseSha: base, nonce: 'n' })).toEqual([{ workflow: 'evals.yml', inputs: { evals_all: 'true', expected_sha: SHA, nonce: 'n' } }]);
});
});
// Value: protects=train bisect takes a red case by the id the gate's panels carry, with the id rule the release bisect and the CI route already apply;
// fails_when=a judge case whose id holds a space ("<skill>/SKILL.md workflow") is refused as outside the plan, or an id the dispatch input
// cannot carry (empty, a comma, a newline, over 128 characters) gets through; why_new=no test fed bisect a red judge case (#3580, idea
// from @Barack-zero-to-one in #4724); seam=redCasesOutsidePlan
describe('bisect red cases: the ids the gate plan holds (#3580)', () => {
const JUDGE = 'setup-browser-cookies/SKILL.md workflow';
test('a red judge case whose id holds a space is in the plan', () => {
expect(redCasesOutsidePlan({ red_cases: [JUDGE], panels: [PASS('c1'), { ...FAIL(JUDGE), kind: 'judge' }] })).toBeNull();
});
test('an id the dispatch input cannot carry is refused even when a panel holds it', () => {
for (const id of ['', 'a,b', 'a\nb', 'x'.repeat(129)]) expect(redCasesOutsidePlan({ red_cases: [id], panels: [FAIL(id)] })).toContain("is not in the gate's plan");
});
test('a red id no panel holds is refused', () => {
expect(redCasesOutsidePlan({ red_cases: ['c2'], panels: [FAIL('c1')] })).toBe("red case c2 is not in the gate's plan");
});
});