/** * per-job-green, the by-reference validation primitive. * * Given a commit SHA, find that commit's push-CI run for a named workflow, wait * for it to complete, and assert EVERY job concluded `success` (per-job green, * never the rollup). Generalizes the agent repo's bespoke poll, which asserted * only the rollup plus one hard-coded job name. * * Transient-error posture: EVERY GitHub API call (runs listing, per-run jobs, * check-suites, check-runs) goes through a bounded retry loop (default 8 * attempts with 7s sleeps, configurable) before its status is treated as * final, the API's known flaky mode makes single-shot calls fail a meaningful * fraction of the time. When the runs listing stays unavailable after retries, * the Checks API (`check-suites` / `check-runs` on the commit) is the fallback. * "No run found yet" is never a failure, it waits and polls. Only an exhausted * retry budget on a needed endpoint, a non-green job, or the deadline produces * a failure, and each names its source honestly. * * The fallback answers the SAME question as the primary path or it answers * nothing: `success` is the only green conclusion on both, the verdict covers * only check runs attributable to the target workflow (a commit routinely * carries sibling-workflow and third-party check runs, and neither may move the * verdict in either direction), and at least one attributable check run must * exist, so a commit carrying only some other workflow's green checks fails * closed instead of borrowing their verdict. */ import type { HttpGetJson, Logger, Sleep } from './effects.js'; import type { PerJobGreenConfig } from '../config.js'; export interface PerJobGreenResult { readonly ok: boolean; /** The resolved Actions run id, when one was found. */ readonly runId: number | null; /** Head SHA the resolved run actually built (for the artifact-integrity handoff). */ readonly headSha: string | null; /** Names of jobs/checks that did not conclude `success`. */ readonly failures: readonly string[]; /** Which source produced the verdict. */ readonly source: 'actions' | 'check-suites' | 'none'; readonly reason: string; } export interface PerJobGreenDeps { readonly http: HttpGetJson; readonly sleep: Sleep; readonly logger: Logger; /** Milliseconds since epoch; injectable so the deadline is deterministic in tests. */ readonly now: () => number; /** GitHub API origin. Defaults to https://api.github.com. */ readonly apiBase?: string; /** Bearer token for the API. */ readonly token?: string; } /** * Extract the Actions run id from a check-run's details_url. Actions-created * check runs point at `https://github.com/{owner}/{repo}/actions/runs/{run_id}/job/{job_id}`. */ export declare function runIdFromDetailsUrl(detailsUrl: string | undefined): number | null; /** * Verify `sha`'s push-CI run is per-job green. Polls until the run completes or * the deadline passes. Deterministic under injected `http`/`sleep`/`now`. */ export declare function verifyPerJobGreen(deps: PerJobGreenDeps, config: PerJobGreenConfig, sha: string): Promise; //# sourceMappingURL=per-job-green.d.ts.map