import { z } from 'zod'; import { type AuthoredFixture, type CompiledRule, type ProvenanceRecord } from '../compiler-schema.js'; import { type PreimageDifferentialResult } from './preimage-differential.js'; import type { SplitArtifact } from './split.js'; /** * The 3-way disposition of a positive fixture that did NOT emit a control * (strategy#777): `illegitimate` (the matcher is fix-shaped / over-matching / * vacuous — never a legitimate control), `undecidable` (the differential could * not be established — routes to operator adjudication), `deferred` (a typed * non-pass whose source is not yet supported, e.g. the commit-pair fallback). */ declare const AuthoredNonEmissionClassSchema: z.ZodEnum<["illegitimate", "undecidable", "deferred"]>; export type AuthoredNonEmissionClass = z.infer; /** * A legitimate, differential-gated positive control, keyed on the fixture LOCUS * (strategy#777 §6, `aa2a501`/`614dfdf`) — symmetric with the negative control and * aligned to §8 `firingLabelId(ruleId, pr, filePath, matchedLine)`. `contentHash` is * span-content-only, so it is NOT locus-unique (two distinct loci in one PR with * byte-identical span content collide) and is deliberately NOT carried here — the * locus is the disambiguator. `contentHash` stays a fixture FIELD (ADR §3), unchanged. */ export declare const AuthoredPositiveControlSchema: z.ZodObject<{ /** The in-corpus PR the fixture anchors to (train-side; §5). */ pr: z.ZodNumber; /** The authored rule's stable id — its `lessonHash` (the C2a `firingLabelId ← ruleId` unification). */ targetRuleId: z.ZodString; /** Defect locus file — half of the (filePath, matchedSpan) per-fixture disambiguator. */ filePath: z.ZodString; /** Line-range or AST-node path — the defect locus, not just the file (admits two-loci-one-PR). */ matchedSpan: z.ZodString; }, "strict", z.ZodTypeAny, { pr: number; filePath: string; matchedSpan: string; targetRuleId: string; }, { pr: number; filePath: string; matchedSpan: string; targetRuleId: string; }>; export type AuthoredPositiveControl = z.infer; /** A declared, silence-only negative control (no differential, no `pr` — strategy#777 Q2). */ export declare const AuthoredNegativeControlSchema: z.ZodObject<{ /** The authored rule's stable id (its `lessonHash`). */ targetRuleId: z.ZodString; /** Near-miss locus file — half of the (filePath, matchedSpan) disambiguator. */ filePath: z.ZodString; /** Line-range or AST-node path — the near-miss locus, not just the file. */ matchedSpan: z.ZodString; }, "strict", z.ZodTypeAny, { filePath: string; matchedSpan: string; targetRuleId: string; }, { filePath: string; matchedSpan: string; targetRuleId: string; }>; export type AuthoredNegativeControl = z.infer; /** A positive fixture that did NOT clear the §4 gate — kept (never silently dropped) with its differential outcome + class. */ export declare const AuthoredNonEmissionSchema: z.ZodEffects; /** The 3-way class derived from `outcome` (strategy#777 classOf). */ class: z.ZodEnum<["illegitimate", "undecidable", "deferred"]>; /** First-line differential reason — present for `needs-adjudication` / `unsupported-source`. */ reason: z.ZodOptional; }, "strict", z.ZodTypeAny, { pr: number; class: "illegitimate" | "undecidable" | "deferred"; outcome: "differential-holds" | "fix-shaped" | "over-match" | "vacuous-silent" | "needs-adjudication" | "unsupported-source"; targetRuleId: string; reason?: string | undefined; }, { pr: number; class: "illegitimate" | "undecidable" | "deferred"; outcome: "differential-holds" | "fix-shaped" | "over-match" | "vacuous-silent" | "needs-adjudication" | "unsupported-source"; targetRuleId: string; reason?: string | undefined; }>, { pr: number; class: "illegitimate" | "undecidable" | "deferred"; outcome: "differential-holds" | "fix-shaped" | "over-match" | "vacuous-silent" | "needs-adjudication" | "unsupported-source"; targetRuleId: string; reason?: string | undefined; }, { pr: number; class: "illegitimate" | "undecidable" | "deferred"; outcome: "differential-holds" | "fix-shaped" | "over-match" | "vacuous-silent" | "needs-adjudication" | "unsupported-source"; targetRuleId: string; reason?: string | undefined; }>; export type AuthoredNonEmission = z.infer; /** The three emission lists this builder produces (the §6 controls surface, inert-until-D). */ export declare const AuthoredControlsSchema: z.ZodObject<{ positive: z.ZodArray, "many">; negative: z.ZodArray, "many">; nonEmissions: z.ZodArray; /** The 3-way class derived from `outcome` (strategy#777 classOf). */ class: z.ZodEnum<["illegitimate", "undecidable", "deferred"]>; /** First-line differential reason — present for `needs-adjudication` / `unsupported-source`. */ reason: z.ZodOptional; }, "strict", z.ZodTypeAny, { pr: number; class: "illegitimate" | "undecidable" | "deferred"; outcome: "differential-holds" | "fix-shaped" | "over-match" | "vacuous-silent" | "needs-adjudication" | "unsupported-source"; targetRuleId: string; reason?: string | undefined; }, { pr: number; class: "illegitimate" | "undecidable" | "deferred"; outcome: "differential-holds" | "fix-shaped" | "over-match" | "vacuous-silent" | "needs-adjudication" | "unsupported-source"; targetRuleId: string; reason?: string | undefined; }>, { pr: number; class: "illegitimate" | "undecidable" | "deferred"; outcome: "differential-holds" | "fix-shaped" | "over-match" | "vacuous-silent" | "needs-adjudication" | "unsupported-source"; targetRuleId: string; reason?: string | undefined; }, { pr: number; class: "illegitimate" | "undecidable" | "deferred"; outcome: "differential-holds" | "fix-shaped" | "over-match" | "vacuous-silent" | "needs-adjudication" | "unsupported-source"; targetRuleId: string; reason?: string | undefined; }>, "many">; }, "strict", z.ZodTypeAny, { positive: { pr: number; filePath: string; matchedSpan: string; targetRuleId: string; }[]; negative: { filePath: string; matchedSpan: string; targetRuleId: string; }[]; nonEmissions: { pr: number; class: "illegitimate" | "undecidable" | "deferred"; outcome: "differential-holds" | "fix-shaped" | "over-match" | "vacuous-silent" | "needs-adjudication" | "unsupported-source"; targetRuleId: string; reason?: string | undefined; }[]; }, { positive: { pr: number; filePath: string; matchedSpan: string; targetRuleId: string; }[]; negative: { filePath: string; matchedSpan: string; targetRuleId: string; }[]; nonEmissions: { pr: number; class: "illegitimate" | "undecidable" | "deferred"; outcome: "differential-holds" | "fix-shaped" | "over-match" | "vacuous-silent" | "needs-adjudication" | "unsupported-source"; targetRuleId: string; reason?: string | undefined; }[]; }>; export type AuthoredControls = z.infer; /** * Injection port for the §4 differential evaluator (the test seam). Defaults to * the real `evaluatePreimageDifferential`; the co-located suite injects a stub so * it needs NO git/engine and can drive each of the 6 outcomes + an artificial * per-index delay (the determinism probe). * * NOTE — this is NOT the C1 `PreimageDifferentialDeps` git-read port * (`{ readFileAtCommit }`). That port threads INTO the evaluator at the deferred * commit-source slice; here the whole evaluator is the unit under injection, which * is what lets the suite control outcomes (a git-read stub cannot). */ export interface AuthoredControlsDeps { evaluate: (rule: CompiledRule, fixture: AuthoredFixture) => Promise; } /** * Build the §6 authored controls (positive + negative + the kept non-emissions) * for a set of compiled AUTHORED rules, gating positives on the §4 preimage- * differential. Inert: emits nothing into a cert run. * * Provenance contract (D1 fold #1): the caller MUST supply `provenanceByRule` * (`lessonHash → provenance`); this function reads provenance ONLY from that sidecar * map and NEVER from `rule.legitimacy` (absent at the cert-assembly seam — stamped * post-scoring, survivors-only). Fail-loud (Tenet-4): a rule missing from the map, a * non-authored (mined) provenance entry, a held-out positive fixture (§5 leakage), a * producer/policy mismatch, or a duplicate locus key all THROW — never a silent skip. * * Determinism (Tenet-15): the output arrays are byte-identical across re-runs for * identical inputs. Positives/non-emissions follow input order (rule order × * declared `positiveFixtures` order); negatives follow rule order × declared * `negativeFixtures` order. The differential runs under `Promise.all`, which * preserves the positional task order regardless of settle timing — never a * push-on-settle / Set/Map iteration. */ export declare function deriveAuthoredControls(params: { rules: CompiledRule[]; split: SplitArtifact; /** * SIDECAR provenance per rule (`lessonHash → provenance`) — the D1 fold-#1 reshape. * The function reads ONLY this map for provenance; it never touches `rule.legitimacy` * (absent at the assembly seam, stamped post-scoring). The assembler builds it from * each `CompiledCandidate.provenance`. */ provenanceByRule: Map; deps?: AuthoredControlsDeps; /** * Fixture PRs proven STRICTLY PRE-WINDOW by ancestry (`is-ancestor(mergeCommit(pr), * cutBoundarySha)`) at the git-holding command boundary — the #2294-couple leakage- * semantics ruling (operator option (a), strategy#810): legal iff `∉ heldOut` ∧ * (`∈ train` ∨ strictly pre-window). Absent/empty reproduces the strict pre-ruling * behavior byte-for-byte. */ verifiedPreWindowFixturePrs?: ReadonlySet; }): Promise; export {}; //# sourceMappingURL=authored-controls.d.ts.map