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
2 changes: 1 addition & 1 deletion codev-skeleton/protocols/air/protocol.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
},
"checks": {
"pr_exists": {
"command": "gh pr list --head \"$(git branch --show-current)\" --json number --jq 'length' | grep -q '^[1-9]'",
"command": "gh pr list --state all --head \"$(git branch --show-current)\" --json number --jq 'length' | grep -q '^[1-9]'",
"description": "PR must be created before signaling completion"
},
"e2e_tests": {
Expand Down
2 changes: 1 addition & 1 deletion codev-skeleton/protocols/aspir/protocol.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
},
"checks": {
"pr_exists": {
"command": "gh pr list --head \"$(git branch --show-current)\" --json number --jq 'length' | grep -q '^[1-9]'",
"command": "gh pr list --state all --head \"$(git branch --show-current)\" --json number --jq 'length' | grep -q '^[1-9]'",
"description": "PR must be created before signaling completion"
},
"review_has_arch_updates": {
Expand Down
2 changes: 1 addition & 1 deletion codev-skeleton/protocols/spir/protocol.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
},
"checks": {
"pr_exists": {
"command": "gh pr list --head \"$(git branch --show-current)\" --json number --jq 'length' | grep -q '^[1-9]'",
"command": "gh pr list --state all --head \"$(git branch --show-current)\" --json number --jq 'length' | grep -q '^[1-9]'",
"description": "PR must be created before signaling completion"
},
"review_has_arch_updates": {
Expand Down
2 changes: 1 addition & 1 deletion codev/protocols/air/protocol.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
},
"checks": {
"pr_exists": {
"command": "gh pr list --head \"$(git branch --show-current)\" --json number --jq 'length' | grep -q '^[1-9]'",
"command": "gh pr list --state all --head \"$(git branch --show-current)\" --json number --jq 'length' | grep -q '^[1-9]'",
"description": "PR must be created before signaling completion"
},
"e2e_tests": {
Expand Down
2 changes: 1 addition & 1 deletion codev/protocols/aspir/protocol.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
},
"checks": {
"pr_exists": {
"command": "gh pr list --head \"$(git branch --show-current)\" --json number --jq 'length' | grep -q '^[1-9]'",
"command": "gh pr list --state all --head \"$(git branch --show-current)\" --json number --jq 'length' | grep -q '^[1-9]'",
"description": "PR must be created before signaling completion"
},
"review_has_arch_updates": {
Expand Down
2 changes: 1 addition & 1 deletion codev/protocols/spir/protocol.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
},
"checks": {
"pr_exists": {
"command": "gh pr list --head \"$(git branch --show-current)\" --json number --jq 'length' | grep -q '^[1-9]'",
"command": "gh pr list --state all --head \"$(git branch --show-current)\" --json number --jq 'length' | grep -q '^[1-9]'",
"description": "PR must be created before signaling completion"
},
"review_has_arch_updates": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Regression test for bugfix #568: pr_exists check must use --state all
*
* Without --state all, gh pr list defaults to --state open, which causes
* the pr_exists check to fail when a PR has already been merged before
* the porch gate is approved.
*/

import { describe, it, expect } from 'vitest';
import * as fs from 'node:fs';
import * as path from 'node:path';

const ROOT = path.resolve(__dirname, '../../../../../..');

describe('bugfix #568: pr_exists check uses --state all', () => {
const protocolDirs = ['codev-skeleton/protocols', 'codev/protocols'];

for (const protocolDir of protocolDirs) {
const fullDir = path.join(ROOT, protocolDir);
if (!fs.existsSync(fullDir)) continue;

const protocols = fs.readdirSync(fullDir).filter((name) => {
const jsonPath = path.join(fullDir, name, 'protocol.json');
return fs.existsSync(jsonPath);
});

for (const proto of protocols) {
const jsonPath = path.join(fullDir, proto, 'protocol.json');
const raw = fs.readFileSync(jsonPath, 'utf-8');
const parsed = JSON.parse(raw);

// Find all pr_exists checks across phases
const phases: Array<{ id: string; checks?: Record<string, unknown> }> =
parsed.phases ?? [];

for (const phase of phases) {
if (!phase.checks) continue;
const prCheck = phase.checks['pr_exists'] as
| { command?: string }
| undefined;
if (!prCheck?.command) continue;

it(`${protocolDir}/${proto} phase "${phase.id}" pr_exists includes --state all`, () => {
expect(prCheck.command).toContain('--state all');
});
}
}
}
});