/** * The accepted-observation baseline (#1014) — a committed record of deviations * somebody looked at and accepted, so they stop re-alerting. * * Deep observation reports every property that differs between source and * cloud, including properties nobody ever declared. Some of those are real * findings. Many are permanent facts of the account — a platform team's * mandatory tag, a bucket setting an org policy flips on, a role an operator * attached by hand and everyone agreed to keep. Without somewhere to record * "yes, we know, leave it", a deep diff is a report nobody reads twice. * * The model is cdk-real-drift's `.cdkrd`: a snapshot of accepted *undeclared* * values that the diff subtracts. Accepting is an explicit act with a git * commit behind it, and the acceptance is value-bound — accept * `VersioningConfiguration.Status = Enabled` and a later change to `Suspended` * is drift again, because what was accepted was that value, not that path. * * ## What this is not * * Not state. The baseline never tells a deploy what to do and is never read on * the write path; deleting it costs you noise suppression and nothing else. * Which is also why it is safe for it to be incomplete or stale. * * ## Where it lives * * `/observation-baseline.json` on the `chant/lifecycle` orphan * branch — the epic's named candidate home, and the same storage the snapshots * (`/.json`), the release ledger (`/releases.jsonl`) and the * build archive (`_builds/.json`) already use, through the same * `writeBlobToPath`/`readBlobFromPath` plumbing. One env-keyed namespace for * everything chant records *about* an environment rather than *for* it. * * The parse/serialize/update half below is pure and storage-free, so the * decision is one function call deep if a repo-committed file (`.chant/`) turns * out to be the better review surface. */ /** The file name under `/` on the orphan branch. */ export declare const OBSERVATION_BASELINE_FILE = "observation-baseline.json"; /** One deviation somebody accepted, bound to the value they accepted. */ export interface AcceptedDeviation { /** Property path within the entity's normalized tree (`Tags[0].Value`, `Policy.Statement[1].Effect`). */ path: string; /** The live value at the moment of acceptance. A different live value later is drift again. */ value: unknown; /** Free-text justification, written by whoever accepted it. */ note?: string; /** ISO timestamp of acceptance. */ recordedAt?: string; } /** Every accepted deviation for one declared entity. */ export interface BaselineEntity { /** Entity type at acceptance time, for readability in the committed file. */ type?: string; accepted: AcceptedDeviation[]; } /** Accepted deviations for one lexicon, keyed by chant entity name. */ export type BaselineLexicon = Record; /** The committed baseline document for one environment. */ export interface ObservationBaseline { /** Discriminant + wire version. */ readonly baseline: "v1"; environment: string; /** ISO timestamp of the last `--update-baseline`. */ updated?: string; /** lexicon → entity → accepted deviations. */ lexicons: Record; } /** An environment with nothing accepted yet. */ export declare function emptyBaseline(environment: string): ObservationBaseline; /** True when `value` is a well-formed {@link ObservationBaseline}. */ export declare function isObservationBaseline(value: unknown): value is ObservationBaseline; /** * Parse a baseline document. Returns `null` for unparseable or unrecognized * content — a corrupt baseline degrades to "nothing is accepted", which is * noisy but never wrong. Silently treating garbage as a baseline would * suppress real drift. */ export declare function parseBaseline(content: string | null | undefined): ObservationBaseline | null; /** Deterministic on-disk form: sorted keys, trailing newline, reviewable diff. */ export declare function serializeBaseline(baseline: ObservationBaseline): string; /** The accepted deviations for one lexicon, or an empty map. */ export declare function baselineForLexicon(baseline: ObservationBaseline | null | undefined, lexicon: string): BaselineLexicon; /** Look up one accepted deviation by entity + path. */ export declare function acceptedDeviation(lexiconBaseline: BaselineLexicon, entity: string, path: string): AcceptedDeviation | undefined; /** One deviation to record as accepted. */ export interface DeviationToAccept { entity: string; type?: string; path: string; /** The live value being accepted. */ value: unknown; note?: string; } /** * Record deviations as accepted, returning a new baseline (the input is not * mutated). An existing acceptance for the same entity+path is replaced — that * is how re-accepting after a deliberate change works, and it keeps the file * from growing a second entry for every value a path has ever held. */ export declare function acceptDeviations(baseline: ObservationBaseline, lexicon: string, deviations: readonly DeviationToAccept[], opts?: { now?: string; }): ObservationBaseline; /** Total accepted deviations across every lexicon — for the "N accepted" line. */ export declare function countAccepted(baseline: ObservationBaseline | null | undefined): number; /** * Read the accepted baseline for an environment. Returns `null` when the branch, * the environment, or the file does not exist — every one of which means * "nothing accepted yet", the normal state before anyone runs * `--update-baseline`. */ export declare function readObservationBaseline(environment: string, opts?: { cwd?: string; }): Promise; /** Write the accepted baseline to the orphan branch. Returns the new commit SHA. */ export declare function writeObservationBaseline(baseline: ObservationBaseline, opts?: { cwd?: string; }): Promise; //# sourceMappingURL=observation-baseline.d.ts.map