/** * CI-results evidence adapter (P4 — evidence collectors). * * Maps a CI run summary (test pass/fail counts, build status, optional flakiness * data) into an `EvidenceItem` for `computeReleaseConfidence`, using the * `ci-results` source kind reserved in confidence.schema.ts. * * Design: * - Pure function — no I/O, no side effects. The caller owns fetching the CI data * (e.g. from the `gh` API or a CI provider webhook); this adapter scores + maps. * - Applicability: * `applicable` — a real run with ≥1 test executed * `not_applicable` — no CI run on record for this ref (e.g. no CI configured) * `unknown` — run exists but results are incomplete/in-progress * - Score formula: pass-rate * build-weight * freshness-factor * pass-rate = passed / (passed + failed + errored) [0..1] * build-weight = 0.85 if build succeeded, 0.0 if build failed (a build failure * overrides the test pass-rate — tests that never ran are not "passing") * freshness = 1.0 when ageSeconds < FRESH_THRESHOLD, decaying linearly to * MIN_FRESHNESS over STALE_THRESHOLD. Beyond STALE_THRESHOLD the * applicability is coerced to `unknown` (matches §2.6 rule 3 of the spec). * - A build failure OR 0 tests passing marks evidence ['critical'] and forces a * blocking recommendation (the aggregator uses recommendations for narrative). * - Multi-tenant: tenantId flows through unchanged (caller sets it on the EvidenceItem * via the `collector.tool` string; the full tenant stamp is the subject, not the item). */ import type { EvidenceItem } from '../schemas/confidence.schema.js'; /** * Raw CI run data the caller provides (from `gh run view --json`, provider API, etc.). * Only the counts matter for scoring; everything else is for evidence strings + provenance. */ export interface CiRunInput { /** ISO-8601 timestamp when the run completed. */ completedAt: string; /** Whether the CI build step itself succeeded (compilation, lint, etc. — before tests). */ buildPassed: boolean; /** Number of test cases that passed. */ testsPassed: number; /** Number of test cases that failed (hard). */ testsFailed: number; /** Number of test cases that errored (infra/setup failure, not assertion failure). */ testsErrored: number; /** * Optional: number of tests that were flaky (passed on retry). Presence lowers score * slightly but doesn't fail the run — flaky tests are a warn, not a block. */ testsFlaky?: number; /** * Optional: CI provider URL for the run (e.g. `https://github.com/…/actions/runs/…`). * Never fabricated — omit rather than invent. */ runUrl?: string; /** Optional: CI workflow/pipeline name for the evidence string. */ workflowName?: string; /** * Optional: collector freshness budget override (seconds). Defaults to 24 h for stale. */ staleAfterSeconds?: number; } /** * Produce a `ci-results` EvidenceItem from a raw CI run summary. * * Deterministic and pure. Returns `not_applicable` when the run is absent, `unknown` * when stale or incomplete, and `applicable` with a real score otherwise. */ export declare function ciResultsToEvidence(run: CiRunInput, collectedAt?: string): EvidenceItem; //# sourceMappingURL=ci-results-adapter.d.ts.map