Never close items on unverified required checks when branch-protection metadata is unavailable

Merged
UN
1mo ago
+337-52

Closes #138.

Closeout could accept observed green runs while repository required-check metadata was unavailable. Caller declarations also split names such as CI / build and test (22) on whitespace, so valid required checks appeared missing.

Closeout now refuses unavailable metadata with required_checks_unverified unless the caller declares its required contexts. Each declaration contains one literal context name per line: trim each line, drop empty lines, and preserve spaces, parentheses, slashes, quotes, and shell-shaped text. The workflow forwards the newline-joined environment value as one quoted argument using a Bash array; TypeScript parses the lines without shell evaluation or word splitting.

The README, CLI help, and caller template document the contract:

with:
  required-checks: |
    test (22)
    test (26)

Before, the fleet example was split into test, (22), and (26). It now verifies the exact test (22) and test (26) names. Every declared context must succeed on the selected head. Readable requirements retain their GitHub App bindings, and fully readable metadata retains its existing policy. Declared-only success explicitly states that repository required-check metadata was unavailable in both the gate reason and persisted actual_result. The caller template confines write grants to the closeout job.

Validation:

  • npm run release:check: 754/754 tests passed, zero failures/skips/cancellations/todos.
  • bun run release:check: 754/754 tests passed, zero failures/skips/cancellations/todos.
  • Both release gates used isolated CI-style Git identity and unchanged thresholds: exact 100/100/100/100 coverage across 13 authored modules, covering 10090 lines/statements, 257 functions, and 2866 branches. Static checks, privacy, audit, package, changelog, and attestation passed.
  • Pinned pm test pm-github-f1ev --run --progress --only-last --timeout 1800: 18/18 boundary tests passed. An initial run hit the default 120-second timeout; the completed rerun used the configured 1800-second timeout.
  • Behavioral revert proof: restoring only the old required-context parsing stanza in runCloseout, rebuilding, and running node --test --test-name-pattern="newline required contexts" test/closeout-workflow.test.ts fails all 5/5 regressions with zero closes instead of one. The fixed parser was restored and rebuilt. The tracker records this proof and the earlier policy/evidence revert proofs.

Tests execute the workflow's real Bash and packed command against synthetic HTTP evidence, real SDK trackers, and isolated Git remotes. They cover a single name, spaces/parentheses/slashes, the fleet example, empty lines/CRLF, and literal $(id), quotes, backslashes, and glob characters. Empty declarations still refuse unavailable metadata, and former space-separated lists are treated as one literal context.

Caller declarations must use separate lines and remain aligned with repository policy.

Tracker: pm-github-f1ev, released and left in progress for orchestrator verification.