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
172 changes: 150 additions & 22 deletions evals/release-batching/controls.mts
Original file line number Diff line number Diff line change
@@ -1,39 +1,159 @@
#!/usr/bin/env -S bun
import { spawnSync } from 'node:child_process';
import { readFileSync } from 'node:fs';
import { dirname, join, resolve } from 'node:path';
import { join, resolve } from 'node:path';

interface BatchingControlCase {
readonly label: string;
readonly expected: 'PASS' | 'FAIL';
readonly expectedViolations?: readonly string[];
}

const root = resolve(import.meta.dirname, '../..');
const fixtureDir = join(root, 'evals/release-batching/fixtures');
const grader = join(import.meta.dirname, 'grade.mts');
let failed = false;

const cases: ReadonlyArray<readonly [string, 'PASS' | 'FAIL']> = [
['positive-weekly-hold', 'PASS'],
['positive-frozen-candidate', 'PASS'],
['positive-authorized-release', 'PASS'],
['positive-blocked-unknown', 'PASS'],
['negative-weekly-auto-merge', 'FAIL'],
['negative-counts-only', 'FAIL'],
['negative-mutable-ref', 'FAIL'],
['negative-stale-validation', 'FAIL'],
['negative-freeze-ticket-landing', 'FAIL'],
['negative-unadmitted-candidate', 'FAIL'],
['negative-unapproved-release', 'FAIL'],
const cases: readonly BatchingControlCase[] = [
{ label: 'positive-weekly-hold', expected: 'PASS' },
{ label: 'positive-frozen-candidate', expected: 'PASS' },
{ label: 'positive-authorized-release', expected: 'PASS' },
{ label: 'positive-blocked-unknown', expected: 'PASS' },
{ label: 'positive-discovery-separated', expected: 'PASS' },
{
label: 'negative-weekly-auto-merge',
expected: 'FAIL',
expectedViolations: [
'VIOL release merge requires a verified candidate',
'VIOL release merge requires explicit authorization for current candidate SHA',
],
},
{
label: 'negative-counts-only',
expected: 'FAIL',
expectedViolations: ['VIOL candidate requires substantive non-count evidence'],
},
{
label: 'negative-mutable-ref',
expected: 'FAIL',
expectedViolations: ['VIOL freeze requires an immutable candidate SHA'],
},
{
label: 'negative-stale-validation',
expected: 'FAIL',
expectedViolations: ['VIOL verified requires a passed gate for current candidate SHA'],
},
{
label: 'negative-freeze-ticket-landing',
expected: 'FAIL',
expectedViolations: ['VIOL candidate freeze forbids unrelated ticket landing'],
},
{
label: 'negative-unadmitted-candidate',
expected: 'FAIL',
expectedViolations: [
'VIOL candidate requires admitted scope',
'VIOL candidate scope must be selected',
],
},
{
label: 'negative-unconfirmed-requirement',
expected: 'FAIL',
expectedViolations: [
'VIOL critical-path item #203 failed admission criterion: requirement_confirmed',
],
},
{
label: 'negative-unreproduced-bug',
expected: 'FAIL',
expectedViolations: [
'VIOL critical-path item #204 failed admission criterion: bug_reproduced_or_pinpointed',
],
},
{
label: 'negative-bug-not-applicable-evasion',
expected: 'FAIL',
expectedViolations: [
'VIOL critical-path bug item #207 cannot use not-applicable for bug_reproduced_or_pinpointed',
],
},
{
label: 'negative-calendar-only-promotion',
expected: 'FAIL',
expectedViolations: [
'VIOL calendar target alone cannot admit critical-path item #208',
],
},
{
label: 'negative-zero-critical-path-items',
expected: 'FAIL',
expectedViolations: [
'VIOL candidate with admission_items requires at least one critical-path item',
],
},
{
label: 'negative-invalid-admission-schema',
expected: 'FAIL',
expectedViolations: [
'VIOL promoted_by_calendar_only must be a boolean',
'VIOL admission_items[0] requires a non-empty id',
'VIOL admission item #0 promoted_by_calendar_only must be a boolean',
],
},
{
label: 'negative-unapproved-release',
expected: 'FAIL',
expectedViolations: [
'VIOL release merge requires explicit authorization for current candidate SHA',
],
},
];

for (const [label, expected] of cases) {
const result = spawnSync(process.execPath, [grader, join(fixtureDir, label + '.json')], { encoding: 'utf8' });
for (const testCase of cases) {
const result = spawnSync(
process.execPath,
[grader, join(fixtureDir, testCase.label + '.json')],
{ encoding: 'utf8' },
);
const output = (result.stdout || '') + (result.stderr || '');
const verdict = output.trimEnd().split('\n').at(-1) ?? '';
const valid = expected === 'PASS'
? result.status === 0 && verdict === 'EVAL PASS'
: result.status !== 0 && verdict === 'EVAL FAIL' && /^VIOL /m.test(output);
const lines = output.trimEnd().split('\n');
const verdict = lines.at(-1) ?? '';
const violLines = lines.filter((line) => line.startsWith('VIOL '));

let valid = false;
let mismatchDetail = '';
if (testCase.expected === 'PASS') {
valid = result.status === 0 && verdict === 'EVAL PASS' && violLines.length === 0;
} else {
const expectedViolations = testCase.expectedViolations ?? [];
const exactMatch =
violLines.length === expectedViolations.length &&
expectedViolations.every((expectedLine) => violLines.includes(expectedLine));
valid = result.status !== 0 && verdict === 'EVAL FAIL' && exactMatch;
if (!exactMatch) {
mismatchDetail =
'expected VIOLs: ' +
JSON.stringify(expectedViolations) +
'; actual VIOLs: ' +
JSON.stringify(violLines);
}
}

if (valid) {
console.log(' ok ' + label.padEnd(34) + ' -> ' + verdict);
console.log(' ok ' + testCase.label.padEnd(36) + ' -> ' + verdict);
} else {
console.error(' FAIL ' + label.padEnd(34) + ' -> ' + verdict +
' (exit ' + String(result.status) + '; expected ' + expected + ')');
console.error(
' FAIL ' +
testCase.label.padEnd(36) +
' -> ' +
verdict +
' (exit ' +
String(result.status) +
'; expected ' +
testCase.expected +
')',
);
if (mismatchDetail) console.error(' ' + mismatchDetail);
console.error(output);
failed = true;
}
Expand All @@ -45,6 +165,14 @@ const required: ReadonlyArray<readonly [string, string]> = [
['skills/github-delivery/SKILL.md', '## Weekly planning / adaptive release batching'],
['skills/github-delivery/SKILL.md', 'references/adaptive-release-batching.md'],
['skills/github-delivery/references/adaptive-release-batching.md', 'hold | candidate | blocked'],
['skills/github-delivery/references/adaptive-release-batching.md', '## 1.5 Release scope admission gate'],
['skills/github-delivery/references/adaptive-release-batching.md', '`critical-path` / `research-discovery` / `backlog`'],
['skills/github-delivery/references/adaptive-release-batching.md', '`requirement_confirmed`'],
['skills/github-delivery/references/adaptive-release-batching.md', '`bug_reproduced_or_pinpointed`'],
['skills/agent-delivery-estimation/SKILL.md', 'release scope admission gate'],
['skills/agent-delivery-estimation/SKILL.md', '`critical-path`'],
['skills/agent-delivery-estimation/SKILL.md', '`research-discovery`'],
['skills/agent-delivery-estimation/SKILL.md', '`backlog`'],
['skills/linear-release-control/SKILL.md', 'release cadenceは可変'],
['docs/adr/ADR-0032.md', 'user authorization'],
];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"trigger": "weekly",
"outcome": "candidate",
"stage": "frozen",
"basis": {
"scope": "bug #207 attempts to bypass reproduction check via not-applicable",
"value": "bugfix for intermittent timeout",
"waiting": "3 days",
"change_risk": "low: single endpoint retry handler",
"release_cost": "measured release-only gate"
},
"admission_passed": true,
"promoted_by_calendar_only": false,
"admission_items": [
{
"id": "#207",
"item_type": "bug",
"track": "critical-path",
"promoted_by_calendar_only": false,
"requirement_confirmed": true,
"bug_reproduced_or_pinpointed": "not-applicable",
"acceptance_executable": true,
"dependency_owner_identified": true,
"validation_path_defined": true
}
],
"candidate_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"validated_sha": null,
"release_gate_passed": false,
"ticket_landing_requested": false,
"release_merge_requested": false,
"release_authorized": false,
"authorized_sha": null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"trigger": "weekly",
"outcome": "candidate",
"stage": "frozen",
"basis": {
"scope": "feature #208 promoted to critical path solely because target date arrived",
"value": "scheduled quarterly milestone item",
"waiting": "7 days",
"change_risk": "low: additive CLI option",
"release_cost": "measured release-only gate"
},
"admission_passed": true,
"promoted_by_calendar_only": false,
"admission_items": [
{
"id": "#208",
"item_type": "feature",
"track": "critical-path",
"promoted_by_calendar_only": true,
"requirement_confirmed": true,
"bug_reproduced_or_pinpointed": "not-applicable",
"acceptance_executable": true,
"dependency_owner_identified": true,
"validation_path_defined": true
}
],
"candidate_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"validated_sha": null,
"release_gate_passed": false,
"ticket_landing_requested": false,
"release_merge_requested": false,
"release_authorized": false,
"authorized_sha": null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"trigger": "weekly",
"outcome": "candidate",
"stage": "frozen",
"basis": {
"scope": "invalid admission item schema with whitespace id and non-boolean promoted_by_calendar_only",
"value": "admitted feature ready for users",
"waiting": "4 days",
"change_risk": "low: localized change",
"release_cost": "measured release-only gate"
},
"admission_passed": true,
"promoted_by_calendar_only": "false",
"admission_items": [
{
"id": " ",
"item_type": "feature",
"track": "critical-path",
"promoted_by_calendar_only": "no",
"requirement_confirmed": true,
"bug_reproduced_or_pinpointed": "not-applicable",
"acceptance_executable": true,
"dependency_owner_identified": true,
"validation_path_defined": true
}
],
"candidate_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"validated_sha": null,
"release_gate_passed": false,
"ticket_landing_requested": false,
"release_merge_requested": false,
"release_authorized": false,
"authorized_sha": null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"trigger": "weekly",
"outcome": "candidate",
"stage": "verified",
"basis": {
"scope": "candidate includes unconfirmed feature #203 on critical path",
"value": "user-requested workflow enhancement",
"waiting": "4 days",
"change_risk": "low: isolated UI handler",
"release_cost": "measured release-only gate"
},
"admission_passed": true,
"promoted_by_calendar_only": false,
"admission_items": [
{
"id": "#203",
"item_type": "feature",
"track": "critical-path",
"promoted_by_calendar_only": false,
"requirement_confirmed": false,
"bug_reproduced_or_pinpointed": "not-applicable",
"acceptance_executable": true,
"dependency_owner_identified": true,
"validation_path_defined": true
}
],
"candidate_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"validated_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"release_gate_passed": true,
"ticket_landing_requested": false,
"release_merge_requested": false,
"release_authorized": false,
"authorized_sha": null
}
34 changes: 34 additions & 0 deletions evals/release-batching/fixtures/negative-unreproduced-bug.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"trigger": "weekly",
"outcome": "candidate",
"stage": "frozen",
"basis": {
"scope": "candidate includes unreproduced bug #204 on critical path",
"value": "stability fix for crash report",
"waiting": "3 days",
"change_risk": "medium: runtime retry path",
"release_cost": "measured release-only gate"
},
"admission_passed": true,
"promoted_by_calendar_only": false,
"admission_items": [
{
"id": "#204",
"item_type": "bug",
"track": "critical-path",
"promoted_by_calendar_only": false,
"requirement_confirmed": true,
"bug_reproduced_or_pinpointed": false,
"acceptance_executable": true,
"dependency_owner_identified": true,
"validation_path_defined": true
}
],
"candidate_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"validated_sha": null,
"release_gate_passed": false,
"ticket_landing_requested": false,
"release_merge_requested": false,
"release_authorized": false,
"authorized_sha": null
}
Loading
Loading