/** * Test-set registration — the produced tests of a completed `qe-author-tests` run become a durable * record the Test landing can show (wave 6, F-7R2-014). * * The landing (`GET /campaigns` → studio `/testing/campaigns`) used to stay "No tests yet" after a * completed New test: a single-repo launch registered no engine campaign (`campaignRegistered: * false`), no label group, and its verdicts existed nowhere the Testing UI reads. Two things fix it: * * - the launch files the run under a LABEL GROUP (`groupLabel`, `RunGroup` on `GET /campaigns`) — * the run is on the surface from the moment it launches; * - at the run's TERMINAL frame this module reads the verify phase's transcript (the * `QE-VERIFY` report — what was produced, what ran, what passed), and registers a {@link TestSet}: * a durable `testing.testset.registered` audit entry (the daemon's system of record for run * provenance, task #88) plus this read-side index, hydrated from the trail at boot like the * retry/group/delivery indexes. `GET /campaigns` serves the sets as `test_sets`. * * NOT an engine campaign: `launchCampaign` schedules NODES that would RUN; a finished test set is a * record of tests that exist, keyed by the run that produced them — a campaign-shaped read over a * completed run, never a second execution. * * Deny-dominates on the wire: a run whose verify phase FAILED (a produced test failed, or was never * executed) is registered too, `verified: false` with the counts — the landing must show a red set * honestly rather than hide the run. A run that never reached its verify verdict registers with a * `null` report. */ import type { CoreAdapter } from '../core/adapter.js'; import type { Actor, AuditEntry, SessionView } from '../core/types.js'; import type { AuditLog } from '../api/audit.js'; import { QE_AUTHOR_TESTS_WORKFLOW, type QeVerifyReport } from './author-workflow.js'; /** The audit action a registration writes — the durable record the index hydrates from. */ export declare const TEST_SET_REGISTERED_ACTION = "testing.testset.registered"; /** The actor a daemon-side registration writes under. */ export declare const TEST_SET_ACTOR: Actor; /** A registered test set — published as `TestSet` in wicked-crew-api-types (0.36.0). */ export interface TestSet { /** `testset-`: one set per producing run. */ id: string; run_id: string; workflow_id: typeof QE_AUTHOR_TESTS_WORKFLOW; /** The label group the launch filed the run under, when it did (`RunGroup.label`). */ label?: string; repo_ref: string | null; repo_name?: string; /** Unix millis. */ registered_at: number; /** The producing run's terminal status (`completed` | `failed` | `cancelled`). */ run_status: string; /** The verify unit's status (`done` | `rejected` | …), `null` when the run never planned one. */ verify_status: string | null; /** `true` only when the verify phase PASSED: every produced test executed and green, plan present. */ verified: boolean; /** The produced test files and the harness verdict on each (empty when no report). */ files: Array<{ path: string; harness: string; status: 'passed' | 'failed' | 'not-executed'; }>; produced: number; executed: number; passed: number; failed: number; not_executed: number; /** The produced `tests/PLAN-*.md`, `null` when none was produced. */ plan: string | null; /** The harnesses the produced tests ran under (unique, in first-use order). */ harnesses: string[]; /** The delivered PR, when the engine's deliver phase opened one. */ deliverUrl?: string; } /** Read-side index over the trail's `testing.testset.registered` entries. */ export declare class TestSetIndex { private readonly byRun; /** Hydrate from trail entries (newest first, as `readAll` returns them) — the first seen per run wins. */ hydrateFromEntries(entries: AuditEntry[]): void; hydrate(audit: AuditLog, log?: (msg: string) => void): Promise; set(set: TestSet): void; forRun(runId: string): TestSet | undefined; /** Every set, newest registration first. */ list(): TestSet[]; } /** The label group `POST /testing/author` files a run under — `qe-tests-` (one group per * repo, so the landing shows every authoring run over a repo together), `qe-tests` when unscoped. */ export declare function qeTestsGroupLabel(repoName: string | null | undefined): string; export interface RegisterTestSetDeps { adapter: Pick; audit: AuditLog; index: TestSetIndex; /** The delivered PR URL for a run, when one is recorded (`DeliveryIndex.urlFor`). */ deliveryUrlFor?: (runId: string) => string | undefined; /** The launch-time label group, when one was filed (`GroupIndex.attachOf`). */ labelFor?: (runId: string) => string | undefined; log?: (msg: string) => void; } /** Whether this run IS a `qe-author-tests` run — by its recorded name (`runNameOf`, seam X2). */ export declare function isQeAuthorRun(run: SessionView): boolean; /** Build the record from the run view + the verify report (pure — tests drive it directly). */ export declare function buildTestSet(view: SessionView, report: QeVerifyReport | null, extra: { registeredAt: number; label?: string; repoName?: string; deliverUrl?: string; }): TestSet; /** * Register the test set of a TERMINAL run when it is a `qe-author-tests` run. Idempotent per run * (a resume/retry re-terminal never double-writes the trail). Best-effort by construction — a * failure here is logged and never fails the run. Returns the set, or `null` when the run is not a * qe-author run (or is unknown). */ export declare function registerTestSetForRun(deps: RegisterTestSetDeps, runId: string): Promise; //# sourceMappingURL=test-sets.d.ts.map