import type { ComponentRecord } from './composition.js'; import type { NotObservedKind, RunReport } from './format.js'; import type { LexiconReport } from './lexicon.js'; /** * What a run knew about its suite, at a commit, as bytes. * * The run report is the artifact an agent reads about *this run*. This is the * other half, and it is a different artifact because it answers a different * question: **what did the suite look like somewhere else**. Which components * exist, which subjects hold them, which of them has an example of its own, and * every name the run wrote down. A branch asking any of those against `main` has * nothing to ask today, because `main`'s answers were computed on a machine that * has since gone away. * * ## Why it is not the report * * Half the composition is a *finding about one run* and would be a lie in a * baseline. `movements` is what moved since a comparison nobody else made; * `divergences` and `echoes` are readings of one commit's snapshots. None of them * is a fact about the suite, so none of them is here. What is here is the census, * the subject denominator it is counted against, and the lexicon — the three * things that are still true when read from another checkout. * * ## Why it is not JSON * * A lexicon is, structurally, the same few thousand strings written down once per * subject that holds them: component names, roles, files, tokens. In JSON every * occurrence is a fresh quoted copy, and the repetition *is* the payload. Interned * once and referenced by number, it stops being one — * [`core/segment`](https://github.com/Variance-Authority/variance-authority/blob/main/packages/core/src/segment/index.ts) is the arithmetic, shared with * the source index, which reached the same conclusion about the same kind of data. * * The argument the report file makes for its own format is about the file being * the contract rather than about the encoding: produced by CI on a pinned machine, * queried on a laptop, testable against something nobody rendered. All of that is * as true of a segment, and nobody reads a three-hundred-subject lexicon by eye. * * ## Position * * The index carries the commit it was written at and nothing else about where it * is, which is the rule * [`sense`'s selection index](https://github.com/Variance-Authority/variance-authority/blob/main/packages/sense/src/test-selection/commit.ts) already * settled: a commit answers *what changed since this was written* exactly, and a * timestamp says when a machine was rather than where a tree was. An index with * no commit is the honest record of a run that could not name itself, and a reader * holding one has nothing to diff — which is the direction this is allowed to fail * in. */ export interface SuiteIndex { /** * Where this is, and the whole of it. Absent when the run could not name * itself, which is a laptop and is not a default anybody may fill in. */ readonly commit?: string; /** Subjects that contributed a snapshot, in plan order. The denominator. */ readonly subjects: readonly string[]; /** The census, in the order the composition wrote it: by name, code-unit order. */ readonly components: readonly ComponentRecord[]; /** Every name the run saw, per subject. Absent when the run read no names. */ readonly lexicon?: LexiconReport; /** * What became of every subject the plan named, in plan order, then the ones * the plan itself left out. Absent from an index a run published, whose * report holds that list; present, failures included, from a collection. */ readonly coverage?: readonly SubjectCoverage[]; /** Which plan, recipe and cut the index was composed from. Absent from a run's. */ readonly provenance?: SuiteProvenance; } /** * What became of one planned subject: read, or not observed in one of the ways * a run's report names, with a reason. A failed subject stays in the index, so * a lookup that misses it says it failed rather than that it is not there. */ export interface SubjectCoverage { readonly subject: string; readonly outcome: 'collected' | NotObservedKind; /** Why it was not collected. Absent for a collected subject. */ readonly because?: string; } export interface SuiteProvenance { /** sha256 of the plan every part was cut from. */ readonly plan: string; /** sha256 of what the evidence was read under. */ readonly recipe: string; /** * How the plan was cut into shards. Not how many: the index is the same * whichever number of jobs read it, and says so by not depending on it. */ readonly assignment: string; readonly storybook?: string; readonly source?: string; /** The `--subjects` glob the collection was narrowed by. Absent for the whole plan. */ readonly scope?: string; } /** * The baseline-bearing half of a report. * * `undefined` when the run produced no composition — a raster-only tier holds no * boundaries and no names, and an index of nothing would answer *this suite holds * nothing* where the truth is *nothing was read*. */ export declare function suiteIndexOf(report: RunReport): SuiteIndex | undefined; /** Encode a suite index: interned strings, dense columns, and offset lists. */ export declare function encodeSuiteIndex(index: SuiteIndex): Uint8Array; /** Decode a suite index. Any malformed reference rejects the whole file. */ export declare function decodeSuiteIndex(input: Uint8Array): SuiteIndex; //# sourceMappingURL=suite-index.d.ts.map