logical.MergedFieldtypeno test imports ittype MergedField = "title" | "body" | "severity" | "state";The fields of a place that are merged three ways.
reconcile (0037-planning FR-016 to FR-018): what a source read, brought together with the store. Each observation is matched to an item (the anchor it carries, an external id, its fingerprint, its locator), classed against the trace last taken (new, unchanged, updated, absent: the baselineState of SARIF 2.1.0 section 3.27.24), and each difference of the place from its base becomes an event whose actor is the source, a tool, so that the authority of a field decides in fold; where the place, its base and the store all differ and the policy names no authority, the result is a conflict value and nothing is chosen. A thing no longer found is closed by a derived close and reopened if it is found again, unless a person closed it. The result is data (events, traces, conflicts, classes) and nothing is written. Async only because an id made of an external id takes a SHA-256.
import { reconcile } from "./reconcile.ts";
// const r = await reconcile({ source: "markdown", observations, items, traces, policy, now, wallMs, clock, actor });logical.MergedFieldtypeno test imports ittype MergedField = "title" | "body" | "severity" | "state";The fields of a place that are merged three ways.
logical.Conflicttypeno test imports ittype Conflict =
| { readonly kind: "field"; readonly item: ItemId; readonly field: MergedField; readonly base: string; readonly now: string; readonly store: string; readonly source: string }
| { readonly kind: "event-id"; readonly item: ItemId; readonly id: EventId; readonly source: string };A difference that nothing decides: it names the item, the field, the three values and the source (0037-planning FR-017).
logical.ReconcileInputtypeno test imports ittype ReconcileInput = {
readonly source: string;
readonly observations: readonly Observation[];
readonly items: re… (470 characters)type ReconcileInput = {
readonly source: string;
readonly observations: readonly Observation[];
readonly items: readonly Item[];
readonly traces: readonly Trace[];
readonly policy: Policy;
/** The instant the read was made, which the events made of it carry. */
readonly now: Instant;
/** The wall time in milliseconds, for the clock. */
readonly wallMs: number;
readonly clock: Clock;
/** The source as an actor. */
readonly actor: ToolActor;
};What reconcile is given.
logical.Classedtypeno test imports ittype Classed = { readonly fingerprint: string; readonly class: BaselineClass; readonly item: ItemId | undefined };How an observation ended, for the report.
logical.Reconciledtypeno test imports ittype Reconciled = {
readonly events: readonly ItemEvent[];
/** The traces to write: new, changed or made absent. */
readonly traces: readonly Trace[];
readonly links: readonly Link[];
readonly conflicts: readonly Conflict[];
readonly classes: readonly Classed[];
readonly clock: Clock;
};What reconcile gives: data, and the clock after the ids it made.
logical.ReconcileProblemtypeno test imports ittype ReconcileProblem =
| { readonly kind: "id"; readonly problem: IdProblem }
| { readonly kind: "clock"; readonly problem: ClockProblem }
| { readonly kind: "event"; readonly problem: EventProblem }
| { readonly kind: "time"; readonly problem: TimeProblem };Why reconcile cannot go on.
logical.stateKeyfunctionno test imports itfunction stateKey(s: ObservedState | State): stringThe state a place says, as the item's state says it, for comparing.
logical.reconcilefunctionno test imports itfunction reconcile(input: ReconcileInput): Promise<Result<Reconciled, ReconcileProblem>>Reconciles what a source read with the store: events, traces, links, conflicts and classes, as data.
MergedFieldtypeno test imports ittype MergedField = "title" | "body" | "severity" | "state";The fields of a place that are merged three ways.
Conflicttypeno test imports ittype Conflict =
| { readonly kind: "field"; readonly item: ItemId; readonly field: MergedField; readonly base: string; readonly now: string; readonly store: string; readonly source: string }
| { readonly kind: "event-id"; readonly item: ItemId; readonly id: EventId; readonly source: string };A difference that nothing decides: it names the item, the field, the three values and the source (0037-planning FR-017).
ReconcileInputtypeno test imports ittype ReconcileInput = {
readonly source: string;
readonly observations: readonly Observation[];
readonly items: re… (470 characters)type ReconcileInput = {
readonly source: string;
readonly observations: readonly Observation[];
readonly items: readonly Item[];
readonly traces: readonly Trace[];
readonly policy: Policy;
/** The instant the read was made, which the events made of it carry. */
readonly now: Instant;
/** The wall time in milliseconds, for the clock. */
readonly wallMs: number;
readonly clock: Clock;
/** The source as an actor. */
readonly actor: ToolActor;
};What reconcile is given.
Classedtypeno test imports ittype Classed = { readonly fingerprint: string; readonly class: BaselineClass; readonly item: ItemId | undefined };How an observation ended, for the report.
Reconciledtypeno test imports ittype Reconciled = {
readonly events: readonly ItemEvent[];
/** The traces to write: new, changed or made absent. */
readonly traces: readonly Trace[];
readonly links: readonly Link[];
readonly conflicts: readonly Conflict[];
readonly classes: readonly Classed[];
readonly clock: Clock;
};What reconcile gives: data, and the clock after the ids it made.
ReconcileProblemtypeno test imports ittype ReconcileProblem =
| { readonly kind: "id"; readonly problem: IdProblem }
| { readonly kind: "clock"; readonly problem: ClockProblem }
| { readonly kind: "event"; readonly problem: EventProblem }
| { readonly kind: "time"; readonly problem: TimeProblem };Why reconcile cannot go on.
stateKeyfunctionno test imports itfunction stateKey(s: ObservedState | State): stringThe state a place says, as the item's state says it, for comparing.
reconcilefunctionno test imports itfunction reconcile(input: ReconcileInput): Promise<Result<Reconciled, ReconcileProblem>>Reconciles what a source read with the store: events, traces, links, conflicts and classes, as data.