skip to the page

@jam-overture/loom/signals

Reader signals — what a published page reports about how it is read, and the parser a receiver checks them with.

Everything below is exported from that import. The names, the signatures and the sentences are read from the package itself rather than written here, so this page says what the copy of Loom in your node_modules says — and it changes in the same pull request the code does.

815 exports, in 78 modules. Generated from ./dist/signals/index.d.ts, which is the declaration file this package publishes for @jam-overture/loom/signals. Each comment inside a declaration is shown as its first paragraph. The whole of it is in that file.

Nothing to install first. Everything this import loads arrives with @jam-overture/loom itself.

A narrower door opens onto part of this one.

If that is all you came for, import it instead and your program never loads the rest.

@jam-overture/loom/signals/broadcast publishes 15 of the 815 exports below — the same names, declared the same way. It does not load zod, which this import does, and its JavaScript goes through 11 of the package's built files where this one goes through 100.

No import here has everything behind it — not even this one. @jam-overture/loom/signals publishes 815 of the 2,237 names this package publishes — more than any other import, and still less than half. The other 1,422 are behind one of the 19 other imports, and 17 of those 19 publish nothing this one does. The imports do not nest: a name that is not on this page is not a name that does not exist, and the search at the top of the page says which import it comes from.

Some of these names are published elsewhere too: 15 by @jam-overture/loom/signals/broadcast and 1 by @jam-overture/loom/telemetry — the same declarations reached through two doors, so either import gives you the same thing.

One name here means something else behind another door. horizonOf is published by @jam-overture/loom/telemetry as well, and it is declared differently there — the same name, not the same thing. Searching the name finds both, and only the signature tells them apart.

Acted

signals/acted

**What readers did, by the hour they did it in.**

ActedKindtype

The three kinds this counter holds, which are the kinds a reader aimed at something to cause and the kinds a goal may be made of.

type ActedKind = (typeof DELEGATED_READER_SIGNAL_KINDS)[number];

ACTED_KINDSvalue

const ACTED_KINDS: readonly ActedKind[]

isActedKindfunction

Whether a signal kind is one this counter holds.

const isActedKind: (kind: string) => kind is ActedKind

ActedCountstype

What readers did, as four numbers, with nothing saying what they did it to.

type ActedCounts = {
    readonly activations: number;
    readonly opens: number;
    readonly closes: number;
    readonly completions: number;
};

ActedHourCounttype

What readers did to one part of one revision, in one hour.

type ActedHourCount = ActedCounts & {
    readonly treeId: TreeId;
    readonly revision: number;
    readonly nodeId: NodeId;
    readonly type: PrimitiveType;
    /** The hour it happened in, as the instant that hour began (UTC). */
    readonly hour: number;
};

StoredActedHourtype

An hour's row as the store keeps it. See StoredTally.audienceId.

type StoredActedHour = ActedHourCount & {
    readonly audienceId: AudienceId;
    readonly updatedAt: string;
};

actedCountOffunction

The counter a kind is counted in.

const actedCountOf: (counts: ActedCounts, kind: ActedKind) => number

StoredActedtype

What a ranged read of the counter hands back, which is the shape {@link StoredArrivals } has and for the same two reasons.

type StoredActed = {
    /** Every row in the range, in no particular order. */
    readonly hours: readonly StoredActedHour[];
    /**
     * The first hour this scope has ever counted an action in, whatever range was
     * asked for.
     */
    readonly begins?: number;
};

ActedHourtype

One hour of a range, which is one bar. See {@link ArrivalHour }.

type ActedHour = {
    /** The instant the hour began (UTC). */
    readonly hour: number;
    /** What readers did in it, in the kind this series is of. */
    readonly count: number;
    /**
     * Whether this hour is over and inside the range.
     */
    readonly whole: boolean;
};

ActedSeriestype

What readers did over a range, by hour, in one kind.

type ActedSeries = {
    readonly range: ArrivalRange;
    readonly kind: ActedKind;
    /**
     * One entry per hour, ascending, from the later of the range's first hour and
     * the hour counting began. Dense: an hour nobody acted in is `count: 0` and
     * is present.
     */
    readonly hours: readonly ActedHour[];
    /** What readers did inside the range, which is the sum of the hours above. */
    readonly count: number;
    /** The first hour this scope ever counted, carried through from the store. */
    readonly begins?: number;
    /** Whether the range starts before counting did, so the series is shorter than asked for. */
    readonly clipped: boolean;
};

ActedSeriesOptionstype

What a series may be told besides the rows: the kind, and the clock.

type ActedSeriesOptions = ArrivalSeriesOptions & {
    /** Absent reads presses, which is the commonest goal there is. */
    readonly kind?: ActedKind;
};

actedSeriesOffunction

The hours of a range, as the counter answers for them.

const actedSeriesOf: (stored: StoredActed, range: ArrivalRange, options?: ActedSeriesOptions) => ActedSeries

ActedChangetype

What readers did in a range against what they did in the period before it.

type ActedChange = {
    readonly range: ArrivalRange;
    /** The equal-length period before, which is `arrivalRangeBefore`. */
    readonly before: ArrivalRange;
    readonly kind: ActedKind;
    readonly count: number;
    /**
     * What readers did in the earlier period, or `null` where counting had not
     * begun when it started.
     */
    readonly was: number | null;
    /** The quotient, or why there is none (`ratios.ts`). */
    readonly ratio: Ratio;
};

actedChangeOffunction

Both figures and the quotient, from one read spanning both periods.

const actedChangeOf: (stored: StoredActed, range: ArrivalRange, options?: ActedSeriesOptions) => ActedChange

ActedReadingRequesttype

What a surface asks for: a range, the narrowing, the kind and the clock.

type ActedReadingRequest = {
    readonly range: ArrivalRange;
    /** The kind the series is of. Absent reads presses. */
    readonly kind?: ActedKind;
    /** Absent reads every tree the handle can see, which is the scope rule. */
    readonly treeId?: TreeId;
    /**
     * The one part this is about, where it is about one.
     */
    readonly nodeId?: NodeId;
    /** Absent reads every audience, whose counts then add. */
    readonly audience?: AudienceId | undefined;
    /** Absent reads every revision, whose counts then add — which is what a goal wants. */
    readonly revision?: number;
    /** Now, where the caller has it, so the hour in progress is marked as one. */
    readonly now?: number;
};

ActedReadingtype

The chart and the figure beside it, from one read.

type ActedReading = {
    readonly series: ActedSeries;
    readonly change: ActedChange;
};

ActedCounterHandletype

The one method of the counter handle a reading of this needs.

type ActedCounterHandle = {
    readonly acted: (request?: {
        readonly treeId?: TreeId;
        readonly nodeId?: NodeId;
        readonly audience?: AudienceId | undefined;
        readonly revision?: number;
        readonly from?: number;
        readonly to?: number;
    }) => Promise<Result<StoredActed, ReaderSignalStoreError>>;
};

readReaderActedfunction

The chart, the range's figure and the change on the period before it, in one call against a counter handle.

const readReaderActed: (store: ActedCounterHandle, request: ActedReadingRequest) => Promise<Result<ActedReading, ReaderSignalStoreError>>

ActedAgainstHourtype

One hour of {@link ActedAgainst}: what readers did in it, and the page views those doings could have come from.

type ActedAgainstHour = {
    /** The instant the hour began (UTC). */
    readonly hour: number;
    /** What readers did in this hour, in the kind the reading is of. */
    readonly count: number;
    /**
     * The page views this hour's doings could have come from — **this hour's and
     * the hour before's** — or `null` where the reading cannot speak for the hour
     * before.
     */
    readonly views: number | null;
    /** Whether this hour is over and inside the range. Carried from {@link ActedHour.whole}. */
    readonly whole: boolean;
};

ActedAgainsttype

**What readers did over a range, by hour, against the readers who were there to do it.**

type ActedAgainst = {
    /** The range, as the acted series has it. */
    readonly range: ArrivalRange;
    /** The kind the numerators are of, as the acted series has it. */
    readonly kind: ActedKind;
    /**
     * One entry per hour of the acted series, ascending and in step with it.
     */
    readonly hours: readonly ActedAgainstHour[];
    /** What readers did inside the range, which is the sum of the hours above. */
    readonly count: number;
    /** The first hour the acted scope ever counted, carried through. */
    readonly begins?: number;
    /** Whether the range starts before the acted counter did. */
    readonly clipped: boolean;
};

actedAgainstOffunction

The two series, paired by hour.

const actedAgainstOf: (acted: ActedSeries, arrivals: ArrivalSeries) => ActedAgainst

ActedRatetype

What readers did in a range, over the page views they did it in.

type ActedRate = {
    /**
     * What readers did per hundred page views in the range, or `null` where there
     * is no quotient to take.
     */
    readonly per100: number | null;
    /** The same figure for the period before, or `null` on the same terms. */
    readonly was: number | null;
    /** The quotient of the two rates, or why there is none (`ratios.ts`). */
    readonly ratio: Ratio;
};

ActedRateReadingtype

What readers did over a range, the page views it happened in, and the rate.

type ActedRateReading = {
    readonly acted: ActedReading;
    readonly arrivals: ArrivalReading;
    readonly rate: ActedRate;
    /**
     * The two series paired by hour, which is {@link actedAgainstOf} of the two
     * above.
     */
    readonly against: ActedAgainst;
};

ActedRateHandletype

Both figures' handles, which one counter store satisfies.

type ActedRateHandle = ActedCounterHandle & ArrivalCounterHandle;

readReaderActedRatefunction

The figure, the chart, the denominator and the trend, from two reads of one store over one range.

const readReaderActedRate: (store: ActedRateHandle, request: ActedReadingRequest) => Promise<Result<ActedRateReading, ReaderSignalStoreError>>

Action

signals/action

What readers *did* on a page, rather than what they saw.

ActionStandingtype

What a window can say about whether readers acted on one part.

type ActionStanding =
/** A row credits it with readers who acted inside it, or with uses of its own. */
"acted"
/**
 * Readers reached it, it has an inside, and nothing happened in or on it.
 */
 | "untouched"
/**
 * Nothing can be said.
 */
 | "unknown";

ACTION_STANDINGSvalue

const ACTION_STANDINGS: readonly ActionStanding[]

describeActionStandingfunction

const describeActionStanding: (standing: ActionStanding) => string

PartActiontype

One element node of one revision, and what readers did with it.

type PartAction = {
    readonly nodeId: NodeId;
    readonly type: PrimitiveType;
    /** What part it plays, or `null` where its type declared none. */
    readonly role: PrimitiveRole | null;
    /** 0 at the root. */
    readonly depth: number;
    /**
     * The **tree** parent, which may be a slot and is then a node no reading has
     * a row for, and `null` at the root.
     */
    readonly parentId: NodeId | null;
    /**
     * What this window can say about whether readers acted on this part.
     */
    readonly standing: ActionStanding;
    /**
     * Whether any element part of this revision names it as a parent.
     */
    readonly bearsParts: boolean;
    /** Distinct page views that reported it coming into view, or `undefined` where no row named it. */
    readonly reached: number | undefined;
    /**
     * Distinct page views in which a reader used something strictly inside it
     *, or `undefined` where no row named it.
     */
    readonly within: number | undefined;
    /**
     * `within ÷ reached`, in `[0, 1]`, or `undefined`.
     */
    readonly share: number | undefined;
    /**
     * Presses, opens, closes and submissions filed against this part itself,
     * added.
     */
    readonly uses: number;
    /** The four occurrence counters, kept apart. `0` each where no row named it. */
    readonly counts: {
        readonly activations: number;
        readonly opens: number;
        readonly closes: number;
        readonly completions: number;
    };
    /**
     * `uses ÷ reached`, or `undefined` where nothing was used or nobody reached
     * it.
     */
    readonly usesPerReader: number | undefined;
    /**
     * `closes ÷ opens`, or `undefined` where nothing was opened.
     */
    readonly shutAgain: number | undefined;
};

PageActiontype

type PageAction = {
    readonly treeId: TreeId;
    readonly revision: number;
    /**
     * The page's view floor, carried through from the reading unchanged.
     */
    readonly views: number;
    /** Every element part of the revision, in reading order. */
    readonly parts: readonly PartAction[];
    readonly standings: Readonly<Record<ActionStanding, number>>;
    /**
     * The root, which is the one page-wide headcount this subsystem has.
     */
    readonly whole: PartAction | null;
    /**
     * The part the most readers reached and did nothing in: most reached, then
     * first in reading order.
     */
    readonly mostIgnored: PartAction | null;
    /**
     * Parts with no element parts under them, whose share is withheld for the
     * structural reason.
     */
    readonly leaves: number;
    /**
     * Whether the window holds uses and credits them to nobody.
     */
    readonly unwalked: boolean;
};

pageActionOffunction

What readers did on one revision of one page, off the reading of [parts.ts](parts.ts) and nothing else.

const pageActionOf: (reading: PageReading) => PageAction

Action change

signals/action-change

What a change made readers *do*, rather than what it made them see.

ActionChangeSilencetype

Why a comparison of what readers did answered nothing.

type ActionChangeSilence =
/**
 * The two readings are of different trees.
 */
"different-trees"
/**
 * The two readings are of two audiences, and so of two populations.
 */
 | "different-audiences"
/**
 * One of the two windows holds two forms of the page and named neither.
 */
 | "audiences-mixed"
/**
 * One of the two windows holds uses and credits no reader with acting inside
 * anything.
 */
 | "unwalked"
/**
 * One of the two windows held no page views.
 */
 | "nothing-measured"
/**
 * No part the two revisions share says anything on either side.
 */
 | "dissolved";

ACTION_CHANGE_SILENCESvalue

The closed set, for a surface that has to account for every absent figure.

const ACTION_CHANGE_SILENCES: readonly ActionChangeSilence[]

describeActionChangeSilencefunction

One line per silence, for a surface saying why a figure is not there.

const describeActionChangeSilence: (silence: ActionChangeSilence) => string

ActionMovementtype

What happened to the verdict on one part between two windows.

type ActionMovement =
/**
 * Readers reached it and did nothing in it, and now they do something — the
 * sentence a change to a band nobody uses is made for.
 */
"taken-up"
/** Readers did something in it and now they reach it and do nothing. */
 | "abandoned"
/**
 * Reached and untouched before, reached and untouched now — the asks a change
 * did not fix.
 */
 | "still-untouched"
/** Readers did something in it before and after. */
 | "held"
/**
 * One of the two windows cannot say whether readers acted on it.
 */
 | "unknown";

ACTION_MOVEMENTSvalue

The closed set, for a surface accounting for every part it was handed.

const ACTION_MOVEMENTS: readonly ActionMovement[]

describeActionMovementfunction

One line per movement, for a surface putting a part in front of a person.

const describeActionMovement: (movement: ActionMovement) => string

InsideMovementtype

What the change did to whether a part has an inside for actions to be filed against.

type InsideMovement =
/** It bore element parts in both revisions, so its share means the same thing on both sides. */
"kept"
/**
 * It was a leaf and now bears element parts, so it has a share where its share
 * was withheld.
 */
 | "gained"
/** It bore element parts and is now a leaf, so a share that was a measurement is withheld. */
 | "lost"
/** A leaf in both revisions: its share is withheld on both sides and its standing is `unknown` on both. */
 | "none";

INSIDE_MOVEMENTSvalue

The closed set, for a surface accounting for every compared part.

const INSIDE_MOVEMENTS: readonly InsideMovement[]

describeInsideMovementfunction

One line per movement, for a surface saying what the change did to a part's shape.

const describeInsideMovement: (movement: InsideMovement) => string

ComparedActiontype

One part both revisions have, as two windows read what readers did with it.

type ComparedAction = {
    readonly nodeId: NodeId;
    /** The later revision's type, which is the page somebody is looking at. */
    readonly type: PrimitiveType;
    /** The later revision's role, or `null` where its type declared none. */
    readonly role: PrimitiveRole | null;
    /** The whole of what the earlier window said about it. */
    readonly was: PartAction;
    /** The whole of what the later window said about it. */
    readonly now: PartAction;
    readonly movement: ActionMovement;
    /** What the change did to whether a share of this part is measurable at all. */
    readonly inside: InsideMovement;
    /**
     * `now.share ÷ was.share`, with the reason named where there is no quotient
     *.
     */
    readonly shareRatio: Ratio;
    /**
     * `now.usesPerReader ÷ was.usesPerReader`, with a nought a side withheld
     * restored first.
     */
    readonly usesRatio: Ratio;
};

ActionChangetype

What a change did to what readers do on a page.

type ActionChange = {
    /** The earlier reading's tree. The two agree unless `silence` is `different-trees`. */
    readonly treeId: TreeId;
    readonly revisions: {
        readonly was: number;
        readonly now: number;
    };
    /**
     * The audience each side was of, where its reading named one.
     */
    readonly audiences: ComparedAudiences;
    /** The two readings of what readers did that this comparison is made of. */
    readonly readings: {
        readonly was: PageAction;
        readonly now: PageAction;
    };
    /**
     * Every part both revisions have that a row named on either side, in the
     * **later** reading order.
     */
    readonly compared: readonly ComparedAction[];
    /**
     * Parts only the later revision has, as the later window read them, in its
     * reading order.
     */
    readonly added: readonly PartAction[];
    /** Parts only the earlier revision had, as the earlier window read them, in its reading order. */
    readonly removed: readonly PartAction[];
    /** Compared parts by what happened to the standing. The five add to {@link compared}'s length. */
    readonly movements: Readonly<Record<ActionMovement, number>>;
    /** Compared parts by what the change did to their shape. The four add to {@link compared}'s length. */
    readonly insides: Readonly<Record<InsideMovement, number>>;
    /**
     * The root, compared against itself across the two revisions.
     */
    readonly whole: ComparedAction | null;
    /**
     * The ask the change got answered: `taken-up`, most readers reached it in the
     * later window, then first in the later reading order.
     */
    readonly mostTakenUp: ComparedAction | null;
    /** The ask the change lost, on the same terms. */
    readonly mostAbandoned: ComparedAction | null;
    /**
     * The parts readers reached and did nothing in, before and after — most
     * reached now first, then in the later reading order.
     */
    readonly stillUntouched: readonly ComparedAction[];
    /** Why there is no comparison of the reading, or `null` where there is one. */
    readonly silence: ActionChangeSilence | null;
};

actionChangeOffunction

What a change did to what readers do on a page, off two PageReadings and nothing else.

const actionChangeOf: (was: PageReading, now: PageReading) => ActionChange

Agenda

signals/agenda

Whether the page at the head of a deployment's fix-list is a page to rewrite or a measurement to repair.

AgendaWorktype

What the next thing to do about one page is.

type AgendaWork =
/**
 * Rewrite the page: an order ranked it, and nothing in its collection reaches
 * the figure that put it there.
 */
"page"
/**
 * Repair the measurement: it is faulted, and either no order ranked it or a
 * fault reaches every loss it was ranked by.
 */
 | "collection"
/**
 * Both, and in that order.
 */
 | "both"
/**
 * Nothing any of the three readings asks for.
 */
 | "none";

AGENDA_WORKvalue

const AGENDA_WORK: readonly AgendaWork[]

describeAgendaWorkfunction

One line per member, for a surface saying what a row is asking for.

const describeAgendaWork: (work: AgendaWork) => string

AgendaSubjecttype

What a deployment's fix-list is about: its pages, or the intake under them.

type AgendaSubject =
/**
 * The rows are the answer.
 */
"pages"
/**
 * **Repair the intake.** Nothing was collected and the door turned deliveries
 * away.
 */
 | "intake"
/**
 * Nothing was collected and the door turned nothing away.
 */
 | "silence"
/**
 * Nothing was collected, and nothing offered a count of what the door turned
 * away.
 */
 | "unverified";

AGENDA_SUBJECTSvalue

const AGENDA_SUBJECTS: readonly AgendaSubject[]

describeAgendaSubjectfunction

One line per member, for a surface saying what a fix-list is about.

const describeAgendaSubject: (subject: AgendaSubject) => string

AgendaRowtype

One page of a deployment, as both readings have it.

type AgendaRow = {
    readonly treeId: TreeId;
    readonly revision: number;
    /**
     * The audience this row is about, or `null` where the readings named none.
     */
    readonly audienceId: AudienceId | null;
    readonly work: AgendaWork;
    /**
     * Whether a fault reaches the loss the order of falls ranked this page by.
     */
    readonly spoiled: boolean;
    /**
     * Whether a fault reaches the loss the order of conversions ranked this page
     * by.
     */
    readonly spoiledConversion: boolean;
    /** The page as the order of falls has it, carried whole and unchanged. */
    readonly order: RankedPage;
    /** The page as the order of conversions has it, carried whole and unchanged. */
    readonly conversion: LeakingPage;
    /** The page as the health reading has it, carried whole and unchanged. */
    readonly health: PageHealth;
    /**
     * The page as the order of **places** has it, carried whole and unchanged, or
     * `null` where that order has no reading of this page.
     */
    readonly unread: PageUnread | null;
};

DeploymentAgendatype

A deployment's pages, in the two orders that say what to do about them.

type DeploymentAgenda = {
    /**
     * What this fix-list is about, read before any row of it.
     */
    readonly subject: AgendaSubject;
    /**
     * Every page all three readings named, by tree id and newest revision first.
     */
    readonly rows: readonly AgendaRow[];
    /**
     * Pages whose **reading** falls, worst first, in the order of falls' own
     * order.
     */
    readonly page: readonly AgendaRow[];
    /**
     * Pages whose **asks** leak, worst first, in the order of conversions' own
     * order.
     */
    readonly converting: readonly AgendaRow[];
    /**
     * Pages whose collection to repair, worst first, in the health reading's own
     * order: the priced faults by the readers each costs, then the ones the door
     * cannot price.
     */
    readonly collection: readonly AgendaRow[];
    /**
     * Pages an order ranked and a fault spoiled — a **slice** of
     * {@link DeploymentAgenda.collection} and not a further list, so nothing here
     * is counted twice.
     */
    readonly contested: readonly AgendaRow[];
    /**
     * The one thing to do first, or `null` where the three readings ask for
     * nothing.
     */
    readonly first: AgendaRow | null;
    /** How many pages ask for each kind of work, over every row. */
    readonly work: Readonly<Record<AgendaWork, number>>;
    /**
     * Distinct trees across the rows, which is not the number of pages.
     */
    readonly trees: number;
    /**
     * Rows one reading named and the other did not, which is two windows handed
     * in as one.
     */
    readonly unpaired: {
        /** Rows the order of falls named that some other reading has no page for. */
        readonly order: number;
        /** Rows the health reading named that some other reading has no page for. */
        readonly health: number;
        /**
         * Rows the order of conversions named that some other reading has no page
         * for.
         */
        readonly conversion: number;
        /**
         * Pages the order of places named that no row of this fix-list carries.
         */
        readonly unread: number;
    };
    /**
     * Readings of a page beyond the first, on any side, which were dropped.
     */
    readonly duplicated: number;
};

deploymentAgendaOffunction

Join an order of a deployment's pages to the health of its collection, and publish the two orders that come out.

const deploymentAgendaOf: (order: DeploymentReading, conversion: DeploymentConversion, health: CollectionHealth, arrival: Pick<ArrivalStanding, "standing"> | null, unread: DeploymentUnread) => DeploymentAgenda

Arrivals

signals/arrivals

**When** readers arrived, which is the one thing every counter in this subsystem had thrown away.

ARRIVAL_HOUR_MSvalue

One hour, in milliseconds, which is the bucket every row here is filed in.

const ARRIVAL_HOUR_MS = 3600000

arrivalHourOffunction

The hour an instant falls in, as the instant that hour began.

const arrivalHourOf: (instant: string) => number | undefined

ArrivalHourCounttype

Page views that began in one hour, of one revision of one tree.

type ArrivalHourCount = {
    readonly treeId: TreeId;
    readonly revision: number;
    /** The hour they arrived in, as the instant it began (UTC). */
    readonly hour: number;
    /** Page views that *began* in this hour, so a longer visit is not a bigger number. */
    readonly views: number;
};

StoredArrivalHourtype

An hour's count as the store keeps it. See StoredTally.audienceId.

type StoredArrivalHour = ArrivalHourCount & {
    readonly audienceId: AudienceId;
    readonly updatedAt: string;
};

arrivalHoursOffunction

What one delivery adds, which is its openings filed under the hour the door read them in.

const arrivalHoursOf: (openings: readonly RevisionViews[], at: string) => Result<readonly ArrivalHourCount[], ReaderSignalStoreError>

StoredArrivalstype

What a ranged read of the counter hands back.

type StoredArrivals = {
    /** Every hour in the range that has a row, in no particular order. */
    readonly hours: readonly StoredArrivalHour[];
    /**
     * The first hour this scope has ever counted an arrival in, whatever range
     * was asked for.
     */
    readonly begins?: number;
};

ArrivalRangetype

A stretch of time, in milliseconds, closed at the start and open at the end.

type ArrivalRange = {
    readonly from: number;
    readonly to: number;
};

ArrivalHourtype

One hour of a range, which is one bar.

type ArrivalHour = {
    /** The instant the hour began (UTC). */
    readonly hour: number;
    readonly views: number;
    /**
     * Whether this hour is over and inside the range.
     */
    readonly whole: boolean;
};

arrivalRangeOffunction

The whole hours ending with the hour an instant falls in.

const arrivalRangeOf: (now: number, hours: number) => ArrivalRange

ArrivalSeriestype

Page views by hour over a range, dense, with the hours this deployment cannot speak for left out rather than drawn as nought.

type ArrivalSeries = {
    /** The range this is a series over, as asked for. */
    readonly range: ArrivalRange;
    /**
     * One entry per hour, ascending, from the later of the range's first hour and
     * the hour counting began.
     */
    readonly hours: readonly ArrivalHour[];
    /** Page views that began inside the range, which is the sum of the hours above. */
    readonly views: number;
    /**
     * The first hour the scope has ever counted, carried through from the store.
     */
    readonly begins?: number;
    /**
     * Whether the range starts before counting did.
     */
    readonly clipped: boolean;
};

ArrivalSeriesOptionstype

What a series may be told besides the rows, which is the one thing a clock knows.

type ArrivalSeriesOptions = {
    /**
     * Now, where a caller has it, so the hour in progress is marked as one.
     */
    readonly now?: number;
};

arrivalSeriesOffunction

The hours of a range, as the counter answers for them.

const arrivalSeriesOf: (stored: StoredArrivals, range: ArrivalRange, options?: ArrivalSeriesOptions) => ArrivalSeries

HourlyBuckettype

One bucket of a dense hourly series, before a reading names what it counted.

type HourlyBucket = {
    readonly hour: number;
    readonly count: number;
    readonly whole: boolean;
};

HourlyFilltype

A dense series and what it adds up to, which is what a reading dresses.

type HourlyFill = {
    readonly hours: readonly HourlyBucket[];
    readonly total: number;
    readonly clipped: boolean;
};

hourlySeriesOffunction

The rule every hourly series in this subsystem follows, spelled once.

const hourlySeriesOf: <Row extends {
    readonly hour: number;
}>(rows: readonly Row[], begins: number | undefined, range: ArrivalRange, count: (row: Row) => number, options?: ArrivalSeriesOptions) => HourlyFill

arrivalRangeBeforefunction

The stretch of the same length immediately before a range.

const arrivalRangeBefore: (range: ArrivalRange) => ArrivalRange

ArrivalChangetype

Page views in a range against page views in the period before it.

type ArrivalChange = {
    readonly range: ArrivalRange;
    /** The equal-length period the comparison is against, which is {@link arrivalRangeBefore}. */
    readonly before: ArrivalRange;
    readonly views: number;
    /**
     * Page views in the earlier period, or `null` where counting had not begun
     * when it started.
     */
    readonly was: number | null;
    /**
     * The quotient, or why there is none (`ratios.ts`).
     */
    readonly ratio: Ratio;
};

arrivalChangeOffunction

Both figures and the quotient, from one read.

const arrivalChangeOf: (stored: StoredArrivals, range: ArrivalRange, options?: ArrivalSeriesOptions) => ArrivalChange

ArrivalReadingRequesttype

What a surface asks for: a range, the narrowing, and the clock.

type ArrivalReadingRequest = {
    readonly range: ArrivalRange;
    /** Absent reads every tree the handle can see, which is the scope rule. */
    readonly treeId?: TreeId;
    /** Absent reads every audience, whose arrivals then add. */
    readonly audience?: AudienceId | undefined;
    /** Absent reads every revision, whose arrivals then add. */
    readonly revision?: number;
    /** Now, where the caller has it, so the hour in progress is marked as one. */
    readonly now?: number;
};

ArrivalCounterHandletype

The one method of the counter handle a reading of this needs.

type ArrivalCounterHandle = {
    readonly arrivals: (request?: {
        readonly treeId?: TreeId;
        readonly audience?: AudienceId | undefined;
        readonly revision?: number;
        readonly from?: number;
        readonly to?: number;
    }) => Promise<Result<StoredArrivals, ReaderSignalStoreError>>;
};

ArrivalReadingtype

The chart and the two figures above it, from one read.

type ArrivalReading = {
    readonly series: ArrivalSeries;
    readonly change: ArrivalChange;
};

readReaderArrivalsfunction

The chart, the range's figure and the change on the period before it, in one call against a counter handle.

const readReaderArrivals: (store: ArrivalCounterHandle, request: ArrivalReadingRequest) => Promise<Result<ArrivalReading, ReaderSignalStoreError>>

Arriving

signals/arriving

Whether nothing is arriving because nothing is posting, or because this deployment's door is turning it away.

TurnedAwayTallytype

One reason a door turned deliveries away, as a deployment's own counter holds it.

type TurnedAwayTally<TReason extends string = string> = {
    readonly reason: TReason;
    /** Deliveries turned away for this reason, cumulative since the counter existed. */
    readonly refused: number;
    /** When the newest of them was turned away, in epoch milliseconds. */
    readonly lastAt: number;
    /**
     * The site the newest of them came from, as an origin, or `null` where it
     * named none.
     */
    readonly lastOrigin: string | null;
};

NewestTurnedAwaytype

The newest delivery this door turned away, which is the one an operator acts on.

type NewestTurnedAway<TReason extends string = string> = {
    readonly reason: TReason;
    readonly origin: string | null;
    /** When it was turned away, in epoch milliseconds, as the counter holds it. */
    readonly atMs: number;
    /**
     * How long before the instant handed in it was turned away, or `null` where
     * no instant was.
     */
    readonly sinceMs: number | null;
};

ArrivalStandingNametype

Whether anything is arriving at this deployment, and why not.

type ArrivalStandingName =
/**
 * Nothing offered a count of what the door turned away, so the question
 * cannot be answered either way.
 */
"unasked"
/**
 * Nothing has been collected and nothing has been turned away.
 */
 | "silent"
/**
 * Nothing has been collected and deliveries have been turned away.
 */
 | "turned-away"
/** Something has been collected and nothing has been turned away. */
 | "collecting"
/**
 * Something has been collected and deliveries have been turned away.
 */
 | "mixed";

ARRIVAL_STANDINGSvalue

The closed set, in the order a surface reads them: the refusal, then the two quiet states, then the two live ones.

const ARRIVAL_STANDINGS: readonly ArrivalStandingName[]

ArrivalStandingtype

What is arriving at a deployment, what is being turned away, and what that means together.

type ArrivalStanding<TReason extends string = string> = {
    readonly standing: ArrivalStandingName;
    /**
     * Revisions anything at all was collected about, which is **not** a count of
     * readers.
     */
    readonly collected: number;
    /**
     * Page views counted at the door across every revision read, added.
     */
    readonly arrivals: number;
    /**
     * Deliveries turned away, added across the reasons, or `null` where nothing
     * offered a count.
     */
    readonly refused: number | null;
    /** The newest delivery turned away, or `null` where none was. */
    readonly newest: NewestTurnedAway<TReason> | null;
    /**
     * Tallies beyond the first for one reason, dropped.
     */
    readonly duplicated: number;
};

arrivalStandingOffunction

Read a window's health and a door's refusals together, into the one question neither can answer alone.

const arrivalStandingOf: <TReason extends string>(health: Pick<CollectionHealth, "pages" | "arrivals">, turnedAway: readonly TurnedAwayTally<TReason>[] | undefined, at?: number) => ArrivalStanding<TReason>

describeArrivalStandingfunction

One line for the operator setting a deployment up, because they are the only person who can close the gap.

const describeArrivalStanding: (standing: ArrivalStanding) => string

Audiences

signals/audiences

Which audience a window of counters is of, and what that makes one reading.

AudienceScopedtype

A row the store keeps one of per audience.

type AudienceScoped = {
    readonly audienceId: AudienceId;
};

MaybeAudienceScopedtype

A row that may or may not name its audience.

type MaybeAudienceScoped = {
    readonly audienceId?: AudienceId;
};

SideOfAudiencetype

One side of a comparison, as the population rule below needs to see it.

type SideOfAudience = {
    /** `null` or absent where nothing recorded which audience the window was of. */
    readonly audienceId?: AudienceId | null;
};

ReadingOfAudiencetype

A reading, or a row, as the key rule below needs to see it.

type ReadingOfAudience = SideOfAudience & {
    readonly treeId: TreeId;
    readonly revision: number;
};

audiencesInfunction

The audiences a window names, deduplicated and in a stable order.

const audiencesIn: <R extends MaybeAudienceScoped>(rows: readonly R[]) => readonly AudienceId[]

AudienceScopetype

What population a reading is of, as the three answers it can be.

type AudienceScope =
/**
 * One population: the audience asked for, or the only one the window named.
 */
{
    readonly reading: "one";
    readonly audienceId: AudienceId;
    /** What the window named, which is not what was asked for. */
    readonly audiences: readonly AudienceId[];
}
/**
 * Nothing in the window named an audience, so it is one population by
 * construction and is read whole.
 */
 | {
    readonly reading: "unlabelled";
    readonly audienceId: null;
    readonly audiences: readonly [];
}
/**
 * Two or more forms, and the asking named none of them.
 */
 | {
    readonly reading: "mixed";
    readonly audienceId: null;
    readonly audiences: readonly AudienceId[];
};

audienceScopeOffunction

Which of the three a window and an asking come to.

const audienceScopeOf: (audiences: Iterable<AudienceId>, asked?: AudienceId) => AudienceScope

ReadOfAudiencetype

A reading that has already recorded which population it was of.

type ReadOfAudience = {
    readonly audienceId: AudienceId | null;
    readonly audiences: readonly AudienceId[];
};

audienceScopeReadfunction

The scope a reading already recorded, read back off it.

const audienceScopeRead: (reading: ReadOfAudience) => AudienceScope

forAudiencefunction

The rows of one audience, and nothing else.

const forAudience: <R extends MaybeAudienceScoped>(audience: AudienceId, rows: readonly R[]) => readonly R[]

AudienceWindowtype

One audience's window, as {@link byAudience} hands it over.

type AudienceWindow<R> = {
    readonly audience: AudienceId;
    readonly rows: readonly R[];
};

byAudiencefunction

A window a deployment read, split into the populations it actually holds.

const byAudience: <R extends AudienceScoped>(rows: readonly R[]) => readonly AudienceWindow<R>[]

readingKeyOffunction

What makes two readings one page: the tree, the revision and the audience.

const readingKeyOf: (reading: ReadingOfAudience) => string

PageFormtype

A page in one of its forms: the tree and the audience, with no revision in it.

type PageForm = {
    readonly treeId: TreeId;
    readonly audienceId: AudienceId | null;
};

formOffunction

The form a reading is of, with an absent audience normalised to the null it means.

const formOf: (reading: ReadingOfAudience) => PageForm

formKeyOffunction

What makes two readings one page in one form, which is what a comparison pairs on.

const formKeyOf: (form: PageForm) => string

inFormOrderfunction

Sorted so a list of forms reads the same whatever order they arrived in.

const inFormOrder: (one: PageForm, other: PageForm) => number

ComparedAudiencestype

The audience each side of a comparison was of, as a comparison carries it.

type ComparedAudiences = {
    readonly was: AudienceId | null;
    readonly now: AudienceId | null;
};

comparedAudiencesOffunction

The two populations a comparison was handed, published once rather than spelled on each comparison.

const comparedAudiencesOf: (was: SideOfAudience, now: SideOfAudience) => ComparedAudiences

crossesAudiencesfunction

Whether two sides of a comparison prove they are of two populations.

const crossesAudiences: (was: SideOfAudience, now: SideOfAudience) => boolean

audiencesOffunction

The audiences a set of forms names, deduplicated and in a stable order.

const audiencesOf: (forms: Iterable<PageForm>) => readonly AudienceId[]

pagesOffunction

The pages behind a set of forms, which two forms of one page share.

const pagesOf: (forms: Iterable<PageForm>) => ReadonlySet<TreeId>

ComparedPopulationstype

The audiences each side of a **window** comparison was of.

type ComparedPopulations = {
    /** The audiences the earlier window's forms named. `[]` where none did. */
    readonly was: readonly AudienceId[];
    /** The audiences the later window's forms named, by the same rule. */
    readonly now: readonly AudienceId[];
};

FormPairRefusaltype

Why two readings are not two forms of one page.

type FormPairRefusal =
/**
 * The two readings are of different trees.
 */
"different-pages"
/**
 * One of the two windows holds two forms of the page and named neither.
 */
 | "unsplit"
/**
 * One of the two windows named no audience at all.
 */
 | "unattributed"
/**
 * Both windows name one audience and it is the same one.
 */
 | "one-population"
/**
 * The two readings are of two revisions of the page.
 */
 | "different-revisions";

FORM_PAIR_REFUSALSvalue

The closed set, in the order {@link formPairOf} reaches them.

const FORM_PAIR_REFUSALS: readonly FormPairRefusal[]

describeFormPairRefusalfunction

One line per refusal, for a surface saying why there is no pair.

const describeFormPairRefusal: (refusal: FormPairRefusal) => string

SideOfFormtype

What {@link formPairOf} needs of a side: a page, a revision, and a scope.

type SideOfForm = ReadOfAudience & {
    readonly treeId: TreeId;
    readonly revision: number;
};

FormPairtype

Two readings as a pair of forms, or the reason they are not one.

type FormPair<R> = {
    readonly pairing: "paired";
    /** The side whose audience id sorts lower. */
    readonly one: R;
    readonly other: R;
    /** The two names, already in the same order as the two sides. */
    readonly audiences: {
        readonly one: AudienceId;
        readonly other: AudienceId;
    };
} | {
    readonly pairing: "refused";
    /** The lower-sorting side, or the first argument where no pair of names stands. */
    readonly one: R;
    readonly other: R;
    readonly refusal: FormPairRefusal;
};

formPairOffunction

Settle two readings into two forms of one page, or say why they are not.

const formPairOf: <R extends SideOfForm>(one: R, other: R) => FormPair<R>

Broadcast

signals/broadcast

Broadcasting reader signals from a rendered Loom page.

READER_SIGNALS_EVENTvalue

const READER_SIGNALS_EVENT = "loom:signals"

VisibilityObservertype

Something that reports elements coming into and out of view. The browser's IntersectionObserver unless a host passes its own.

type VisibilityObserver = {
    readonly observe: (element: Element) => void;
    readonly disconnect: () => void;
};

VisibilityEntrytype

type VisibilityEntry = {
    readonly target: Element;
    readonly visible: boolean;
};

ObserveVisibilitytype

type ObserveVisibility = (onChange: (entries: readonly VisibilityEntry[]) => void) => VisibilityObserver;

ReaderSignalTypestype

The primitive types to report on: one list for every kind, or a list per kind.

type ReaderSignalTypes = readonly string[] | {
    readonly [Kind in ReaderSignalKind]?: readonly string[];
};

ReaderSignalOptionstype

type ReaderSignalOptions = {
    /** Called with every batch. A throw or rejection here is contained and never reaches the page. */
    readonly send?: (batch: ReaderSignalBatch) => void | Promise<void>;
    /** Which kinds to broadcast. Every kind when absent. */
    readonly kinds?: readonly ReaderSignalKind[];
    /**
     * Which primitive types to broadcast about. Every addressed type when absent.
     */
    readonly types?: ReaderSignalTypes;
    /** How often a batch is delivered. Five seconds when absent. */
    readonly flushEveryMs?: number;
    /**
     * How the broadcaster learns what is on screen. The browser's
     * `IntersectionObserver` when absent; a test passes its own.
     */
    readonly observeVisibility?: ObserveVisibility;
    /**
     * Whether a delegated signal carries the addressed nodes it happened inside.
     * On when absent.
     */
    readonly within?: boolean;
    /** The clock. `Date.now` when absent. */
    readonly now?: () => number;
    /**
     * Where the view key's randomness comes from. The browser's
     * `crypto.getRandomValues` when absent; a test passes its own so it can name
     * the key it expects.
     */
    readonly random?: RandomBytes;
};

ReaderSignalBroadcasttype

type ReaderSignalBroadcast = {
    /** Deliver whatever has been gathered, now. */
    readonly flush: () => void;
    /** Deliver what is left and stop observing. Safe to call twice. */
    readonly stop: () => void;
};

ReaderSignalBroadcastErrortype

type ReaderSignalBroadcastError = {
    /** The root carries no tree id or revision — the page was not rendered with `addressed: true`. */
    readonly code: "unaddressed";
    readonly detail: string;
};

broadcastReaderSignalsfunction

Start broadcasting reader signals from a rendered Loom page.

Shown in use on What your readers do — Two: start the broadcaster, in the browser

const broadcastReaderSignals: (scope: Element | Document, options?: ReaderSignalOptions) => Result<ReaderSignalBroadcast, ReaderSignalBroadcastError>

Change

signals/change

What a change did to the reading of a page.

ChangeSilencetype

Why a comparison answered nothing.

type ChangeSilence =
/**
 * The two readings are of different trees.
 */
"different-trees"
/**
 * The two readings are of two audiences, and so of two populations.
 */
 | "different-audiences"
/**
 * One of the two windows holds two forms of the page and nothing said which
 * was wanted, so that side was read as neither population.
 */
 | "audiences-mixed"
/**
 * One of the two windows held no views.
 */
 | "nothing-measured";

CHANGE_SILENCESvalue

const CHANGE_SILENCES: readonly ChangeSilence[]

describeChangeSilencefunction

One line per silence, for a surface putting the comparison in front of a person.

const describeChangeSilence: (silence: ChangeSilence) => string

PairFatetype

Why a pair of siblings has no counterpart in the other reading.

type PairFate =
/** One of its two parts is not in the other revision at all: removed by the change, or added by it. */
"absent"
/** Both parts are there and no longer children of the same node, so they are not siblings to compare. */
 | "moved"
/**
 * Both parts are still children of one node and no longer next to each other.
 */
 | "separated"
/**
 * They are still adjacent and the other way round, so the fall between them
 * is a fall in the other direction.
 */
 | "reordered"
/**
 * They are still adjacent, and one of them reported something other than
 * coming into view there.
 */
 | "unanchorable"
/**
 * They are adjacent and anchorable on both sides, and on one side nobody
 * reached the first of them.
 */
 | "unreached";

PAIR_FATESvalue

const PAIR_FATES: readonly PairFate[]

describePairFatefunction

One line per fate, for a surface putting the comparison in front of a person.

const describePairFate: (fate: PairFate) => string

StopSidetype

What one reading said about one pair of siblings.

type StopSide = {
    /** Views that reached the first of the pair, which is the denominator of `share`. */
    readonly reached: number;
    /** Views that reached the first and not the second. Zero where none did. */
    readonly lost: number;
    /** `lost ÷ reached`, in `[0, 1]`. Zero is a pair nobody stopped at. */
    readonly share: number;
};

ComparedStoptype

One pair of siblings, as two readings measured it.

type ComparedStop = {
    /** The part they reached. */
    readonly after: NodeId;
    /** The next part in the run, which fewer reached. */
    readonly before: NodeId;
    /**
     * The part whose run they are both steps of, which is the same node in both
     * readings.
     */
    readonly withinId: NodeId;
    readonly was: StopSide;
    readonly now: StopSide;
    /**
     * `was.share − now.share`: the share of readers that no longer stop here.
     */
    readonly improvement: number;
    /**
     * The smallest share one reader could move, on whichever side counted fewer.
     */
    readonly resolution: number;
    /**
     * Whether `improvement` is at least one reader's worth on the coarser side.
     */
    readonly beyondOneReader: boolean;
    /**
     * `improvement × now.reached`: the readers the change no longer loses here, at
     * the volume the page has now.
     */
    readonly readersKept: number;
};

IncomparablePairtype

A pair one reading measured and the other cannot be asked about.

type IncomparablePair = {
    readonly after: NodeId;
    readonly before: NodeId;
    /** The part whose run the pair was a pair of, carried off `ReadingRun.withinId`. */
    readonly withinId: NodeId;
    /** Which reading this pair is from, and therefore which reading `reached` and `share` are off. */
    readonly side: "was" | "now";
    readonly fate: PairFate;
    readonly reached: number;
    readonly share: number;
};

PartsChangedtype

What the change did to the page itself, as the two trees say it.

type PartsChanged = {
    /** Element nodes in both revisions, {@link PartsChanged.moved} among them. */
    readonly shared: number;
    /** In the later revision and not the earlier one, in reading order. */
    readonly added: readonly NodeId[];
    /** In the earlier revision and not the later one, in reading order. */
    readonly removed: readonly NodeId[];
    /**
     * Shared parts whose **tree** parent is a different node, in reading order.
     */
    readonly moved: readonly NodeId[];
    /**
     * Shared parts whose own words are not the words they were, in reading order.
     */
    readonly reworded: readonly NodeId[];
    /**
     * Shared parts whose words were the same as far as this reading could see, and
     * where something about them went unread on one side or the other.
     */
    readonly unreadable: number;
};

ReadingChangetype

type ReadingChange = {
    /** The earlier reading's tree. The two agree unless `silence` is `different-trees`. */
    readonly treeId: TreeId;
    readonly revisions: {
        readonly was: number;
        readonly now: number;
    };
    /**
     * The audience each side was of, where its reading named one.
     */
    readonly audiences: ComparedAudiences;
    /**
     * The two progress readings this comparison is made of.
     */
    readonly progress: {
        readonly was: ReadingProgress;
        readonly now: ReadingProgress;
    };
    readonly parts: PartsChanged;
    /** Every pair both readings could measure, in the earlier reading's reading order. */
    readonly stops: readonly ComparedStop[];
    /** Every pair only one of them could, each once, with the reason. */
    readonly incomparable: readonly IncomparablePair[];
    /**
     * The pair the change keeps most readers at, among those beyond one reader.
     */
    readonly mostKept: ComparedStop | null;
    /** The pair it loses most readers at, on the same terms. Null where none worsened. */
    readonly mostLost: ComparedStop | null;
    /** Why nothing was compared, or `null` where something was. */
    readonly silence: ChangeSilence | null;
};

readingChangeOffunction

What a change did to the reading of a page, from a reading of each side.

const readingChangeOf: (was: PageReading, now: PageReading) => ReadingChange

Collect

signals/collect

The one operation that counts the buffer.

DEFAULT_READER_SIGNAL_WINDOW_MSvalue

The window is the age a batch reaches before it is counted, and it is two arguments pulling opposite ways.

const DEFAULT_READER_SIGNAL_WINDOW_MS: number

MIN_READER_SIGNAL_WINDOW_MSvalue

A minute, and the floor is not a style choice.

const MIN_READER_SIGNAL_WINDOW_MS: number

readerSignalWindowSchemaschema

const readerSignalWindowSchema: z.ZodObject<…>

ReaderSignalWindowtype

type ReaderSignalWindow = z.infer<typeof readerSignalWindowSchema>;

DEFAULT_COLLECTION_SCANvalue

How much of the buffer one run will look at.

const DEFAULT_COLLECTION_SCAN = 5000

MAX_COLLECTION_SCANvalue

const MAX_COLLECTION_SCAN = 50000

AskedFunnelPairtype

A pair as a deployment asks it: the question, where it is asked, and the instant it began being asked.

type AskedFunnelPair = FunnelPair & {
    readonly countedFrom?: number;
};

CollectionRequesttype

type CollectionRequest = {
    readonly windowMs?: number;
    /**
     * The funnels this deployment asks about. Absent means none — a pair is a
     * question somebody wrote down, and rollup does not invent questions.
     */
    readonly pairs?: readonly AskedFunnelPair[];
    readonly clock?: Clock;
    readonly scanLimit?: number;
};

CollectionPlantype

What one run may take, as a pure function of batches and an instant.

type CollectionPlan = {
    /** Old enough to count, in ascending `seq`. */
    readonly ripe: readonly ReceivedBatch[];
    /** The position to forget below, once the counters are durable. `null` when nothing is ripe. */
    readonly before: number | null;
    /** Seen by this scan and too young. A floor rather than a total — the scan stops at the first. */
    readonly waiting: number;
};

collectionPlanOffunction

const collectionPlanOf: (scanned: readonly ReceivedBatch[], horizon: string) => CollectionPlan

FunnelsAskedtype

What a run may ask, and how many questions it held back.

type FunnelsAsked = {
    readonly asking: readonly FunnelPair[];
    readonly withheld: number;
};

funnelsAskedOffunction

The pairs a run folding a window that **begins** at from may ask, and the count of the ones it may not.

const funnelsAskedOf: (pairs: readonly AskedFunnelPair[], from: string) => FunnelsAsked

horizonOffunction

const horizonOf: (configured: ReaderSignalWindow, now: string) => string | null

CollectionSummarytype

The half of the outcome a caller shows or logs, with nothing in it about a reader.

type CollectionSummary = {
    readonly counted: number;
    readonly tallies: number;
    readonly funnels: number;
    /**
     * Funnel pairs this run was handed and did not ask, because the window it
     * folded begins before the pair was first asked.
     */
    readonly withheldFunnels: number;
    /**
     * Hourly rows this run wrote for what readers did (`acted.ts`).
     */
    readonly acted: number;
    /**
     * Hourly rows this run wrote for the funnels it was asked (`funnel-hours.ts`).
     */
    readonly funnelHours: number;
    /** Distinct page views the window held. */
    readonly views: number;
    /**
     * Batches that carried no view key, whose occurrences counted and whose views
     * did not. A rate shown without saying which denominator it used is the
     * failure mode here, so the number travels with the run that produced it.
     */
    readonly uncorrelated: number;
    /**
     * Of the batches counted, how many were a repeat of one already folded in
     * this window and were therefore folded once (`rollup.ts`).
     */
    readonly redelivered: number;
    /**
     * How old the oldest **uncounted** delivery the scan found was, in
     * milliseconds, at the instant this run was taken.
     */
    readonly oldestMs: number;
};

CollectionOutcometype

type CollectionOutcome = {
    readonly outcome: "collected";
    readonly summary: CollectionSummary;
    /**
     * Rows this run marked as counted.
     */
    readonly recorded: number;
    /** The scan filled its limit with ripe batches, so another run has work now. */
    readonly more: boolean;
}
/** Nothing is old enough yet, which is the ordinary answer on a quiet deployment. */
 | {
    readonly outcome: "nothing-ripe";
    readonly waiting: number;
}
/**
 * The counters took the window and the journal would not record it.
 */
 | {
    readonly outcome: "counted-not-recorded";
    readonly summary: CollectionSummary;
    readonly before: number;
    readonly error: ReaderSignalStoreError;
}
/** The window was not usable. Nothing was read, counted or marked. */
 | {
    readonly outcome: "refused";
    readonly reason: string;
}
/** Read or write failed before anything became durable. Nothing was marked. */
 | {
    readonly outcome: "unavailable";
    readonly error: ReaderSignalStoreError;
};

collectReaderSignalsfunction

Count a window of the buffer into the durable counters, then record that it was counted.

Shown in use on What your readers do — Where a batch goes after that

const collectReaderSignals: (journal: ReaderSignalJournal, store: ReaderTallyStore, request?: CollectionRequest) => Promise<CollectionOutcome>

describeCollectionfunction

One line for an operator, because an outcome nobody can read is one nobody acts on.

const describeCollection: (outcome: CollectionOutcome) => string

Conversion

signals/conversion

Which of a deployment's pages loses the most readers between an ask and its answer.

ConversionSilencetype

A reason a page's conversion loss is withheld rather than ranked.

type ConversionSilence =
/**
 * The reading holds two forms of the page and named neither, so it read
 * neither population's answers.
 */
"unsplit"
/**
 * There is no page-view row at the door for this revision, so its loss cannot
 * be put on the same scale as another page's.
 */
 | "unscaled"
/**
 * The row is there and nothing in it says a page view ever began.
 */
 | "unopened"
/** Readers arrived and no rollup has folded a window of their reading yet. */
 | "uncounted"
/**
 * Every question this revision is asked names a part it no longer has.
 */
 | "stale"
/**
 * Nobody reached the start of any question this revision is asked.
 */
 | "unanswered"
/**
 * More readers reached its sharpest ask than have ever appeared on the page.
 */
 | "inconsistent";

CONVERSION_SILENCESvalue

const CONVERSION_SILENCES: readonly ConversionSilence[]

describeConversionSilencefunction

One line per silence, for a surface saying why a page has no funnel figure.

const describeConversionSilence: (silence: ConversionSilence) => string

ConversionStandingtype

Where one page stands in the order, or why it is not in it.

type ConversionStanding =
/** In the order, by the readers it loses between the two ends of its sharpest ask. */
"ranked"
/**
 * Every reader who reached one of its asks went on to answer it.
 */
 | "unleaked"
/**
 * Nothing asks this version of the page for anything.
 */
 | "unasked" | ConversionSilence;

CONVERSION_STANDINGSvalue

const CONVERSION_STANDINGS: readonly ConversionStanding[]

describeConversionStandingfunction

One line per standing, for a surface naming why a page is where it is.

const describeConversionStanding: (standing: ConversionStanding) => string

LeakingPagetype

One revision of one page, as the order of conversions has it.

type LeakingPage = {
    readonly treeId: TreeId;
    readonly revision: number;
    /**
     * The audience this row is about, or `null` where the reading named none.
     */
    readonly audienceId: AudienceId | null;
    readonly standing: ConversionStanding;
    /** Page views counted at the door, exact, or `null` where this revision has no row. */
    readonly opened: number | null;
    /** This page's own straddle rate, which is what scales its loss. */
    readonly inflation: number | null;
    /** How many questions this revision is asked, as the reading read them. */
    readonly questions: number;
    /** Of those, how many name a part this revision no longer has. */
    readonly stalePairs: number;
    /**
     * The ask that loses the most readers between its two ends, carried whole and
     * unchanged.
     */
    readonly at: PairReach | null;
    /** Readers lost between that ask's two ends, as the window's counters have it. */
    readonly lost: number | null;
    /**
     * The same loss on the door's scale, which is the key the order is on, and
     * the **most** that loss could be.
     */
    readonly readers: number | null;
    /**
     * The least that loss could be, given the straddle this page's own door
     * measured.
     */
    readonly readersAtLeast: number | null;
    /**
     * Of the readers who reached that ask, the share that answered it, carried
     * through from the pair unchanged.
     */
    readonly rate: number | null;
};

DeploymentConversiontype

A deployment's pages, in the order their conversions should be looked at.

type DeploymentConversion = {
    /**
     * Every page with a leak and a scale for it, worst first.
     */
    readonly ranked: readonly LeakingPage[];
    /** Every other page, by tree id and newest revision first. */
    readonly unranked: readonly LeakingPage[];
    /** The head of the order, which is the funnel to look at first. */
    readonly worst: LeakingPage | null;
    /**
     * Whether the page named {@link DeploymentConversion.worst} is first however
     * the straddle fell: its floor is at or above every other ranked page's
     * ceiling.
     */
    readonly worstSecure: boolean | null;
    /** How many pages stand in each state, over the ranked and the unranked alike. */
    readonly standings: Readonly<Record<ConversionStanding, number>>;
    /**
     * Distinct trees across every page read, which is not the number of pages.
     */
    readonly trees: number;
    /**
     * Page views counted at the door across the pages handed in, added.
     */
    readonly arrivals: number;
    /**
     * Funnel questions across the pages handed in, added.
     */
    readonly questions: number;
    /** Of those, how many name a part the revision asking them no longer has. */
    readonly stalePairs: number;
    /**
     * Readings of a revision beyond the first, which were dropped.
     */
    readonly duplicated: number;
};

deploymentConversionOffunction

A deployment's pages, in the order their funnels should be looked at.

const deploymentConversionOf: (funnels: readonly FunnelReach[]) => DeploymentConversion

Copy

signals/copy

How much of what a page says gets read, and which of it nobody saw.

Passagetype

One part's own words, with what the window said about the part saying them.

type Passage = {
    readonly nodeId: NodeId;
    readonly type: PrimitiveType;
    /** What part it plays, or `null` where its type declared none. */
    readonly role: PrimitiveRole | null;
    /** 0 at the root. */
    readonly depth: number;
    /** Carried through from the part, so a passage and a part say the same thing. */
    readonly standing: PartStanding;
    /** Distinct page views that reported the part coming into view; `0` where no row named it. */
    readonly readers: number;
    /**
     * The words themselves, in reading order, exactly as the page says them.
     */
    readonly text: readonly string[];
    /** {@link text}, counted. */
    readonly words: number;
    /**
     * Whether this passage is short of words it cannot see.
     */
    readonly floored: boolean;
};

RoleCopytype

Every part playing one role, with the words they say between them.

type RoleCopy = {
    /** `null` is the row for parts whose type declared no role. */
    readonly role: PrimitiveRole | null;
    /** Parts of this role that say something, which is the rule {@link CopyReading.passages} applies. */
    readonly passages: number;
    readonly words: number;
    /**
     * Words by the standing of the part saying them. The three add to
     * {@link words}.
     */
    readonly wordsByStanding: Readonly<Record<PartStanding, number>>;
    /**
     * This role's words in parts the window can speak for, which is the
     * denominator of {@link share}.
     */
    readonly spoken: number;
    /**
     * The share of this role's **spoken-for** words at least one reader reached.
     * `null` where the window can speak for none of them.
     */
    readonly share: number | null;
    /** Passages of this role whose words are a floor. */
    readonly floored: number;
};

CopySilencetype

Why there is no typical reader's figure.

type CopySilence =
/** The page says nothing that could have been read. */
"wordless"
/** The window held no views of this revision, so there is no reader to be typical of. */
 | "unmeasured"
/**
 * Some part's words are a floor, so a mean of them is neither a count nor a
 * ceiling.
 */
 | "floored"
/**
 * No word of the page is in a part this window can speak for, so there is no
 * word to take a mean over.
 */
 | "unspoken"
/**
 * A part reports more readers than the page has views, which no rollup
 * produces.
 */
 | "inconsistent";

COPY_SILENCESvalue

The closed set, for a surface that has to account for every reason a figure is absent.

const COPY_SILENCES: readonly CopySilence[]

describeCopySilencefunction

One line per silence, for a surface saying why a figure is not there.

const describeCopySilence: (silence: CopySilence) => string

CopyReadingtype

What one window of one revision says about how much of the page is read.

type CopyReading = {
    readonly treeId: TreeId;
    readonly revision: number;
    /** The page's view floor, carried through from the reading unchanged. */
    readonly views: number;
    /**
     * Every word this revision says, counted once.
     */
    readonly words: number;
    /** Words by the standing of the part saying them. The three add to {@link words}. */
    readonly wordsByStanding: Readonly<Record<PartStanding, number>>;
    /**
     * The page's words in parts this window can speak for, which is the
     * denominator of {@link share}.
     */
    readonly spoken: number;
    /**
     * The share of the words **this window can speak for** that at least one
     * reader reached. `null` where there are none of them.
     */
    readonly share: number | null;
    /** Every part that says something, in reading order. */
    readonly passages: readonly Passage[];
    /**
     * Parts that say nothing at all, counted rather than listed.
     */
    readonly silent: number;
    /**
     * The passages no reader reached, most words first and then in reading order.
     */
    readonly unseen: readonly Passage[];
    /** Every role in the vocabulary, then the row for parts that declared none. */
    readonly roles: readonly RoleCopy[];
    /**
     * Passages whose words are a floor, by the standing of the part saying them.
     */
    readonly floored: Readonly<Record<PartStanding, number>>;
    /**
     * The words the typical reader reached, at most. `null` where {@link silence}
     * says why not.
     */
    readonly typical: number | null;
    /**
     * Why a figure is not there, and `null` where both are.
     */
    readonly silence: CopySilence | null;
};

passageOffunction

The words a part says on its own, and whether it is short of some it cannot see.

const passageOf: (part: PartReading) => Passage

copyReadingOffunction

How much of what a page says is getting read.

const copyReadingOf: (reading: PageReading) => CopyReading

Copy change

signals/copy-change

What a change did to what a page says, and to how much of it gets read.

CopyChangeSilencetype

Why a comparison of two windows' words answered nothing.

type CopyChangeSilence =
/**
 * The two readings are of different trees.
 */
"different-trees"
/**
 * The two readings are of two audiences, and so of two populations.
 */
 | "different-audiences"
/** Neither revision says anything that could have been read. */
 | "wordless"
/**
 * One of the two windows holds two forms of the page and named neither.
 */
 | "audiences-mixed"
/**
 * One of the two windows held no page views.
 */
 | "nothing-measured"
/**
 * A passage reports more readers than its side of the page has views.
 */
 | "inconsistent"
/**
 * The change left no word of the page as it was.
 */
 | "dissolved"
/**
 * Some carried passage's words are a floor, so a page-wide mean of them is
 * neither a count nor a ceiling.
 */
 | "floored"
/**
 * No carried word of the page can be spoken for in both windows.
 */
 | "unspoken";

COPY_CHANGE_SILENCESvalue

The closed set, for a surface that has to account for every reason a figure is absent.

const COPY_CHANGE_SILENCES: readonly CopyChangeSilence[]

describeCopyChangeSilencefunction

One line per silence, for a surface saying why a figure is not there.

const describeCopyChangeSilence: (silence: CopyChangeSilence) => string

PassageMovementtype

What happened to the reading of one passage whose words did not change.

type PassageMovement =
/** Reached on both sides. */
"held"
/** Nobody reached it and now somebody does, which is the sentence a change is made for. */
 | "gained"
/** Somebody reached it and now nobody does. */
 | "lost"
/** Nobody reached it on either side — the words a change did not fix. */
 | "unread"
/**
 * One side cannot be spoken for.
 */
 | "unknown";

PASSAGE_MOVEMENTSvalue

The closed set, for a surface accounting for every passage it was handed.

const PASSAGE_MOVEMENTS: readonly PassageMovement[]

describePassageMovementfunction

One line per movement, for a surface putting a passage in front of a person.

const describePassageMovement: (movement: PassageMovement) => string

PassageSidetype

What one window said about one passage.

type PassageSide = {
    readonly standing: PartStanding;
    /** Distinct page views that reported the part coming into view; `0` where no row named it. */
    readonly readers: number;
    /** That side's page-view floor, carried through so the share below can be checked. */
    readonly views: number;
    /**
     * {@link readers} over {@link views}, and `null` where the window held none.
     */
    readonly reach: number | null;
};

ComparedPassagetype

One passage both revisions say, word for word, as two windows read it.

type ComparedPassage = {
    readonly nodeId: NodeId;
    readonly type: PrimitiveType;
    readonly role: PrimitiveRole | null;
    /** The words, the same number on both sides because they are the same words. */
    readonly words: number;
    /** The text itself, so a passage can be quoted back without a second join. */
    readonly text: readonly string[];
    /**
     * Whether either side's part declares no `copy`, so {@link words} is a floor.
     */
    readonly floored: boolean;
    readonly was: PassageSide;
    readonly now: PassageSide;
    readonly movement: PassageMovement;
    /**
     * The words this passage newly put in front of the average reader:
     * `words × (now.reach − was.reach)`.
     */
    readonly gain: number | null;
};

RewordedPassagetype

One passage the change rewrote, as two windows read it.

type RewordedPassage = {
    readonly nodeId: NodeId;
    readonly type: PrimitiveType;
    readonly role: PrimitiveRole | null;
    /** The two word counts, which is why there is no single one. */
    readonly words: {
        readonly was: number;
        readonly now: number;
    };
    /** Whether either side declares no `copy`, so its word count is a floor. */
    readonly floored: boolean;
    readonly was: PassageSide;
    readonly now: PassageSide;
    readonly movement: PassageMovement;
};

WordsWrittentype

What the change did to the words themselves.

type WordsWritten = {
    /**
     * Words both revisions say, word for word — the universe every reader figure
     * here is about.
     */
    readonly carried: number;
    /** Words only the later revision says. */
    readonly added: number;
    /**
     * {@link added}, by what the later window said about reaching them. The three
     * add to {@link added}.
     */
    readonly addedByStanding: Readonly<Record<PartStanding, number>>;
    /** Words only the earlier revision says. */
    readonly removed: number;
    /**
     * {@link removed}, by what the earlier window said about reaching them. The
     * three add to {@link removed}.
     */
    readonly removedByStanding: Readonly<Record<PartStanding, number>>;
    /** Words of passages both revisions have and neither says the same way. */
    readonly reworded: {
        readonly was: number;
        readonly now: number;
    };
};

WordCounttype

A word total, before and after, with the subtraction done once.

type WordCount = {
    readonly was: number;
    readonly now: number;
    readonly change: number;
};

CopyChangetype

What a change did to what a page says and to how much of it is read.

type CopyChange = {
    /** The earlier reading's tree. The two agree unless `silence` is `different-trees`. */
    readonly treeId: TreeId;
    readonly revisions: {
        readonly was: number;
        readonly now: number;
    };
    /**
     * The audience each side was of, where its reading named one.
     */
    readonly audiences: ComparedAudiences;
    /** The two copy readings this comparison is made of. */
    readonly readings: {
        readonly was: CopyReading;
        readonly now: CopyReading;
    };
    /**
     * Every word each revision says, counted once, and the difference.
     */
    readonly words: WordCount;
    /** The census of what the change wrote, with no reader in it. */
    readonly wrote: WordsWritten;
    /**
     * Every passage both revisions say identically, in the **later** reading's
     * reading order.
     */
    readonly compared: readonly ComparedPassage[];
    /** Every passage both revisions have and neither says the same way, in the later order. */
    readonly reworded: readonly RewordedPassage[];
    /** Every passage only the later revision has, in its reading order. */
    readonly added: readonly Passage[];
    /** Every passage only the earlier revision had, in the earlier reading order. */
    readonly removed: readonly Passage[];
    /**
     * Carried words by what happened to the reading of them. The five add to
     * {@link WordsWritten.carried}.
     */
    readonly wordsByMovement: Readonly<Record<PassageMovement, number>>;
    /**
     * Carried passages by the same. The five add to {@link compared}'s length.
     */
    readonly passagesByMovement: Readonly<Record<PassageMovement, number>>;
    /** Carried passages whose words are a floor, which is what `floored` counts. */
    readonly floored: number;
    /**
     * The carried passages nobody reached on either side, most words first and
     * then in the later reading order.
     */
    readonly stillUnseen: readonly ComparedPassage[];
    /**
     * The carried words the average reader got to, before and after. `null` where
     * {@link silence} says why not.
     */
    readonly typical: WordCount | null;
    /**
     * The carried passage the change put most words in front of the average
     * reader, and `null` where none gained any.
     */
    readonly mostGained: ComparedPassage | null;
    /** The carried passage it took most words away from, on the same terms. */
    readonly mostLost: ComparedPassage | null;
    /** Why there is no reader comparison, or `null` where there is one. */
    readonly silence: CopyChangeSilence | null;
};

passageSideOffunction

What one window said about one passage, as a side of a comparison.

const passageSideOf: (passage: Passage, views: number) => PassageSide

spokenForOnBothSidesfunction

Whether both windows can say whether this passage was reached.

const spokenForOnBothSides: (passage: ComparedPassage) => boolean

copyChangeOffunction

What a change did to the words of a page and to the reading of them.

const copyChangeOf: (was: PageReading, now: PageReading) => CopyChange

Day

signals/day

**Where one deployment's day is cut, as a fact the deployment states once.**

ARRIVAL_DAY_MSvalue

A day, in the unit the counters are kept in. The prefix is ARRIVAL_HOUR_MS'.

const ARRIVAL_DAY_MS = 86400000

HOURS_IN_DAYvalue

How many hours a day of these counters has, which is what a shape has bars.

const HOURS_IN_DAY = 24

DayCuttype

Where this deployment's midnight is, as every folding of its hours takes it.

type DayCut = {
    /**
     * Whole hours to add to UTC before the day is cut and its hours are named.
     */
    readonly offsetHours: number;
};

UTC_DAYvalue

The day the counters themselves keep, which is the deployment that has said nothing.

const UTC_DAY: DayCut

MIN_DAY_OFFSET_HOURSvalue

The lowest offset a deployment may state, which is the lowest a zone has.

const MIN_DAY_OFFSET_HOURS = -12

MAX_DAY_OFFSET_HOURSvalue

The highest offset a deployment may state, which is Kiritimati, at +14.

const MAX_DAY_OFFSET_HOURS = 14

readerDayOffsetSchemaschema

What a deployment may state its day offset to be.

const readerDayOffsetSchema: z.ZodObject<…>

ReaderDayOffsettype

An offset a deployment has stated, as the gate above admits it.

type ReaderDayOffset = z.infer<typeof readerDayOffsetSchema>;

dayCutOffunction

The day this deployment cuts, from whatever it stated.

const dayCutOf: (asked: number | undefined) => DayCut

dayShiftOffunction

The milliseconds a folding adds to an hour before cutting the day at it.

const dayShiftOf: (cut: DayCut) => number

Deliver

signals/deliver

Getting a batch off the page.

DEFAULT_READER_SIGNAL_PATHvalue

Where a delivery goes when the host has no opinion.

const DEFAULT_READER_SIGNAL_PATH = "/api/reader-signals"

BATCH_CONTENT_TYPEvalue

What a batch is labelled as on the wire: **plain text, which happens to be JSON**.

const BATCH_CONTENT_TYPE = "text/plain;charset=UTF-8"

SendBeacontype

navigator.sendBeacon, narrowed to what this uses. false means it would not take it.

type SendBeacon = (url: string, body: Blob) => boolean;

PostBatchtype

The fallback. Called only when a beacon was unavailable or refused the batch.

type PostBatch = (url: string, body: string) => void;

DeliverOptionstype

type DeliverOptions = {
    /** Where to post. {@link DEFAULT_READER_SIGNAL_PATH} when absent. */
    readonly url?: string;
    /** The browser's, when absent. A test passes its own. */
    readonly beacon?: SendBeacon | null;
    /** `fetch` with `keepalive`, when absent. */
    readonly post?: PostBatch;
};

deliverReaderSignalsfunction

A send for broadcastReaderSignals that posts each batch.

const deliverReaderSignals: (options?: DeliverOptions) => ((batch: ReaderSignalBatch) => void)

Deployment

signals/deployment

Which of a deployment's pages to fix first.

DeploymentSilencetype

A reason a page has no place in the order.

type DeploymentSilence =
/**
 * The window's counters report no view of this revision.
 */
"unread"
/**
 * The reading handed in holds two forms of the page and named neither, so it
 * was read as neither population.
 */
 | "unsplit"
/**
 * There is no page-view row at the door for this revision, so its loss cannot
 * be put on the same scale as another page's.
 */
 | "unscaled"
/**
 * The door row is there and nothing in it says a page view ever began.
 */
 | "unopened"
/**
 * It reports more readers lost at one fall than the door has ever seen
 * appear, which no rollup produces.
 */
 | "inconsistent";

DEPLOYMENT_SILENCESvalue

const DEPLOYMENT_SILENCES: readonly DeploymentSilence[]

describeDeploymentSilencefunction

One line per silence, for a surface saying why a page is not in the order.

const describeDeploymentSilence: (silence: DeploymentSilence) => string

RankStandingtype

Where one page stands in the order, or why it is not in it.

type RankStanding =
/** In the order, with a fall and a scale for it. */
"ranked"
/**
 * Read, scalable, and losing nobody anywhere on the page.
 */
 | "unbroken" | DeploymentSilence;

RANK_STANDINGSvalue

const RANK_STANDINGS: readonly RankStanding[]

describeRankStandingfunction

One line per standing, for a surface naming why a page is where it is.

const describeRankStanding: (standing: RankStanding) => string

RankedPagetype

One revision of one page, as the order has it.

type RankedPage = {
    readonly treeId: TreeId;
    readonly revision: number;
    /**
     * The audience this row is about, or `null` where the reading named none.
     */
    readonly audienceId: AudienceId | null;
    readonly standing: RankStanding;
    /**
     * The window's view floor, carried through from the reading unchanged.
     */
    readonly views: number;
    /**
     * Page views counted at the door, exact, or `null` where this revision has no
     * row.
     */
    readonly opened: number | null;
    /** This page's own straddle rate, which is what scales its loss. */
    readonly inflation: number | null;
    /** The sharpest fall on the page, where it has one. */
    readonly at: ReadingStop | null;
    /** Readers lost at that fall, as the window's counters have it. */
    readonly lost: number | null;
    /**
     * The same loss on the door's scale, which is the key the order is on.
     */
    readonly readers: number | null;
    /**
     * The fall as a share of the readers who reached the part before it, carried
     * through unchanged.
     */
    readonly share: number | null;
};

DeploymentReadingtype

A deployment's pages, in the order they should be looked at.

type DeploymentReading = {
    /**
     * Every page with a fall and a scale for it, worst first.
     */
    readonly ranked: readonly RankedPage[];
    /** Every other page, by tree id and newest revision first. */
    readonly unranked: readonly RankedPage[];
    /** The head of the order, which is the page to fix first. */
    readonly worst: RankedPage | null;
    /** How many pages stand in each state, over the ranked and the unranked alike. */
    readonly standings: Readonly<Record<RankStanding, number>>;
    /**
     * Distinct trees across every page read, which is not the number of pages.
     */
    readonly trees: number;
    /**
     * Page views counted at the door across the pages handed in, added.
     */
    readonly arrivals: number;
    /**
     * Readings of a revision beyond the first, which were dropped.
     */
    readonly duplicated: number;
    /**
     * Door rows for one revision beyond the first, which were ignored.
     */
    readonly duplicatedRows: number;
};

deploymentReadingOffunction

A deployment's pages, in the order they should be looked at.

const deploymentReadingOf: (pages: readonly ReadingProgress[], rows: readonly StoredPageViews[]) => DeploymentReading

Deployment change

signals/deployment-change

Which of a deployment's pages a change helped, and which it hurt.

DeploymentChangeSilencetype

A reason a page is in neither order.

type DeploymentChangeSilence =
/**
 * One of the two windows reported no view of its revision, so there was
 * nothing to compare.
 */
"unread"
/**
 * The two readings are of two different pages, so the comparison is not a
 * movement of anything.
 */
 | "mispaired"
/**
 * There is no page-view row at the door for the later revision, so this
 * page's movement cannot be put on the same scale as another's.
 */
 | "unscaled"
/**
 * The later window's door row is there and nothing in it says a page view
 * ever began.
 */
 | "unopened"
/**
 * A stop reports more readers in the later window than the door has ever seen
 * appear, which no rollup produces.
 */
 | "inconsistent"
/**
 * One of the two windows holds two forms of the page and named neither, so
 * that side was read as neither population.
 */
 | "unsplit";

DEPLOYMENT_CHANGE_SILENCESvalue

const DEPLOYMENT_CHANGE_SILENCES: readonly DeploymentChangeSilence[]

describeDeploymentChangeSilencefunction

One line per silence, for a surface saying why a page is in neither order.

const describeDeploymentChangeSilence: (silence: DeploymentChangeSilence) => string

MovementStandingtype

Where one page stands in the two orders, or why it is in neither.

type MovementStanding =
/** In at least one of the orders, with a movement and a scale for it. */
"ranked"
/**
 * Compared, scalable, and no stop moved by as much as one reader.
 */
 | "unmoved" | DeploymentChangeSilence;

MOVEMENT_STANDINGSvalue

const MOVEMENT_STANDINGS: readonly MovementStanding[]

describeMovementStandingfunction

One line per standing, for a surface naming why a page is where it is.

const describeMovementStanding: (standing: MovementStanding) => string

PageMovementtype

One page's sharpest movement in one direction.

type PageMovement = {
    /**
     * The pair of siblings it happened at, carried through from the comparison
     * unchanged.
     */
    readonly at: ComparedStop;
    /**
     * How much of the page's readers moved, as a share, with the direction in the
     * name rather than in the sign.
     */
    readonly share: number;
    /**
     * The same movement as readers, at the later window's door scale, or `null`
     * where this page has no scale.
     */
    readonly readers: number | null;
};

MovedPagetype

One page of a deployment, as a change left it.

type MovedPage = {
    /** The page, which is the earlier reading's tree. */
    readonly treeId: TreeId;
    /** The two revisions compared, which may be the same one read in two windows. */
    readonly revisions: {
        readonly was: number;
        readonly now: number;
    };
    /**
     * The audience the later window was collected under, or `null` where the
     * reading named none.
     */
    readonly audienceId: AudienceId | null;
    readonly standing: MovementStanding;
    /**
     * Each window's view floor, carried through from its own reading unchanged.
     */
    readonly views: {
        readonly was: number;
        readonly now: number;
    };
    /**
     * Page views counted at the later door, exact, or `null` where that revision
     * has no row.
     */
    readonly opened: number | null;
    /** The later window's own straddle rate, which is what scales the movements. */
    readonly inflation: number | null;
    /**
     * The comparison's own reason for saying nothing, where it gave one.
     */
    readonly silence: ChangeSilence | null;
    /** The stop the change costs most readers at, where it worsened one. */
    readonly worsened: PageMovement | null;
    /** The stop it keeps most readers at, where it improved one. */
    readonly improved: PageMovement | null;
};

DeploymentChangetype

A deployment's pages, as a change left them.

type DeploymentChange = {
    /**
     * Every page the change cost readers, worst first.
     */
    readonly harmed: readonly MovedPage[];
    /** Every page it kept readers on, best first, by the same rule. */
    readonly helped: readonly MovedPage[];
    /**
     * Every page in neither order, by tree id and newest later revision first.
     */
    readonly unranked: readonly MovedPage[];
    /** The head of the harm order, which is the page to look at first. `null` where nothing worsened. */
    readonly worst: MovedPage | null;
    /** The head of the help order. `null` where nothing improved. */
    readonly best: MovedPage | null;
    /**
     * How many pages stand in each state, counting a page once however many
     * orders it is in.
     */
    readonly standings: Readonly<Record<MovementStanding, number>>;
    /**
     * Comparisons read, which is pages: one comparison stands per page.
     */
    readonly compared: number;
    /**
     * Page views counted at the later door across the pages read, added once per
     * revision.
     */
    readonly arrivals: number;
    /**
     * Comparisons of a page beyond the first that compared the same two
     * revisions, which were dropped.
     */
    readonly duplicated: number;
    /**
     * Door rows for the later revision beyond the first, which were ignored.
     */
    readonly duplicatedRows: number;
    /**
     * Pages one of whose **forms** was handed in with two different comparisons,
     * of which neither was read.
     */
    readonly ambiguous: readonly TreeId[];
};

deploymentChangeOffunction

What a change did across a deployment's pages, as two orders.

const deploymentChangeOf: (changes: readonly ReadingChange[], rows: readonly StoredPageViews[]) => DeploymentChange

Door

signals/door

The scale a page's door counts in, which three readings of a library share.

PageDoortype

What one page's door contributes to every figure taken against its readers.

type PageDoor = {
    /**
     * `min(appearances, opened)`: the page views a rollup folded, at the door's
     * scale.
     */
    readonly counted: number;
    /**
     * The row's openings, whatever the silence.
     */
    readonly opened: number;
    readonly appearances: number;
    readonly drift: number;
    readonly pending: number;
    /** Set where this page cannot be scaled, in the page's own vocabulary. */
    readonly silence: ReachSilence | null;
};

doorOffunction

The page's door, with the three reasons tried in the order a page's own reading tries them in.

const doorOf: (row: RevisionPageViews | null) => PageDoor

atDoorScalefunction

A count taken against one page, put on the scale its door counts in.

const atDoorScale: (count: number, of: PageDoor, scaledBy?: PageDoor) => number

Expire

signals/expire

The one operation that deletes a delivery.

DEFAULT_READER_EVENT_RETENTION_MSvalue

Thirty days, the maintainer's number, and the default of a setting rather than a constant. Rule 5 of docs/signals.md is what makes it one.

const DEFAULT_READER_EVENT_RETENTION_MS: number

MIN_READER_EVENT_RETENTION_MSvalue

A minute, which is the collection window's floor and is the same mistake.

const MIN_READER_EVENT_RETENTION_MS: number

readerEventRetentionSchemaschema

const readerEventRetentionSchema: z.ZodObject<…>

ReaderEventRetentiontype

type ReaderEventRetention = z.infer<typeof readerEventRetentionSchema>;

DEFAULT_EXPIRY_SCANvalue

How much of the oldest end one run will look at, as collection bounds its own scan.

const DEFAULT_EXPIRY_SCAN = 5000

MAX_EXPIRY_SCANvalue

const MAX_EXPIRY_SCAN = 50000

ExpiryStoptype

Why the cut stopped where it did, which is the one fact an operator cannot infer from a count of deleted rows.

type ExpiryStop = 
/** The oldest delivery left is inside the kept window, which is the ordinary answer. */
"young"
/** The oldest delivery left is past the window and no fold has counted it. */
 | "uncounted"
/** The scan reached the end of what it read with everything expirable. */
 | "end";

ExpiryPlantype

What one run may delete, as a pure function of rows and an instant.

type ExpiryPlan = {
    /** The position to delete below. `null` where nothing may go. */
    readonly before: number | null;
    /** Rows the scan read and left. A floor rather than a total — the scan stops at the first. */
    readonly waiting: number;
    readonly stopped: ExpiryStop;
};

expiryPlanOffunction

const expiryPlanOf: (scanned: readonly ReceivedBatch[], horizon: string) => ExpiryPlan

keptHorizonOffunction

The instant a delivery is old enough to go. null where the clock could not be read.

const keptHorizonOf: (configured: ReaderEventRetention, now: string) => string | null

ExpiryOutcometype

type ExpiryOutcome = {
    readonly outcome: "expired";
    readonly removed: number;
    /**
     * How old the oldest delivery the scan read was, before anything was
     * deleted, in milliseconds at this run's instant.
     */
    readonly oldestMs: number;
    readonly stopped: ExpiryStop;
    /** The scan filled its limit with expirable rows, so another run has work now. */
    readonly more: boolean;
}
/** Nothing in the table may go yet, which is the ordinary answer inside the window. */
 | {
    readonly outcome: "nothing-expired";
    readonly waiting: number;
    /** `null` where the scan read no row at all — a table with nothing in it. */
    readonly oldestMs: number | null;
    readonly stopped: ExpiryStop;
}
/** The window was not usable. Nothing was read or deleted. */
 | {
    readonly outcome: "refused";
    readonly reason: string;
}
/** Read or delete failed. Where it was the delete, the prefix is still there. */
 | {
    readonly outcome: "unavailable";
    readonly error: ReaderSignalStoreError;
};

ExpiryRequesttype

type ExpiryRequest = {
    readonly keptMs?: number;
    readonly clock?: Clock;
    readonly scanLimit?: number;
};

expireReaderEventsfunction

Delete the deliveries this deployment no longer keeps.

const expireReaderEvents: (journal: ReaderSignalJournal, request?: ExpiryRequest) => Promise<ExpiryOutcome>

describeExpiryfunction

One line for an operator, because an outcome nobody can read is one nobody acts on.

const describeExpiry: (outcome: ExpiryOutcome) => string

Fold

signals/fold

Batches folded into what a node was read like: time on screen, whether it was reached, what readers did in it.

ReaderReadingstype

What a set of batches says about each node they mention.

type ReaderReadings = {
    /** Total time on screen. Summed across batches, because `dwelled` is per-batch. */
    readonly dwellMs: Readonly<Record<NodeId, number>>;
    /** Nodes that came into view at all. `viewed` fires once per node per page view. */
    readonly reached: Readonly<Record<NodeId, true>>;
    /**
     * Times the node itself was used — a link followed, a button pressed, a field
     * filled.
     */
    readonly activations: Readonly<Record<NodeId, number>>;
    readonly opens: Readonly<Record<NodeId, number>>;
    readonly closes: Readonly<Record<NodeId, number>>;
    /**
     * Times a form inside the node was submitted and the browser let it go.
     */
    readonly completions: Readonly<Record<NodeId, number>>;
    /**
     * Times a reader used something *inside* the node — pressed, followed, filled,
     * opened or closed, at any depth.
     */
    readonly engagements: Readonly<Record<NodeId, number>>;
    /**
     * What each node is, as its signals reported it. Kept because a consumer
     * holding only readings would otherwise have to go back to the tree to render
     * a row, and the signals already say.
     */
    readonly types: Readonly<Record<NodeId, PrimitiveType>>;
    readonly batches: number;
    readonly signals: number;
};

EMPTY_READINGSvalue

const EMPTY_READINGS: ReaderReadings

foldReaderSignalsfunction

One more batch, folded in.

const foldReaderSignals: (readings: ReaderReadings, batch: ReaderSignalBatch) => ReaderReadings

readingsOffunction

const readingsOf: (batches: readonly ReaderSignalBatch[]) => ReaderReadings

NodeReadingtype

One node's line, as something rendering a table wants it.

type NodeReading = {
    readonly nodeId: NodeId;
    readonly type: PrimitiveType;
    readonly dwellMs: number;
    readonly reached: boolean;
    readonly activations: number;
    readonly opens: number;
    readonly closes: number;
    /** Times a form inside it was submitted and the browser let it go. */
    readonly completions: number;
    /** Times a reader used something inside it, at any depth. */
    readonly engagements: number;
};

nodeReadingsOffunction

Readings as rows, longest on screen first.

const nodeReadingsOf: (readings: ReaderReadings) => readonly NodeReading[]

Form action

signals/form-action

What readers *do* inside a page, form by form.

FormActionSilencetype

Why a comparison of what two forms' readers did answered nothing, or less than all of it.

type FormActionSilence =
/**
 * The five states in which two readings are not two forms of one page.
 */
FormPairRefusal
/**
 * One of the two windows holds uses and credits no reader with acting inside
 * anything.
 */
 | "unwalked"
/**
 * One of the two windows held no page views.
 */
 | "nothing-measured";

FORM_ACTION_SILENCESvalue

The closed set, for a surface that has to account for every absent figure.

const FORM_ACTION_SILENCES: readonly FormActionSilence[]

describeFormActionSilencefunction

One line per silence, for a surface saying why a figure is not there.

const describeFormActionSilence: (silence: FormActionSilence) => string

FormActionSidetype

One side of the comparison, as the reading of what its readers did leaves it.

type FormActionSide = {
    readonly treeId: TreeId;
    readonly revision: number;
    /** `null` where the window named none, or named two with neither asked for. */
    readonly audienceId: AudienceId | null;
    /**
     * That side's page-view floor, carried through unchanged.
     */
    readonly views: number;
    /** Element nodes this form has, which two forms of one page need not share. */
    readonly parts: number;
    /** Parts with no element parts under them, whose share is withheld structurally. */
    readonly leaves: number;
    /** Whether this side holds uses and credits them to nobody. */
    readonly unwalked: boolean;
};

PartActionOfFormtype

A part exactly one of the two forms has, with the form that has it named.

type PartActionOfForm = {
    readonly nodeId: NodeId;
    readonly type: PrimitiveType;
    readonly role: PrimitiveRole | null;
    /** The form this part is in. The other form does not have this node at all. */
    readonly audienceId: AudienceId;
    readonly side: PartAction;
};

ComparedFormActiontype

A part both forms have, as each form's own readers used it.

type ComparedFormAction = {
    readonly nodeId: NodeId;
    /** The type {@link FormActionComparison.one} gives it; `disagreed` names the pair if the other differs. */
    readonly type: PrimitiveType;
    readonly role: PrimitiveRole | null;
    readonly one: PartAction;
    readonly other: PartAction;
    /**
     * The form whose readers acted inside it more often, or `null` where no claim
     * stands.
     */
    readonly favours: AudienceId | null;
    /**
     * The distance between the two shares, which is never signed.
     */
    readonly gap: number | null;
};

FormActionsCountedtype

How the shared parts fell, as a count over one set and never a mean.

type FormActionsCounted = {
    /** Parts {@link FormActionComparison.one}'s readers acted inside more often. */
    readonly one: number;
    /** Parts {@link FormActionComparison.other}'s readers acted inside more often. */
    readonly other: number;
    /** Parts the two forms acted inside alike. */
    readonly alike: number;
    /** Parts where one side or the other cannot say. */
    readonly unknown: number;
};

FormActionComparisontype

What two forms' readers did inside one page, held against each other.

type FormActionComparison = {
    /** The side whose audience id sorts lower, or the first argument where no pair of names stands. */
    readonly one: FormActionSide;
    readonly other: FormActionSide;
    /** The two readings this comparison was taken from, so nothing downstream derives them twice. */
    readonly readings: {
        readonly one: PageAction;
        readonly other: PageAction;
    };
    /** Parts both forms have, in the reading order of {@link FormActionComparison.one}. */
    readonly compared: readonly ComparedFormAction[];
    /** Parts exactly one form has, by audience and then by node. */
    readonly onlyIn: readonly PartActionOfForm[];
    /**
     * Shared nodes the two forms give different primitive types.
     */
    readonly disagreed: readonly NodeId[];
    /**
     * Shared nodes one form gives an inside and the other does not.
     */
    readonly insideDisagreed: readonly NodeId[];
    readonly counted: FormActionsCounted;
    /**
     * The root, held against itself across the two forms.
     */
    readonly whole: ComparedFormAction | null;
    /**
     * The shared part with the widest gap, by node id where two tie.
     */
    readonly sharpest: ComparedFormAction | null;
    readonly silence: FormActionSilence | null;
};

formActionComparisonOffunction

Hold what two forms' readers did against each other.

const formActionComparisonOf: (one: PageReading, other: PageReading) => FormActionComparison

Form copy

signals/form-copy

What two forms of one page *say*, and how much of what each says gets read.

FormCopySilencetype

Why a comparison of what two forms say answered nothing, or less than all of it.

type FormCopySilence =
/**
 * The five states in which two readings are not two forms of one page.
 */
FormPairRefusal
/**
 * Neither form says anything that could have been read.
 */
 | "wordless"
/**
 * One of the two windows held no page views.
 */
 | "nothing-measured"
/**
 * A passage reports more readers than its side of the page has views.
 */
 | "inconsistent"
/**
 * The two forms say no passage the same way.
 */
 | "unshared"
/**
 * No shared word of the page can be spoken for in both windows.
 */
 | "unspoken"
/**
 * Some shared passage's words are a floor, so the page figures are neither
 * counts nor ceilings.
 */
 | "floored";

FORM_COPY_SILENCESvalue

The closed set, for a surface that has to account for every absent figure.

const FORM_COPY_SILENCES: readonly FormCopySilence[]

describeFormCopySilencefunction

One line per silence, for a surface saying why a figure is not there.

const describeFormCopySilence: (silence: FormCopySilence) => string

FormCopySidetype

One side of the comparison, as the copy reading of that form leaves it.

type FormCopySide = {
    readonly treeId: TreeId;
    readonly revision: number;
    /** `null` where the window named none, or named two with neither asked for. */
    readonly audienceId: AudienceId | null;
    /**
     * That side's page-view floor, which is the denominator of every reach below.
     */
    readonly views: number;
    /**
     * Every word this form says, counted once.
     */
    readonly words: number;
    /** Passages this form has that say something, which two forms need not share. */
    readonly passages: number;
    /** Words this form says in parts its own window can speak for. */
    readonly spoken: number;
};

PassageOfFormtype

A passage exactly one of the two forms has, with the form that has it named.

type PassageOfForm = {
    readonly nodeId: NodeId;
    readonly type: PrimitiveType;
    readonly role: PrimitiveRole | null;
    /** The form this passage is in. The other form does not have this node at all. */
    readonly audienceId: AudienceId;
    /** The passage itself, as that form's own window read it. */
    readonly passage: Passage;
    /** What that form's window said about reaching it. */
    readonly side: PassageSide;
};

ComparedFormPassagetype

One passage both forms say, word for word, as each form's own readers read it.

type ComparedFormPassage = {
    readonly nodeId: NodeId;
    /** The type {@link FormCopyComparison.one} gives it; `disagreed` names the pair if the other differs. */
    readonly type: PrimitiveType;
    readonly role: PrimitiveRole | null;
    /** The words, the same number on both sides because they are the same words. */
    readonly words: number;
    /** The text itself, so a passage can be quoted back without a second join. */
    readonly text: readonly string[];
    /**
     * Whether either form's part declares no `copy`, so {@link words} is a floor.
     */
    readonly floored: boolean;
    readonly one: PassageSide;
    readonly other: PassageSide;
    /**
     * The form whose readers reached this passage more often, or `null` where no
     * claim stands.
     */
    readonly favours: AudienceId | null;
    /**
     * The words this passage puts in front of one form's average reader over and
     * above the other's: `words × |one.reach − other.reach|`.
     */
    readonly gap: number | null;
};

RewordedFormPassagetype

One passage both forms have and neither says the same way.

type RewordedFormPassage = {
    readonly nodeId: NodeId;
    /** The type {@link FormCopyComparison.one} gives it. */
    readonly type: PrimitiveType;
    readonly role: PrimitiveRole | null;
    /** The two word counts, which is why there is no single one. */
    readonly words: {
        readonly one: number;
        readonly other: number;
    };
    /** Whether either form declares no `copy`, so its word count is a floor. */
    readonly floored: boolean;
    readonly one: PassageSide;
    readonly other: PassageSide;
    /**
     * The form that says more words here, or `null` where the two say as many
     * words differently.
     */
    readonly wordier: AudienceId | null;
};

WordsOfFormstype

What the two forms say, and what the deltas gave only one of them.

type WordsOfForms = {
    /** Words both forms say, word for word, in a node both forms have. */
    readonly shared: number;
    /** Words of passages exactly one form has, by form. */
    readonly only: {
        readonly one: number;
        readonly other: number;
    };
    /**
     * Those words, by what each form's own window said about reaching them. Each
     * form's three add to its own {@link only}.
     */
    readonly onlyByStanding: {
        readonly one: Readonly<Record<PartStanding, number>>;
        readonly other: Readonly<Record<PartStanding, number>>;
    };
    /** Words of passages both forms have and neither says the same way, by form. */
    readonly reworded: {
        readonly one: number;
        readonly other: number;
    };
};

FormCopyCountedtype

How the shared passages fell, as a count over one set and never a mean.

type FormCopyCounted = {
    /** Passages {@link FormCopyComparison.one}'s readers reached more often. */
    readonly one: number;
    /** Passages {@link FormCopyComparison.other}'s readers reached more often. */
    readonly other: number;
    /** Passages the two forms reached alike. */
    readonly alike: number;
    /** Passages where one form or the other cannot say. */
    readonly unknown: number;
};

SharedWordsReadtype

The shared words each form's average reader got to, and the distance between them.

type SharedWordsRead = {
    /** `Σ(readers × words) ÷ views` for {@link FormCopyComparison.one}. */
    readonly one: number;
    /** The same for {@link FormCopyComparison.other}. */
    readonly other: number;
    /**
     * `|one − other|`, with the direction in {@link favours}.
     */
    readonly gap: number;
    /** The form whose average reader got to more of the shared words. */
    readonly favours: AudienceId | null;
};

FormCopyComparisontype

What two forms of one page say, and how much of the shared text each one's readers reach.

type FormCopyComparison = {
    /** The side whose audience id sorts lower, or the first argument where no pair of names stands. */
    readonly one: FormCopySide;
    readonly other: FormCopySide;
    /** The two copy readings this comparison was taken from, so nothing downstream derives them twice. */
    readonly readings: {
        readonly one: CopyReading;
        readonly other: CopyReading;
    };
    /** The census of what each form says, with no reader in it. */
    readonly says: WordsOfForms;
    /** Passages both forms say the same way, in the reading order of {@link one}. */
    readonly compared: readonly ComparedFormPassage[];
    /** Passages both forms have and neither says the same way, in the same order. */
    readonly reworded: readonly RewordedFormPassage[];
    /** Passages exactly one form has, by audience and then by node. */
    readonly onlyIn: readonly PassageOfForm[];
    /**
     * Shared nodes the two forms give different primitive types.
     */
    readonly disagreed: readonly NodeId[];
    /** Shared passages by which form's readers reached them more often. */
    readonly counted: FormCopyCounted;
    /**
     * The words those passages say, falling the same way. The four add to
     * {@link WordsOfForms.shared}.
     */
    readonly wordsCounted: FormCopyCounted;
    /** Shared passages whose words are a floor. */
    readonly floored: number;
    /**
     * The shared passages neither form's readers reached, most words first and
     * then in reading order.
     */
    readonly unseenByEither: readonly ComparedFormPassage[];
    /** The shared words each form's average reader got to; `null` where {@link silence} says why not. */
    readonly typical: SharedWordsRead | null;
    /**
     * The shared passage the two forms read most differently, by node id where
     * two tie.
     */
    readonly sharpest: ComparedFormPassage | null;
    readonly silence: FormCopySilence | null;
};

formCopyComparisonOffunction

Hold what two forms of one page say, and the reading of what they share, against each other.

const formCopyComparisonOf: (one: PageReading, other: PageReading) => FormCopyComparison

Forms

signals/forms

Two forms of one page, side by side.

FormComparisonSilencetype

Why a comparison of two forms answered nothing, or answered less than all of it.

type FormComparisonSilence =
/**
 * The five states in which two readings are not two forms of one page, taken
 * whole from {@link FormPairRefusal}.
 */
FormPairRefusal
/**
 * One of the two windows held no page views.
 */
 | "nothing-measured";

FORM_COMPARISON_SILENCESvalue

The closed set, for a surface that has to account for every absent figure.

const FORM_COMPARISON_SILENCES: readonly FormComparisonSilence[]

describeFormComparisonSilencefunction

One line per silence, for a surface saying why a figure is not there.

const describeFormComparisonSilence: (silence: FormComparisonSilence) => string

FormSidetype

One side of the comparison, as the window it was read from leaves it.

type FormSide = {
    readonly treeId: TreeId;
    readonly revision: number;
    /** `null` where the window named none, or named two with neither asked for. */
    readonly audienceId: AudienceId | null;
    /**
     * That side's page-view floor, which is the denominator of every reach below.
     */
    readonly views: number;
    /** Element nodes this form has, which two forms of one page need not share. */
    readonly parts: number;
};

FormPartSidetype

What one side's window says about one part of it.

type FormPartSide = {
    readonly standing: PartStanding;
    /** Distinct page views of this form that reported the part coming into view. */
    readonly readers: number;
    /** That side's own view floor, carried so the share below can be checked. */
    readonly views: number;
    /**
     * {@link FormPartSide.readers} over {@link FormPartSide.views}, or `null`
     * where that window held none.
     */
    readonly reach: number | null;
};

PartOfFormtype

A part exactly one of the two forms has, with the form that has it named.

type PartOfForm = {
    readonly nodeId: NodeId;
    readonly type: PrimitiveType;
    readonly role: PrimitiveRole | null;
    /** The form this part is in. The other form does not have this node at all. */
    readonly audienceId: AudienceId;
    readonly side: FormPartSide;
};

ComparedFormtype

A part both forms have, read by each form's own readers.

type ComparedForm = {
    readonly nodeId: NodeId;
    /** The type {@link FormComparison.one} gives it; `disagreed` names the pair if the other differs. */
    readonly type: PrimitiveType;
    readonly role: PrimitiveRole | null;
    readonly one: FormPartSide;
    readonly other: FormPartSide;
    /**
     * The form whose readers reached it more often, or `null` where no claim
     * stands.
     */
    readonly favours: AudienceId | null;
    /**
     * The distance between the two reaches, which is never signed.
     */
    readonly gap: number | null;
};

FormsCountedtype

How the shared parts fell, as a count over one set and never a mean.

type FormsCounted = {
    /** Parts {@link FormComparison.one}'s readers reached more often. */
    readonly one: number;
    /** Parts {@link FormComparison.other}'s readers reached more often. */
    readonly other: number;
    /** Parts the two forms reached alike. */
    readonly alike: number;
    /** Parts where one side or the other cannot say. */
    readonly unknown: number;
};

FormComparisontype

Two forms of one page held against each other.

type FormComparison = {
    /** The side whose audience id sorts lower, or the first argument where no pair of names stands. */
    readonly one: FormSide;
    readonly other: FormSide;
    /** Parts both forms have, in the reading order of {@link FormComparison.one}. */
    readonly compared: readonly ComparedForm[];
    /** Parts exactly one form has, by audience and then by node. */
    readonly onlyIn: readonly PartOfForm[];
    /**
     * Shared nodes the two forms give different primitive types.
     */
    readonly disagreed: readonly NodeId[];
    readonly counted: FormsCounted;
    /** The shared part with the widest gap, by node id where two tie; `null` where none can say. */
    readonly sharpest: ComparedForm | null;
    readonly silence: FormComparisonSilence | null;
};

formComparisonOffunction

Hold two forms of one page against each other.

const formComparisonOf: (one: PageReading, other: PageReading) => FormComparison

Frontier

signals/frontier

**Where a window's reading of a page stopped.**

UnreachedParttype

One place the reading of a page stopped: a part no view reported reaching, sitting inside a part that was reached.

type UnreachedPart = {
    readonly nodeId: NodeId;
    readonly type: PrimitiveType;
    /** What part it plays, or `null` where its type declared none. */
    readonly role: PrimitiveRole | null;
    /** Depth in the tree, counting every node; 0 at the root. */
    readonly depth: number;
    /**
     * The part it sits inside, and `null` at the outermost part — which is the
     * one stop that means *the page itself was never reported on*.
     */
    readonly withinId: NodeId | null;
    /**
     * What that containing part's standing was.
     */
    readonly within: PartStanding | null;
    /** Parts in its subtree, itself excluded, whatever each of them reported. */
    readonly beneath: number;
    /**
     * Parts this stop accounts for, itself included — so 1 for a stop with
     * nothing inside it.
     */
    readonly unseen: number;
    /**
     * Parts in its subtree that **did** report reach, which should be none.
     */
    readonly reportedBelow: number;
    /**
     * The words nobody reached here, in reading order: this part's own and those
     * of every part it accounts for.
     */
    readonly words: readonly string[];
};

PageFrontiertype

Where one window's reading of one revision of one page stopped.

type PageFrontier = {
    readonly treeId: TreeId;
    readonly revision: number;
    /**
     * The audience the reading was of, carried through from
     * {@link PageReading.audienceId} unchanged.
     */
    readonly audienceId: AudienceId | null;
    /**
     * Every audience the window named, carried through from
     * {@link PageReading.audiences} unchanged.
     */
    readonly audiences: readonly AudienceId[];
    /**
     * The floor on page views the reading was drawn from, carried through from
     * {@link PageReading.views}.
     */
    readonly views: number;
    /** Every place the reading stopped, in reading order. */
    readonly frontier: readonly UnreachedPart[];
    /**
     * Parts no view reported reaching — the sum of every stop's `unseen`, and so
     * equal to `skipped` in {@link PageReading.standings}.
     */
    readonly unseen: number;
    /** Parts at least one view reported reaching. */
    readonly read: number;
    /** Parts nothing can be said about. */
    readonly unknown: number;
    /** Every addressed node of the revision, which is the universe the rest is out of. */
    readonly parts: number;
    /**
     * Parts that were reached, hold at least one part, and whose every part went
     * unreached.
     */
    readonly passedOver: readonly NodeId[];
    /**
     * Parts that reported nothing while a part inside them reported reach.
     */
    readonly notReporting: readonly NodeId[];
    /**
     * Rows of the reading that named a node this revision does not contain,
     * carried through from {@link PageReading.orphaned}.
     */
    readonly orphaned: number;
};

pageFrontierOffunction

Read a page's reading as the places it stopped.

Shown in use on What your readers do — A count of parts is not a count of things to fix

const pageFrontierOf: (reading: PageReading) => PageFrontier

largestUnreachedInfunction

The frontier parts that cost the page the most, largest first.

const largestUnreachedIn: (frontier: PageFrontier, limit?: number) => readonly UnreachedPart[]

unreachedWordsInfunction

The words nobody reached, in reading order.

const unreachedWordsIn: (frontier: PageFrontier) => readonly string[]

Funnel

signals/funnel

A funnel, read against the readers who arrived.

FunnelStagetype

Where a funnel loses readers, of the two places it can.

type FunnelStage = 
/** Arrivals that never satisfied the pair's first end. */
"before"
/** Arrivals that satisfied the first end and not the second. */
 | "between";

FUNNEL_STAGESvalue

const FUNNEL_STAGES: readonly FunnelStage[]

describeFunnelStagefunction

One line per stage, for a surface putting the reading in front of a person.

const describeFunnelStage: (stage: FunnelStage) => string

EndStandingtype

What the revision's tree says about one end of a pair.

type EndStanding =
/**
 * The revision has an element node with this id, so a count against the end
 * is a fact about readers.
 */
"present"
/**
 * No element node of the revision has this id.
 */
 | "absent";

END_STANDINGSvalue

const END_STANDINGS: readonly EndStanding[]

describeEndStandingfunction

One line per standing, for a surface putting the reading in front of a person.

const describeEndStanding: (standing: EndStanding) => string

PairEndstype

Where each end of a pair stands against the revision it is being asked of.

type PairEnds = {
    readonly from: EndStanding;
    readonly to: EndStanding;
};

FunnelSharetype

A count of page views, put as a share of the readers there were.

type FunnelShare = {
    /**
     * The estimate, against the page views the rollups counted:
     * `count ÷ appearances`.
     */
    readonly share: number | null;
    /**
     * The ceiling, against the page views that began: `count ÷ opened`, never
     * above 1.
     */
    readonly atMost: number | null;
    /**
     * The share applied to the exact count of arrivals — the number a sentence
     * says out loud.
     */
    readonly readers: number | null;
    /**
     * The most readers it could be: the smaller of the count and the openings,
     * which is a whole number of real page views either way. `null` under a
     * silence.
     */
    readonly atMostReaders: number | null;
};

PairLeaktype

The readers one pair loses between its two ends, on the scale its page's door counts in, as the interval the straddle leaves it in.

type PairLeak = {
    /**
     * The least it could be: the readers who reached the first end, at the most
     * the true rate could be, on the door's scale.
     */
    readonly atLeast: number;
    /**
     * The most it could be: `reached − converted` on the door's scale, which is
     * the key an order of conversions is on.
     */
    readonly atMost: number;
};

PairReachtype

One pair of a revision, as stored and as a share of the readers there were.

type PairReach = {
    readonly pair: FunnelPair;
    /**
     * Page views that satisfied `from`, exactly as stored: added across rollup
     * windows and therefore generous.
     */
    readonly reached: number;
    /**
     * Page views that satisfied both ends, exactly as stored.
     */
    readonly converted: number;
    /** When the funnel row last moved. */
    readonly updatedAt: string;
    /**
     * Where each end stands against the revision's tree.
     */
    readonly ends: PairEnds;
    /**
     * Either end is {@link EndStanding.absent}, so the question is about a part
     * this revision does not have.
     */
    readonly stale: boolean;
    /**
     * An end the tree does not have, with a count against it: `reached` on an
     * absent `from`, or `converted` on an absent `to`.
     */
    readonly orphaned: boolean;
    /**
     * `converted ÷ reached` — of the readers who got to the first end, the share
     * that finished.
     */
    readonly rate: number | null;
    /**
     * The most the true rate could be, given the straddle §8 measured.
     */
    readonly rateAtMost: number | null;
    /**
     * The readers this pair loses between its two ends, bounded and on the door's
     * scale, or `null` where there is no such loss to put a scale on.
     */
    readonly leak: PairLeak | null;
    /**
     * Of the readers who arrived, the share that got to the first end.
     */
    readonly entry: FunnelShare;
    /** Of the readers who arrived, the share that got to both. Withheld where either end is absent. */
    readonly conversion: FunnelShare;
    /**
     * The share of arrivals that never reached the first end.
     */
    readonly lostBefore: number | null;
    /**
     * The share of arrivals that reached the first end and did not convert.
     */
    readonly lostBetween: number | null;
    /**
     * Which of the two stages cost more readers, by headcount rather than by
     * share, which is the ranking rule for a fall between two siblings at its
     * two-element case.
     */
    readonly worse: FunnelStage | null;
    /**
     * More readers reached the first end than there were page views to reach it
     * in, so no share here can be drawn.
     */
    readonly unreconciled: boolean;
};

FunnelReachtype

A revision's funnels, read against the exact number of readers that revision had.

type FunnelReach = {
    readonly treeId: TreeId;
    readonly revision: number;
    /**
     * The audience whose answers this reading is of, or `null` where the reading
     * it was taken from named none.
     */
    readonly audienceId: AudienceId | null;
    /**
     * Every population the window named, deduplicated and in a stable order.
     */
    readonly audiences: readonly AudienceId[];
    /** Page views that began on this revision. Exact, and addable. */
    readonly opened: number;
    /** The same page views as the rollups counted them: once per window each appeared in. */
    readonly appearances: number;
    /** Appearances in excess of openings — the straddle, measured. Never negative. */
    readonly drift: number;
    /** Openings whose reading no rollup has folded yet. The other sign of the same subtraction. */
    readonly pending: number;
    /** `drift ÷ opened`: how generous every distinct count here is. `null` when nothing opened. */
    readonly inflation: number | null;
    /** When the page-view row last moved, or `null` where there is no row. */
    readonly updatedAt: string | null;
    /** Set where no share can be given, and the reason. `null` where they can. */
    readonly silence: ReachSilence | null;
    /**
     * Nobody's visit spanned two windows, so there is nothing to divide out: the
     * rates are exact and each `rateAtMost` equals its `rate`.
     */
    readonly exact: boolean;
    /**
     * The revision's pairs, ordered by their two ends so a screen does not
     * reorder on a refresh. Deliberately not ranked — see the module note.
     */
    readonly pairs: readonly PairReach[];
    /** Page-view rows for another tree or revision, and ignored. */
    readonly foreign: number;
    /** Page-view rows for this revision beyond the first, where the first stands. */
    readonly duplicated: number;
    /**
     * Funnel rows for another tree or revision, and ignored.
     */
    readonly foreignPairs: number;
    /**
     * Funnel rows for this revision in another audience, and ignored.
     */
    readonly otherAudiencePairs: number;
    /**
     * Funnel rows naming a pair already seen, where every one after the first was
     * ignored.
     */
    readonly duplicatedPairs: number;
    /**
     * Pairs with an end this revision does not have, counted off
     * {@link FunnelReach.pairs} and therefore once each.
     */
    readonly stalePairs: number;
    /** Of those, the ones with a count against the missing end. Counted off the same list. */
    readonly orphanedPairs: number;
};

funnelReachOffunction

Read a revision's funnels against the readers that revision had, and against the tree that revision is.

const funnelReachOf: (reading: PageReading, funnels: readonly StoredFunnel[], rows: readonly StoredPageViews[]) => FunnelReach

Funnel change

signals/funnel-change

What a change did to the funnel.

FunnelChangeSilencetype

Why a comparison of two windows' funnels left a figure out.

type FunnelChangeSilence =
/**
 * The two readings are of different trees.
 */
"different-trees"
/**
 * The two readings are of two audiences, and so of two populations.
 */
 | "different-audiences"
/**
 * One of the two windows holds two forms of the page and named neither.
 */
 | "audiences-mixed"
/**
 * One of the two windows has no page-view row at the door.
 */
 | "unscaled"
/**
 * One of the two windows has a row and nothing in it says a page view began.
 */
 | "unopened"
/**
 * One of the two windows holds arrivals no rollup has folded yet.
 */
 | "uncounted"
/**
 * No pair is asked of both windows.
 */
 | "unasked";

FUNNEL_CHANGE_SILENCESvalue

The closed set, for a surface that has to account for every absent figure.

const FUNNEL_CHANGE_SILENCES: readonly FunnelChangeSilence[]

describeFunnelChangeSilencefunction

One line per silence, for a surface saying why a figure is not there.

const describeFunnelChangeSilence: (silence: FunnelChangeSilence) => string

FunnelMovementtype

What happened to whether readers finish a funnel.

type FunnelMovement =
/**
 * Readers reached the first end and none of them finished, and now some do —
 * the sentence a change to an ask nobody answers is made for.
 */
"taken-up"
/** Readers finished it and now they reach the first end and do not. */
 | "abandoned"
/**
 * Reached and unfinished before, reached and unfinished now — the asks a
 * change did not fix.
 */
 | "still-unconverted"
/** Readers finished it before and after. */
 | "held"
/**
 * One of the two windows cannot say whether readers finished it.
 */
 | "unknown";

FUNNEL_MOVEMENTSvalue

The closed set, for a surface accounting for every pair it was handed.

const FUNNEL_MOVEMENTS: readonly FunnelMovement[]

describeFunnelMovementfunction

One line per movement, for a surface putting a funnel in front of a person.

const describeFunnelMovement: (movement: FunnelMovement) => string

QuestionMovementtype

What the change did to the question itself.

type QuestionMovement =
/** Both ends are in both revisions, so the two sides answer the same question. */
"asked"
/**
 * The earlier revision had both ends and the later one is missing one.
 */
 | "broken"
/** The earlier revision was missing an end and the later one has both: the change put it back. */
 | "restored"
/** An end is missing from both revisions, so neither side was ever answering. */
 | "stale";

QUESTION_MOVEMENTSvalue

The closed set, for a surface accounting for every compared pair.

const QUESTION_MOVEMENTS: readonly QuestionMovement[]

describeQuestionMovementfunction

One line per movement, for a surface saying what a change did to a question.

const describeQuestionMovement: (movement: QuestionMovement) => string

ConversionCausetype

Which of the two things a funnel is made of moved the share of arrivals that finished.

type ConversionCause =
/**
 * Getting there alone was enough: the later window's reach at the earlier
 * window's closing rate would have moved it the same way.
 */
"entry"
/**
 * Finishing alone was enough: the earlier window's reach at the later
 * window's closing rate would have moved it the same way.
 */
 | "closing"
/**
 * Either alone would have been enough, so the movement is over-determined.
 */
 | "either";

CONVERSION_CAUSESvalue

The closed set, and it is **one member shorter than every other counterfactual here**, which is a property of the arithmetic rather than a decision.

const CONVERSION_CAUSES: readonly ConversionCause[]

describeConversionCausefunction

One line per cause, for a surface saying what moved a conversion share.

const describeConversionCause: (cause: ConversionCause) => string

ComparedFunneltype

One funnel question both windows were asked, as two windows answer it.

type ComparedFunnel = {
    /** The pair as the later window holds it, which is the same question either way. */
    readonly pair: FunnelPair;
    /** The whole of what the earlier window said about it. */
    readonly was: PairReach;
    /** The whole of what the later window said about it. */
    readonly now: PairReach;
    readonly movement: FunnelMovement;
    /** What the change did to whether the question names anything. */
    readonly question: QuestionMovement;
    /**
     * `now.rate ÷ was.rate` — of the readers who got to the first end, how much
     * likelier they are to finish.
     */
    readonly rateRatio: Ratio;
    /**
     * The least the true ratio could be: `now.rate ÷ was.rateAtMost`.
     */
    readonly rateRatioAtLeast: number | null;
    /** The most the true ratio could be: `now.rateAtMost ÷ was.rate`. `null` on the same terms. */
    readonly rateRatioAtMost: number | null;
    /**
     * The bracket clears 1, so the rate moved by more than the straddle alone
     * could account for.
     */
    readonly rateMoved: boolean | null;
    /**
     * `now.entry.share ÷ was.entry.share` — how much likelier an arrival is to
     * get to the first end.
     */
    readonly entryRatio: Ratio;
    /**
     * `now.conversion.share ÷ was.conversion.share` — how much likelier an
     * arrival is to finish, which is the figure a deployment means by *did the
     * change work*.
     */
    readonly conversionRatio: Ratio;
    /**
     * The later window's reach at the earlier window's closing rate, as a share
     * of arrivals: the conversion share if only getting there had moved.
     */
    readonly ifOnlyEntryMoved: number | null;
    /** The other diagonal: the conversion share if only the closing had moved. */
    readonly ifOnlyClosingMoved: number | null;
    /** Which side was enough on its own. `null` where the conversion share did not move. */
    readonly cause: ConversionCause | null;
    /**
     * The movement in the conversion share, put on the later window's scale:
     * `(now.conversion.share − was.conversion.share) × now.opened`.
     */
    readonly readersMoved: number | null;
};

FunnelChangetype

What a change did to a page's funnels.

type FunnelChange = {
    /** The earlier reading's tree. The two agree unless `silence` is `different-trees`. */
    readonly treeId: TreeId;
    readonly revisions: {
        readonly was: number;
        readonly now: number;
    };
    /**
     * The audience each side was of, where its reading named one.
     */
    readonly audiences: ComparedAudiences;
    /** The two funnel readings this comparison is made of. */
    readonly readings: {
        readonly was: FunnelReach;
        readonly now: FunnelReach;
    };
    /**
     * Every question both windows were asked, ordered by the pair's two ends so a
     * screen does not reorder on a refresh.
     */
    readonly compared: readonly ComparedFunnel[];
    /**
     * Questions only the later window was asked, as it answered them.
     */
    readonly added: readonly PairReach[];
    /** Questions only the earlier window was asked, as it answered them. */
    readonly removed: readonly PairReach[];
    /** Compared pairs by what happened to the verdict. The five add to {@link compared}'s length. */
    readonly movements: Readonly<Record<FunnelMovement, number>>;
    /** Compared pairs by what the change did to the question. The four add to {@link compared}'s length. */
    readonly questions: Readonly<Record<QuestionMovement, number>>;
    /**
     * The compared pair whose conversion share gained the most readers at the
     * later window's scale, or `null` where none gained.
     */
    readonly mostGained: ComparedFunnel | null;
    /** The compared pair that lost the most, by the same rule. `null` where none lost. */
    readonly mostLost: ComparedFunnel | null;
    /**
     * Compared pairs whose rate ratio is given and whose bracket contains 1, so
     * the straddle alone could account for the whole movement.
     */
    readonly undecided: number;
    /**
     * Neither window had a page view that spanned a rollup boundary, so every
     * rate on both sides is exact and every bracket is a point.
     */
    readonly exact: boolean;
    /**
     * Pairs naming a question already seen on that side, where every one after
     * the first was ignored.
     */
    readonly duplicated: number;
    /** Set where a figure is missing and why. `null` where nothing is. */
    readonly silence: FunnelChangeSilence | null;
};

conversionCauseOffunction

Which side was enough on its own, by the direction each counterfactual carries — the sufficiency rule the two earlier counterfactuals here publish, asked of a product.

const conversionCauseOf: (was: number, now: number, ifOnlyEntryMoved: number, ifOnlyClosingMoved: number) => ConversionCause | null

funnelChangeOffunction

Hold two windows of one page's funnels against each other.

const funnelChangeOf: (was: FunnelReach, now: FunnelReach) => FunnelChange

Funnel hours

signals/funnel-hours

**A funnel, by the hour the readers in it entered it.**

FunnelHourCounttype

One funnel pair's answer for one hour of one revision.

type FunnelHourCount = {
    readonly treeId: TreeId;
    readonly revision: number;
    /**
     * The two ends, as a stored funnel answer carries them and with no scope
     * among them: the pages a question was asked on decide which rows are
     * written and never what one means.
     */
    readonly pair: FunnelPair;
    /** The hour the readers in it entered the funnel, as the instant that hour began (UTC). */
    readonly hour: number;
    /** Views that satisfied `from` in this hour. */
    readonly reached: number;
    /** Of those, the views that satisfied `to`. Never greater than {@link FunnelHourCount.reached}. */
    readonly converted: number;
};

StoredFunnelHourtype

One hour's row as the store keeps it. See StoredTally.audienceId.

type StoredFunnelHour = FunnelHourCount & {
    readonly audienceId: AudienceId;
    readonly updatedAt: string;
};

StoredFunnelHourstype

What a ranged read of this counter hands back, which is the shape StoredArrivals and StoredActed have and for the same two reasons.

type StoredFunnelHours = {
    /** Every row in the range, in no particular order. */
    readonly hours: readonly StoredFunnelHour[];
    /**
     * The first hour this scope ever counted a reach in, whatever range was asked
     * for.
     */
    readonly begins?: number;
};

FunnelHourtype

One hour of a range, which is one bar and one cohort.

type FunnelHour = {
    /** The instant the hour began (UTC). */
    readonly hour: number;
    /** Views that entered the funnel in it. */
    readonly reached: number;
    /** Of those, the ones that converted — in this hour's cohort, not in this hour. */
    readonly converted: number;
    /**
     * Whether this hour is over and inside the range.
     */
    readonly whole: boolean;
};

FunnelHourSeriestype

A funnel over a range, by hour, for one pair.

type FunnelHourSeries = {
    readonly range: ArrivalRange;
    /** The pair this series is of, as the caller named it. */
    readonly pair: FunnelPair;
    /**
     * One entry per hour, ascending, from the later of the range's first hour and
     * the hour counting began. Dense: an hour nobody entered the funnel in is
     * nought in both numbers and is present.
     */
    readonly hours: readonly FunnelHour[];
    /** Views that entered the funnel inside the range, which is the sum of the hours. */
    readonly reached: number;
    /** Of those, the ones that converted. Never greater than {@link FunnelHourSeries.reached}. */
    readonly converted: number;
    /**
     * `converted ÷ reached` over the range, or `null` where nothing reached the
     * first end.
     */
    readonly rate: number | null;
    /** The first hour this scope ever counted, carried through from the store. */
    readonly begins?: number;
    /** Whether the range starts before counting did, so the series is shorter than asked for. */
    readonly clipped: boolean;
};

funnelHourSeriesOffunction

The hours of a range for one pair, as the counter answers for them.

const funnelHourSeriesOf: (stored: StoredFunnelHours, pair: FunnelPair, range: ArrivalRange, options?: ArrivalSeriesOptions) => FunnelHourSeries

FunnelHourChangetype

A funnel over a range against the same funnel over the period before it.

type FunnelHourChange = {
    readonly range: ArrivalRange;
    /** The equal-length period before, which is `arrivalRangeBefore`. */
    readonly before: ArrivalRange;
    readonly pair: FunnelPair;
    readonly reached: number;
    readonly converted: number;
    /** The later side's rate, on {@link FunnelHourSeries.rate}'s terms. */
    readonly rate: number | null;
    /**
     * What the earlier period held, or `null` where counting had not begun when
     * it started.
     */
    readonly wasReached: number | null;
    readonly wasConverted: number | null;
    readonly wasRate: number | null;
    /**
     * The later rate over the earlier rate, or why there is none (`ratios.ts`).
     */
    readonly ratio: Ratio;
};

funnelHourChangeOffunction

Both sides and the quotient, from one read spanning both periods.

const funnelHourChangeOf: (stored: StoredFunnelHours, pair: FunnelPair, range: ArrivalRange, options?: ArrivalSeriesOptions) => FunnelHourChange

FunnelHourReadingRequesttype

What a surface asks for: a range, the pair, the narrowing and the clock.

type FunnelHourReadingRequest = {
    readonly range: ArrivalRange;
    /**
     * The funnel this is about.
     */
    readonly pair: FunnelPair;
    /** Absent reads every tree the handle can see, which is the scope rule. */
    readonly treeId?: TreeId;
    /** Absent reads every audience, whose counts then add. */
    readonly audience?: AudienceId | undefined;
    /** Absent reads every revision, whose counts then add — which is what a step wants. */
    readonly revision?: number;
    /** Now, where the caller has it, so the hour in progress is marked as one. */
    readonly now?: number;
};

FunnelHourReadingtype

The chart and the two sides beside it, from one read.

type FunnelHourReading = {
    readonly series: FunnelHourSeries;
    readonly change: FunnelHourChange;
};

FunnelHourCounterHandletype

The one method of the counter handle a reading of this needs.

type FunnelHourCounterHandle = {
    readonly funnelHours: (request?: {
        readonly treeId?: TreeId;
        readonly audience?: AudienceId | undefined;
        readonly revision?: number;
        readonly pair?: FunnelPair;
        readonly from?: number;
        readonly to?: number;
    }) => Promise<Result<StoredFunnelHours, ReaderSignalStoreError>>;
};

readReaderFunnelHoursfunction

The chart, the range's figures and the period before it, in one call against a counter handle.

const readReaderFunnelHours: (store: FunnelHourCounterHandle, request: FunnelHourReadingRequest) => Promise<Result<FunnelHourReading, ReaderSignalStoreError>>

Funnel identity

signals/funnel-identity

**What makes two funnel questions the same question, spelled once.**

funnelPairKeyfunction

What makes two funnel rows the same question: the two nodes a deployment named, in the two kinds it named them with.

const funnelPairKey: (pair: FunnelPair) => string

Funnel rhythm

signals/funnel-rhythm

**The two folds of the third clocked counter, where a bucket is a cohort and the only sound figure over one is the quotient of its two sums.**

FunnelCohorttype

A set of page views that entered one funnel, and what came of them.

type FunnelCohort = {
    /** Views that entered the funnel — that satisfied the pair's `from` — in this bucket's hours. */
    readonly reached: number;
    /** Of those views, the ones that went on to satisfy `to`. Never greater than `reached`. */
    readonly converted: number;
    /**
     * `converted ÷ reached`, or `null` where nothing entered the funnel here.
     */
    readonly rate: number | null;
};

FunnelDayBuckettype

One day of a range, which is one bar.

type FunnelDayBucket = FunnelCohort & {
    /** The instant the day began, at this series' offset. */
    readonly day: number;
    /** How many of its twenty-four hours the series could speak for. */
    readonly hours: number;
    /**
     * Whether all twenty-four are present and every one of them over.
     */
    readonly whole: boolean;
};

FunnelDaySeriestype

One funnel pair's hours, folded into the days they fell in.

type FunnelDaySeries = FunnelCohort & {
    /** The range the series was taken over, carried through unchanged. */
    readonly range: ArrivalRange;
    /** The pair this is of, carried through from the series. */
    readonly pair: FunnelPair;
    /**
     * One entry per day, ascending, dense.
     */
    readonly days: readonly FunnelDayBucket[];
    /** The offset the days were cut at, in whole hours from UTC. */
    readonly offsetHours: number;
    /** Whether the range begins before counting did, carried through from the series. */
    readonly clipped: boolean;
    /** How many of the days above are not whole: the two edges and whatever a clock cut. */
    readonly partial: number;
};

FunnelDayHourtype

One hour of the day, over every day of a range, for one pair.

type FunnelDayHour = FunnelCohort & {
    /** The hour of the day, 0 to 23, at this shape's offset. */
    readonly hour: number;
    /** How many days contributed a whole hour here. */
    readonly days: number;
    /**
     * The mean cohort size over the days that could speak for this hour.
     */
    readonly reachedPerDay?: number;
    /** The mean conversions over the same days, withheld on the same condition. */
    readonly convertedPerDay?: number;
};

FunnelShapeSilencetype

Why a shape has nothing to say about any hour of the day.

Shown in use on What your readers do — Where a question loses people

type FunnelShapeSilence =
/** Nothing has ever been counted for this pair, so the series this folds is empty. */
"unmeasured"
/**
 * The range holds hours and not one of them is over.
 */
 | "unsettled"
/**
 * The range holds finished hours and nobody entered the funnel in any of them.
 */
 | "unreached";

FUNNEL_SHAPE_SILENCESvalue

The members, published so that the set can be enumerated rather than remembered — the convention silence-sweep.test.ts holds every set in this directory to.

const FUNNEL_SHAPE_SILENCES: readonly FunnelShapeSilence[]

describeFunnelShapeSilencefunction

One line per silence, for a surface saying why a funnel's day has no shape.

Shown in use on What your readers do — Where a question loses people

const describeFunnelShapeSilence: (silence: FunnelShapeSilence) => string

FunnelDayShapetype

The hours of a reader's day for one funnel, over whatever range was read.

type FunnelDayShape = FunnelCohort & {
    /** The pair this is of, carried through from the series. */
    readonly pair: FunnelPair;
    /** Twenty-four entries, ascending from hour 0. */
    readonly hours: readonly FunnelDayHour[];
    /**
     * What the range counted and the shape left out, because the hour was not over.
     */
    readonly incomplete: {
        readonly reached: number;
        readonly converted: number;
    };
    /** How many days contributed any whole hour at all. */
    readonly days: number;
    /**
     * Whether every hour of the day rests on the same number of days.
     */
    readonly even: boolean;
    /** The offset the hours were named at, in whole hours from UTC. */
    readonly offsetHours: number;
    /** Why there is nothing to read, where there is nothing. */
    readonly silence?: FunnelShapeSilence;
};

funnelDaysOffunction

One funnel's hours, folded into the days they fell in.

Shown in use on What your readers do — Where a question loses people

const funnelDaysOf: (series: FunnelHourSeries, cut: DayCut) => FunnelDaySeries

funnelDayShapeOffunction

The hours of the day one funnel's whole hours fell in.

Shown in use on What your readers do — Where a question loses people

const funnelDayShapeOf: (series: FunnelHourSeries, cut: DayCut) => FunnelDayShape

bestConvertingHoursInfunction

The hours of the day this question converts best in, best first.

Shown in use on What your readers do — Where a question loses people

const bestConvertingHoursIn: (shape: FunnelDayShape, most?: number, atLeast?: number) => readonly FunnelDayHour[]

worstConvertingHoursInfunction

The hours of the day this question converts worst in, worst first.

Shown in use on What your readers do — Where a question loses people

const worstConvertingHoursIn: (shape: FunnelDayShape, fewest?: number, atLeast?: number) => readonly FunnelDayHour[]

Health

signals/health

Whether what a deployment collected can be trusted, and which of its pages cannot.

COUNTS_INFLATED_ABOVEvalue

How generous a revision's distinct counts may be before its absolute figures are not worth printing.

const COUNTS_INFLATED_ABOVE = 0.5

CollectionScheduletype

What a deployment expects of its own collection, which is the one fact here that no row can supply.

type CollectionSchedule = {
    /**
     * The instant the reading is taken, as an ISO 8601 timestamp.
     */
    readonly at: string;
    /**
     * The longest a fold may honestly be behind, in milliseconds.
     */
    readonly foldsWithinMs: number;
};

CollectionFaulttype

Something wrong with what a deployment is collecting, rather than a quiet window.

type CollectionFault =
/**
 * The window's counters hold readers of this revision and there is no
 * page-view row at the door for it.
 */
"door-unscaled"
/**
 * The door row is there, something counted readers of this revision — a
 * rollup's appearances, or the counters themselves — and nothing has ever
 * said a page view *began*.
 */
 | "openings-unmarked"
/**
 * The revision's distinct counts are inflated past
 * {@link COUNTS_INFLATED_ABOVE}.
 */
 | "counts-inflated"
/**
 * Page views of this revision are waiting to be folded and the last fold of
 * it was longer ago than the deployment said its collection takes.
 */
 | "collection-stalled"
/**
 * The window holds uses of this page and credits none of them to a reader.
 */
 | "actions-uncredited"
/**
 * A part of this page reported nothing while a part **inside it** reported
 * being reached.
 */
 | "parts-unreporting"
/**
 * Counters filed under this tree and revision that name nodes the tree does
 * not contain, or the same row handed in twice.
 */
 | "rows-mishandled"
/**
 * The window holds two audiences' counters for this page and the reading was
 * taken of neither.
 */
 | "audiences-mixed";

COLLECTION_FAULTSvalue

const COLLECTION_FAULTS: readonly CollectionFault[]

describeCollectionFaultfunction

One line per fault, for a surface naming what is wrong.

const describeCollectionFault: (fault: CollectionFault) => string

FaultRemedytype

Whose hand a fault falls to.

type FaultRemedy =
/** The pages: a newer broadcaster, or one whose delegation walks the ancestry. */
"senders"
/** The deployment's own configuration: the rollup window. */
 | "configuration"
/** The surface that asked: it handed in a tree and a window that do not match, or two reads. */
 | "caller"
/**
 * Nothing the rows can name.
 */
 | "undetermined";

FAULT_REMEDIESvalue

const FAULT_REMEDIES: readonly FaultRemedy[]

remedyOffunction

Whose hand this fault falls to, which is the half of a fault a person acts on.

const remedyOf: (fault: CollectionFault) => FaultRemedy

spoilsTheLossfunction

Whether a fault reaches the figure an order of a deployment's pages is ranked on, which is readers lost at the sharpest fall, deflated to the door's scale.

const spoilsTheLoss: (fault: CollectionFault) => boolean

spoilsTheConversionfunction

Whether a fault reaches the figure an order of a deployment's conversions is ranked on, which is readers lost **between** the two ends of a question, deflated to the door's scale.

const spoilsTheConversion: (fault: CollectionFault) => boolean

HealthStandingtype

Where one revision of one page stands.

type HealthStanding =
/** Measured, with nothing wrong that these rows can see. */
"sound"
/** At least one fault, named on the row. */
 | "faulted"
/**
 * Nothing was collected about this revision at all.
 */
 | "unmeasured"
/**
 * The door counted page views of this revision and no rollup has folded any of
 * them.
 */
 | "unfolded";

HEALTH_STANDINGSvalue

const HEALTH_STANDINGS: readonly HealthStanding[]

describeHealthStandingfunction

One line per standing, for a surface saying why a page is where it is.

const describeHealthStanding: (standing: HealthStanding) => string

PageHealthtype

One revision of one page, and what is wrong with what was collected about it.

type PageHealth = {
    readonly treeId: TreeId;
    readonly revision: number;
    /**
     * The audience this row is about, or `null` where the reading named none.
     */
    readonly audienceId: AudienceId | null;
    readonly standing: HealthStanding;
    /**
     * Every fault, in the order {@link COLLECTION_FAULTS} publishes them, which is
     * the order they are worth reading in: the one that costs the denominator
     * first, the four that are the deployment's, then the caller's.
     */
    readonly faults: readonly CollectionFault[];
    /**
     * The window's view floor, carried through from the reading unchanged.
     */
    readonly views: number;
    /**
     * Page views counted at the door, exact, or `null` where this revision has no
     * row.
     */
    readonly arrivals: number | null;
    /** The same page views as the rollups saw them, or `null` with no row. */
    readonly appearances: number | null;
    /** This revision's own straddle rate, or `null` where nothing has opened. */
    readonly inflation: number | null;
    /**
     * Openings no rollup has folded yet, which is a figure and never a fault here.
     */
    readonly pending: number;
    /**
     * When a rollup last folded a window holding page views of this revision, or
     * `null` where nothing attests one — including every revision with no door
     * row at all.
     */
    readonly foldedAt: string | null;
    /** Counters naming nodes this revision does not contain. */
    readonly orphaned: number;
    /** Node counters and door rows handed in more than once, added. */
    readonly doubled: number;
    /**
     * Parts that reported nothing while a part inside them reported being
     * reached, which is what `parts-unreporting` is raised on.
     */
    readonly unreporting: number;
};

CollectionHealthtype

What a deployment is collecting, and what is wrong with it.

type CollectionHealth = {
    /** Every revision read, by tree id and newest revision first. */
    readonly pages: readonly PageHealth[];
    /**
     * Faulted revisions the door can price, worst first.
     */
    readonly faulted: readonly PageHealth[];
    /**
     * Faulted revisions with no exact arrival count, by tree id and newest
     * revision first.
     */
    readonly unpriced: readonly PageHealth[];
    /** The faulted page costing the most readers, which is the one to look at first. */
    readonly worst: PageHealth | null;
    readonly standings: Readonly<Record<HealthStanding, number>>;
    /**
     * How many revisions carry each fault.
     */
    readonly faults: Readonly<Record<CollectionFault, number>>;
    /**
     * Page views at the door of every faulted revision the door can price, added
     * — each revision once however many faults it has.
     */
    readonly readersAffected: number;
    /**
     * Page views at the door across every revision read, added.
     */
    readonly arrivals: number;
    /**
     * Openings no rollup has folded, added across the revisions read.
     */
    readonly pending: number;
    /**
     * Revisions with openings waiting and no fold timestamp to judge the wait by.
     */
    readonly unattested: number;
    /**
     * Distinct trees across the revisions read, which is not the number of pages.
     */
    readonly trees: number;
    /**
     * Readings of a revision beyond the first, which were dropped.
     */
    readonly duplicated: number;
};

collectionHealthOffunction

What a deployment is collecting, read off the page readings and the door rows it already has.

const collectionHealthOf: (readings: readonly PageReading[], rows: readonly StoredPageViews[], schedule?: CollectionSchedule) => CollectionHealth

Ingest

signals/ingest

The doorway a browser's batches come through.

MAX_BATCHES_PER_DELIVERYvalue

How many batches one delivery may carry.

const MAX_BATCHES_PER_DELIVERY = 50

IngestOutcometype

type IngestOutcome = {
    readonly batches: number;
    readonly signals: number;
    /**
     * Page views this delivery opened, which is what the exact counter moved by.
     */
    readonly opened: number;
    /**
     * Page views counted against a region, which is zero unless the caller said
     * where the delivery came from and the delivery opened a page view.
     */
    readonly regions: number;
    /**
     * Why a counter did not move, when a store refused it.
     */
    readonly openingError?: ReaderSignalStoreError;
    readonly regionError?: ReaderSignalStoreError;
};

RegionCountertype

Where a delivery came from, and the buckets to count it in.

type RegionCounter = {
    readonly store: ReaderRegionStore;
    readonly region: ReaderRegion;
};

DoorCounterstype

What this delivery is counted into, besides being buffered.

type DoorCounters = {
    /** When, as an instant every counter this delivery moves is stamped with. The caller's clock. */
    readonly at: string;
    /** Where the delivery came from. Absent on a deployment that does not count regions. */
    readonly region?: RegionCounter;
    /**
     * How many page views began. No switch guards it where it is wired, because a
     * count of page views of a revision names nowhere and nobody — it is the
     * denominator everything else is a rate against.
     */
    readonly openings?: ReaderOpeningCounter;
};

IngestErrortype

type IngestError = {
    readonly code: "invalid-delivery";
    /** Which batch of the delivery, so a sender with one bad batch can be told which. */
    readonly index: number;
    readonly issues: ReaderSignalParseError["issues"];
} | {
    readonly code: "too-many";
    readonly limit: number;
    readonly given: number;
} | ReaderSignalStoreError;

describeIngestErrorfunction

const describeIngestError: (error: IngestError) => string

ingestReaderSignalsfunction

Parse a delivery and keep it.

const ingestReaderSignals: (journal: ReaderSignalJournal, input: unknown, counters?: DoorCounters) => Promise<Result<IngestOutcome, IngestError>>

Inside

signals/inside

**What readers did inside each part of a page, over a range.**

InsideParttype

One part of the page, what readers did to it, and what they did inside it.

type InsidePart = {
    readonly nodeId: NodeId;
    readonly type: PrimitiveType;
    /** What part it plays, or `null` where its type declared none. */
    readonly role: PrimitiveRole | null;
    /** Depth in the tree, counting every node; 0 at the root. */
    readonly depth: number;
    /**
     * The nearest **addressed** ancestor, which is what `within` names,
     * and `null` at the outermost part.
     */
    readonly withinId: NodeId | null;
    /** What readers did to this part itself, in the range. */
    readonly own: ActedCounts;
    /**
     * What readers did to this part and to every part inside it, in the range.
     */
    readonly inside: ActedCounts;
    /** Addressed nodes in its subtree, itself included — so 1 for a part with no parts in it. */
    readonly parts: number;
    /**
     * The words this part says itself: its declared copy props, and the text
     * handed to it directly or through a slot.
     */
    readonly copy: NodeCopy;
};

InsideReadingtype

What a range of the hourly counter says about the shape of one revision of one page.

type InsideReading = {
    readonly treeId: TreeId;
    readonly revision: number;
    readonly range: ArrivalRange;
    /** Every addressed node, in reading order, so a row is always preceded by the row it is inside. */
    readonly parts: readonly InsidePart[];
    /**
     * Everything readers did on this page in the range.
     */
    readonly total: ActedCounts;
    /**
     * Every audience whose rows were summed into this reading.
     */
    readonly audiences: readonly AudienceId[];
    /** Rows summed into the reading. */
    readonly counted: number;
    /**
     * Rows filed under another tree or another revision, and ignored.
     */
    readonly foreign: number;
    /**
     * Rows of this tree and revision whose hour falls outside the range, and
     * ignored.
     */
    readonly outside: number;
    /**
     * Nodes named by a row this revision does not contain.
     */
    readonly orphaned: readonly NodeId[];
    /**
     * The first hour this scope ever counted an action in, carried through from
     * the store.
     */
    readonly begins?: number;
};

insideReadingOffunction

Join a range of the hourly counter to the tree and registry it was filed against, and read it as the page's own shape.

const insideReadingOf: (tree: LoomTree, stored: StoredActed, declarations: PartDeclarations, range: ArrivalRange) => InsideReading

actedMostInfunction

The parts readers acted on most in the range, most first.

const actedMostIn: (reading: InsideReading, kind: ActedKind, limit?: number) => readonly InsidePart[]

insideShareInfunction

The share of everything readers did on the page, in one kind, that happened inside one part — between 0 and 1.

const insideShareIn: (reading: InsideReading, part: InsidePart, kind: ActedKind) => number | null

beneathOffunction

What readers did inside a part but not to the part itself.

const beneathOf: (part: InsidePart, kind: ActedKind) => number

Intake

signals/intake

Who may post a batch, and how often.

CROWDED_SUBJECTvalue

A subject the gate could not make room for.

const CROWDED_SUBJECT = "crowded"

IntakePolicytype

type IntakePolicy = {
    /** The largest delivery the door will read, in bytes. */
    readonly maxBytes: number;
    /** Deliveries one subject may make inside a window. */
    readonly deliveries: number;
    readonly windowMs: number;
    /** How many subjects the counter distinguishes before {@link CROWDED_SUBJECT}. */
    readonly subjects: number;
};

DEFAULT_INTAKE_POLICYvalue

sendBeacon is specified to refuse a body over 64 KB, so a delivery larger than that did not come from a beacon — which makes the ceiling a statement about the sender rather than a number somebody liked. fetch has no such limit and the fallback path is held to the same one deliberately.

const DEFAULT_INTAKE_POLICY: IntakePolicy

IntakeCounttype

What the gate remembers about one subject: a fixed window and a count inside it. Two numbers and no identity, for AttemptRecord's reason.

type IntakeCount = {
    readonly deliveries: number;
    readonly windowStartedAt: number;
};

IntakeVerdicttype

too-large carries the count as admitted does, because it spent one: a caller whose body was refused has still had their delivery read far enough to refuse it. too-often carries none — the count that refused them is already what there is to remember.

type IntakeVerdict = {
    readonly code: "admitted";
    readonly count: IntakeCount;
} | {
    readonly code: "too-large";
    readonly count: IntakeCount;
    readonly limit: number;
    readonly given: number;
} | {
    readonly code: "too-often";
    readonly limit: number;
    readonly retryAfterMs: number;
};

describeIntakeVerdictfunction

const describeIntakeVerdict: (verdict: IntakeVerdict) => string

admitfunction

Whether this delivery is allowed, given what the subject has already sent.

const admit: (count: IntakeCount | null, bytes: number, now: number, policy: IntakePolicy) => IntakeVerdict

IntakeGatetype

type IntakeGate = {
    /**
     * The policy this gate counts by.
     */
    readonly policy: IntakePolicy;
    readonly admit: (subject: string, bytes: number, now: number) => IntakeVerdict;
    /** How many subjects are being counted. For a status endpoint, not for a decision. */
    readonly subjects: () => number;
};

createIntakeGatefunction

The counter that admit decides against.

const createIntakeGate: (policy?: IntakePolicy) => IntakeGate

Join

signals/join

The two rules both joins of a window to a tree have to get the same answer to, spelled once.

RoleDeclarationstype

Which types declared each role, as a registry answers it.

type RoleDeclarations = {
    readonly typesWithRole: (role: PrimitiveRole) => readonly PrimitiveType[];
};

Journal

signals/journal

Where deliveries wait to be rolled up, and then where they are kept.

ReaderSignalStoreErrortype

The only way it fails. No not-found — reading a tree nothing has been received about is an empty page, because a buffer makes no claim that a tree exists. No conflict — receiving a batch cannot collide with another batch.

type ReaderSignalStoreError = {
    readonly code: "unavailable";
    readonly detail: string;
};

describeReaderSignalStoreErrorfunction

const describeReaderSignalStoreError: (error: ReaderSignalStoreError) => string

ReceivedBatchtype

A batch as it comes back out, with the position the buffer gave it.

type ReceivedBatch = ReaderSignalBatch & {
    readonly seq: number;
    readonly receivedAt: string;
    /**
     * The audience it was **filed** under, which is resolved rather than
     * optional.
     */
    readonly audienceId: AudienceId;
    /**
     * When a fold counted this delivery into the counters, where one has.
     */
    readonly foldedAt?: string;
};

ReaderSignalReadRequesttype

type ReaderSignalReadRequest = {
    /** Absent reads every tree the handle can see, which is the scope rule. */
    readonly treeId?: TreeId;
    /**
     * Narrow to rows the fold has counted, or to rows it has not.
     */
    readonly counted?: boolean;
    /**
     * Narrow to the deliveries of **one page view**, named by its key.
     */
    readonly view?: ViewKey;
    /** A cursor from a previous page's `older`/`newer`, passed back unread. */
    readonly cursor?: string;
    /** Default `newer`, which with no cursor is the oldest page — where rollup starts. */
    readonly direction?: PageDirection;
    readonly limit?: number;
};

ReaderSignalPagetype

type ReaderSignalPage = PageEnds & {
    /** Always ascending by `seq`, whichever end the page was taken from. */
    readonly batches: readonly ReceivedBatch[];
};

DEFAULT_READER_SIGNAL_LIMITvalue

Larger than a telemetry page, because these are read only to be folded and a batch is small. Rollup walks the whole window, so the page size is purely how much of it is in memory at once.

const DEFAULT_READER_SIGNAL_LIMIT = 500

MAX_READER_SIGNAL_LIMITvalue

const MAX_READER_SIGNAL_LIMIT = 2000

clampReaderSignalLimitfunction

const clampReaderSignalLimit: (limit: number | undefined) => number

ForgetBeforetype

What the buffer is asked to forget, as a position rather than a rule.

type ForgetBefore = {
    readonly before: number;
};

ForgetOutcometype

type ForgetOutcome = {
    readonly removed: number;
};

CountedBeforetype

What the fold is asked to stamp, as a position and the instant to write.

type CountedBefore = {
    readonly before: number;
    readonly at: string;
};

CountedOutcometype

type CountedOutcome = {
    /**
     * Rows this call stamped.
     */
    readonly counted: number;
};

ReaderSignalJournalinterface

Four operations: the journal's three, and the stamp the kept window asked for.

Shown in use on What your readers do — Where a batch goes after that

interface ReaderSignalJournal {
    readonly receive: (batches: readonly ReaderSignalBatch[]) => Promise<Result<void, ReaderSignalStoreError>>;
    readonly read: (request?: ReaderSignalReadRequest) => Promise<Result<ReaderSignalPage, ReaderSignalStoreError>>;
    /**
     * Record that a fold counted every row below a position.
     */
    readonly counted: (request: CountedBefore) => Promise<Result<CountedOutcome, ReaderSignalStoreError>>;
    readonly forget: (request: ForgetBefore) => Promise<Result<ForgetOutcome, ReaderSignalStoreError>>;
}

Kinds

signals/kinds

The five kinds of reader signal, with nothing else in the module.

READER_SIGNAL_KINDSvalue

const READER_SIGNAL_KINDS: readonly ["viewed", "dwelled", "activated", "disclosed", "completed"]

DELEGATED_READER_SIGNAL_KINDSvalue

The kinds whose node is not the thing a reader aimed at.

const DELEGATED_READER_SIGNAL_KINDS: readonly ["activated", "disclosed", "completed"]

Library

signals/library

Whether a *kind* of part gets read, across every page it is on.

KindSilencetype

Why a kind's read share is not there.

type KindSilence =
/**
 * No placement of it has a verdict: every page it stands on held no views, or
 * reported something other than a view of it.
 */
"unread"
/**
 * Nothing in the pages read is of this kind at all.
 */
 | "unplaced";

KIND_SILENCESvalue

const KIND_SILENCES: readonly KindSilence[]

describeKindSilencefunction

One line per silence, for a surface saying why a kind has no share.

const describeKindSilence: (silence: KindSilence) => string

KindKeytype

What a row is a census of: one primitive type, or one role, across the pages read.

type KindKey = {
    readonly by: "type";
    readonly type: PrimitiveType;
}
/** `null` is the row for parts whose type declared no role, which is most of a library today. */
 | {
    readonly by: "role";
    readonly role: PrimitiveRole | null;
};

kindKeyOffunction

A key as a string, for a surface keying a list and for this module's own grouping.

const kindKeyOf: (kind: KindKey) => string

KindReadingtype

One kind of part, everywhere it stands in the pages read.

type KindReading = {
    readonly kind: KindKey;
    /** What part a type plays, or `null`. Always `null` on a role row, which carries it as its key. */
    readonly role: PrimitiveRole | null;
    /** Element nodes of this kind across the readings. */
    readonly placements: number;
    /** Distinct trees it stands in, which is not the number of placements and not the number of readings. */
    readonly trees: number;
    /** Distinct revisions it stands in: two live revisions of one page are two. */
    readonly revisions: number;
    /** Placements by standing. The three add to {@link placements}. */
    readonly standings: Readonly<Record<PartStanding, number>>;
    /**
     * The share of its placements at least one reader reached. `null` where
     * {@link silence} says why not.
     */
    readonly readShare: number | null;
    /**
     * Why {@link readShare} is not there, and `null` where it is.
     */
    readonly silence: KindSilence | null;
    /**
     * Every word this kind says across its placements, counted once.
     */
    readonly words: number;
    /** Words said by a placement at least one reader reached. */
    readonly wordsReached: number;
    /**
     * {@link wordsReached} over {@link words}; `null` where this kind says nothing
     * at all, which a spacer, a rule and a stack that only holds other parts all
     * do.
     */
    readonly wordShare: number | null;
    /**
     * Placements whose words are a floor, because the type declares no `copy`
     *.
     */
    readonly floored: number;
    /**
     * Time on screen across its placements, added.
     */
    readonly dwellMs: number;
    /** Presses, filed against the part the reader used, so no press is in two rows. */
    readonly activations: number;
    readonly opens: number;
    readonly closes: number;
    /** Forms this kind of part let go. */
    readonly completions: number;
};

LibraryReadingtype

What a deployment's library does for its readers, by kind of part.

type LibraryReading = {
    /**
     * Every type that stands anywhere, most placements skipped first.
     */
    readonly byType: readonly KindReading[];
    /**
     * Every role in the vocabulary that stands anywhere, then the row for parts
     * whose type declared none, in the same order as {@link byType}.
     */
    readonly byRole: readonly KindReading[];
    /** Readings counted, which is revisions of pages and not trees. */
    readonly pages: number;
    /** Distinct trees across them. */
    readonly trees: number;
    /** Element nodes across them, which is the sum of every type row's placements. */
    readonly placements: number;
    /** Placements by standing, over the whole library. */
    readonly standings: Readonly<Record<PartStanding, number>>;
    /**
     * The type skipped in the most places, which is the kind to look at first.
     */
    readonly mostSkipped: KindReading | null;
    /** The type used most, by presses. A count of things that happened, not of readers. */
    readonly mostUsed: KindReading | null;
    /**
     * Readings of a revision beyond the first, which were dropped.
     */
    readonly duplicated: number;
    /**
     * Types whose readings disagreed about the role they play, where the first
     * reading's answer stands.
     */
    readonly roleDisagreed: readonly PrimitiveType[];
};

libraryReadingOffunction

Whether a kind of part gets read, across every page it stands on.

const libraryReadingOf: (readings: readonly PageReading[]) => LibraryReading

Library action

signals/library-action

Of the readers who met a kind of part, the share that did something inside it.

KindActionSilencetype

Why a kind has no share of the readers who acted inside it.

type KindActionSilence = KindReachSilence
/**
 * No place this kind stands has anything inside it.
 */
 | "unenterable"
/**
 * A page that contributed readers holds actions and credits them to nobody.
 */
 | "unwalked";

KIND_ACTION_SILENCESvalue

const KIND_ACTION_SILENCES: readonly KindActionSilence[]

describeKindActionSilencefunction

One line per silence, for a surface saying why a kind has no share of its readers' actions.

const describeKindActionSilence: (silence: KindActionSilence) => string

KindActiontype

One kind of part, against what the readers who met it did inside it.

type KindAction = {
    readonly kind: KindKey;
    /** What part a type plays, or `null`. Always `null` on a role row, which carries it as its key. */
    readonly role: PrimitiveRole | null;
    /** Element nodes of this kind across the readings, as the census counts them. */
    readonly placements: number;
    /**
     * Placements that bear element parts, which are the ones the question exists
     * for.
     */
    readonly insides: number;
    /**
     * Placements with no element part under them, which are in no term here.
     */
    readonly leaves: number;
    /** Placements bearing parts that a window could speak for. */
    readonly verdicts: number;
    /** Placements bearing parts that no row named, and therefore excluded. */
    readonly unknown: number;
    /**
     * Placements with a verdict that no reader reached.
     */
    readonly unmet: number;
    /**
     * Placements at the root of their page.
     */
    readonly roots: number;
    /**
     * Placements by the standing a page's own reading gives them, over
     * **every** placement including the leaves.
     */
    readonly standings: Readonly<Record<ActionStanding, number>>;
    /** Revisions bearing a placement with an inside and a verdict. */
    readonly pages: number;
    /**
     * Of those, the pages that contributed reach — the weights that actually
     * decide the share.
     */
    readonly weighed: number;
    /**
     * Page views that reached an enterable place of this kind, at the door's
     * scale: `reached × min(appearances, opened) ÷ appearances`, added over the
     * bearing placements.
     */
    readonly met: number | null;
    /** The same page views whose reader acted inside the place, at the same scale. */
    readonly acted: number | null;
    /** `met − acted`: the page views that met an enterable place and did nothing in it. */
    readonly ignored: number | null;
    /**
     * `acted ÷ met` — the share of the readers who met it that did something
     * inside it.
     */
    readonly share: number | null;
    /**
     * Whether {@link met} and {@link acted} are on the door's scale, which is the
     * only scale two rows' counts may be compared on.
     */
    readonly onDoorScale: boolean;
    /**
     * Appearances in excess of openings across the weighing pages, added **once
     * per page** rather than once per placement.
     */
    readonly drift: number;
    /**
     * Openings across the weighing pages whose reading no rollup has folded yet.
     */
    readonly pending: number;
    /**
     * No opening is waiting to be folded and nothing is unreconciled, so the
     * weights are final.
     */
    readonly settled: boolean;
    /**
     * Placements crediting more readers with acting inside them than reached them,
     * which no rollup produces.
     */
    readonly unreconciled: number;
    readonly silence: KindActionSilence | null;
};

LibraryActiontype

What a deployment's library gets its readers to do, by kind of part.

type LibraryAction = {
    /**
     * Every type that stands anywhere, most readers ignored first.
     */
    readonly byType: readonly KindAction[];
    /** Every role in the vocabulary, then the row for parts whose type declared none, in the same order. */
    readonly byRole: readonly KindAction[];
    /** Readings counted, which is revisions of pages and not trees. */
    readonly pages: number;
    /** Distinct trees across them. */
    readonly trees: number;
    /** Element nodes across them, which is the sum of every type row's placements. */
    readonly placements: number;
    /** Of those, the ones bearing element parts. */
    readonly insides: number;
    /** Of those, the ones with nothing inside them. `placements = insides + leaves`. */
    readonly leaves: number;
    /**
     * Page views counted at the door across the pages read, added **once per
     * page**.
     */
    readonly arrivals: number;
    /** Placements by standing, over the whole library. */
    readonly standings: Readonly<Record<ActionStanding, number>>;
    /**
     * The type the most readers met and did nothing inside, which is the kind to
     * look at first.
     */
    readonly mostIgnored: KindAction | null;
    /**
     * Type rows with a share and no count, which the ranking above cannot
     * include.
     */
    readonly unranked: number;
    /** Pages the door could scale, which is where every count here comes from. */
    readonly scaled: number;
    /**
     * The pages bearing a measured placement that the door could not scale, by
     * tree and newest revision first, with the reason in the vocabulary a page's
     * own reading publishes.
     */
    readonly unscaled: readonly UnscaledPage[];
    /**
     * The pages holding actions that credit nobody, by tree and newest revision
     * first.
     */
    readonly unwalked: readonly RevisionOf[];
    /**
     * Readings of a revision beyond the first, which were dropped.
     */
    readonly duplicated: number;
    /**
     * Door rows for one revision beyond the first, which were ignored.
     */
    readonly duplicatedRows: number;
    /**
     * Types whose readings disagreed about the role they play, where the first
     * reading's answer stands.
     */
    readonly roleDisagreed: readonly PrimitiveType[];
};

libraryActionOffunction

What a deployment's library gets its readers to do, by kind of part.

const libraryActionOf: (readings: readonly PageReading[], rows: readonly StoredPageViews[]) => LibraryAction

Library agenda

signals/library-agenda

**Which component to fix first, and whether the figure that says so is the component's own.**

LibraryWorktype

What the next thing to do about one component is.

type LibraryWork =
/**
 * Rewrite the component: the order of readers missed ranked it, and nothing
 * about its senders reaches the figure that put it there.
 */
"library"
/**
 * Repair its sender: copies of it are silent, and either the order of readers
 * missed did not rank it or its own silence made the figure it was ranked by.
 */
 | "collection"
/**
 * Both, and in that order.
 */
 | "both"
/**
 * Neither reading asks for anything: readers reach it wherever it stands and
 * every copy of it that could be checked reported itself.
 */
 | "none";

LIBRARY_WORKvalue

const LIBRARY_WORK: readonly LibraryWork[]

describeLibraryWorkfunction

One line per member, for a surface saying what a row is asking for.

const describeLibraryWork: (work: LibraryWork) => string

spoilsTheReachfunction

Whether a kind's senders reach the key the order of readers missed ranked it by.

const spoilsTheReach: (senders: KindSenderReach) => boolean

LibraryAgendaRowtype

One kind of part, as both readings have it, with the errand it adds up to.

type LibraryAgendaRow = {
    readonly kind: KindKey;
    /** What part the type plays, or `null`. Always a type key here, never a role. */
    readonly role: PrimitiveRole | null;
    readonly work: LibraryWork;
    /**
     * The order of readers missed ranked it, and its own silence is what made the
     * figure.
     */
    readonly spoiled: boolean;
    /** What the readers who met it did, as `libraryReachOf` answered it. */
    readonly reach: KindReach;
    /** What its silence cost those readers, as `librarySendersReachOf` answered it. */
    readonly senders: KindSenderReach;
};

LibraryAgendatype

What a deployment should do about its components, out of the two orders over them.

type LibraryAgenda = {
    /** Every type both readings named, by type, so a surface can key a table on it. */
    readonly rows: readonly LibraryAgendaRow[];
    /**
     * Components to rewrite, most readers missed first, in the order of readers
     * missed's **own** order.
     */
    readonly library: readonly LibraryAgendaRow[];
    /**
     * Components whose senders to repair, most readings lost first, in the order
     * of silence's **own** order.
     */
    readonly collection: readonly LibraryAgendaRow[];
    /**
     * The components taken out of the order of readers missed, carrying the whole
     * row that order gave them.
     */
    readonly contested: readonly LibraryAgendaRow[];
    /**
     * The one thing to do first, or `null` where neither reading asks for
     * anything.
     */
    readonly first: LibraryAgendaRow | null;
    /** How many components each errand falls to, over {@link rows}. */
    readonly work: Readonly<Record<LibraryWork, number>>;
    /**
     * Types one reading named and the other did not, which is nought for a caller
     * that read one window and the alarm for one that did not.
     */
    readonly unpaired: {
        readonly reach: number;
        readonly senders: number;
    };
    /** Rows for a type beyond the first, on either side, which were dropped. */
    readonly duplicated: number;
};

libraryAgendaOffunction

Join the order of readers a library's components miss to the order of what their silence costs, and publish the errands that come out.

const libraryAgendaOf: (reach: LibraryReach, senders: LibrarySendersReach) => LibraryAgenda

Library agenda change

signals/library-agenda-change

**Whether a deployment's component fix-list moved, and which of its errands a release can be said to have finished.**

LibraryAgendaSidetype

Which of the two windows could not speak about a component.

type LibraryAgendaSide = "earlier" | "later" | "both";

LIBRARY_AGENDA_SIDESvalue

const LIBRARY_AGENDA_SIDES: readonly LibraryAgendaSide[]

describeLibraryAgendaSidefunction

One line per side, for a surface saying which window is missing.

const describeLibraryAgendaSide: (side: LibraryAgendaSide) => string

LibraryAgendaShifttype

What became of one component's errand between two windows.

type LibraryAgendaShift =
/**
 * It asked for work in the earlier window and asks for none now.
 */
"done"
/** It asked for nothing in the earlier window and asks for work now. */
 | "arrived"
/**
 * It asks for work in both windows and it is different work.
 */
 | "turned"
/** It asks for the same work in both windows. */
 | "standing"
/** Neither window asked for anything about it, and both windows could speak. */
 | "clear"
/**
 * One of the two windows could not speak about it, so there is no before and
 * after to read.
 */
 | "unknown";

LIBRARY_AGENDA_SHIFTSvalue

const LIBRARY_AGENDA_SHIFTS: readonly LibraryAgendaShift[]

describeLibraryAgendaShiftfunction

One line per member, for a surface saying what became of a component's errand.

const describeLibraryAgendaShift: (shift: LibraryAgendaShift) => string

LibraryAgendaChangeRowtype

One kind of part's errand, held against itself across two windows.

type LibraryAgendaChangeRow = {
    readonly kind: KindKey;
    /**
     * What part the type plays, or `null`.
     */
    readonly role: PrimitiveRole | null;
    readonly shift: LibraryAgendaShift;
    /** The errand the earlier window published, whatever this reading says about progress. */
    readonly was: LibraryWork;
    /** The errand the later window publishes. */
    readonly now: LibraryWork;
    /** True where either window's rank was made by the component's own silent copies. */
    readonly contested: boolean;
    readonly spoiledWas: boolean;
    readonly spoiledNow: boolean;
    /**
     * Why there is no before and after, in **the reach reading's own vocabulary**
     * rather than a second spelling of it.
     */
    readonly silence: KindReachSilence | null;
    /** Which window could not speak, or `null` where both could. */
    readonly silenced: LibraryAgendaSide | null;
    /** The earlier agenda's whole row, so a surface never holds two lists side by side. */
    readonly earlier: LibraryAgendaRow;
    /** The later agenda's whole row. */
    readonly later: LibraryAgendaRow;
};

LibraryAgendaHeadtype

Where the one thing to do first stood in each window.

type LibraryAgendaHead = {
    /** The component at the head of the earlier agenda, or `null` where it asked for nothing. */
    readonly earlier: KindKey | null;
    readonly later: KindKey | null;
    /**
     * Whether it is the same component, two `null`s included.
     */
    readonly same: boolean;
};

LibraryAgendaChangetype

What two windows of a deployment's component fix-list say about each other.

type LibraryAgendaChange = {
    /** Every component on both agendas, by type, in the later agenda's own row order. */
    readonly rows: readonly LibraryAgendaChangeRow[];
    /**
     * Components that asked for work and ask for none now, in the **earlier**
     * agenda's own orders — readers missed first, then readings lost — each
     * component once.
     */
    readonly done: readonly LibraryAgendaChangeRow[];
    /** Components that ask for work now and asked for none, in the **later** agenda's own orders. */
    readonly arrived: readonly LibraryAgendaChangeRow[];
    /**
     * Components asking for work in both windows, in the later agenda's own
     * orders.
     */
    readonly outstanding: readonly LibraryAgendaChangeRow[];
    /**
     * Rows whose shift this reading will not call progress, carrying both
     * windows' errands.
     */
    readonly withheld: readonly LibraryAgendaChangeRow[];
    /**
     * Rows where either window's rank was its own silence's doing.
     */
    readonly contested: readonly LibraryAgendaChangeRow[];
    /** How many components each shift covers, over {@link rows}. */
    readonly shifts: Readonly<Record<LibraryAgendaShift, number>>;
    /** Where the one thing to do first stood in each window. */
    readonly head: LibraryAgendaHead;
    /**
     * Components one agenda named and the other did not, which is nought for a
     * caller that read two windows of the same deployment.
     */
    readonly unpaired: {
        readonly earlier: number;
        readonly later: number;
    };
    /** Rows for a component beyond the first, on either side, which were dropped. */
    readonly duplicated: number;
};

libraryAgendaChangeOffunction

Hold a deployment's component fix-list against an earlier reading of it, and publish what became of each errand.

const libraryAgendaChangeOf: (earlier: LibraryAgenda, later: LibraryAgenda) => LibraryAgendaChange

Library change

signals/library-change

What a change did to a kind of part, everywhere it stands.

KindChangeSilencetype

Why a kind of part has no before and after.

type KindChangeSilence =
/**
 * It stands in both windows, and no place of it can be spoken for on both
 * sides.
 */
"unread"
/**
 * Nothing in the pages read, on either side, is of this kind.
 */
 | "unplaced"
/**
 * It stands in both windows and in no place that is in both.
 */
 | "unpaired";

KIND_CHANGE_SILENCESvalue

const KIND_CHANGE_SILENCES: readonly KindChangeSilence[]

describeKindChangeSilencefunction

One line per silence, for a surface saying why a kind has no before and after.

const describeKindChangeSilence: (silence: KindChangeSilence) => string

KindMovementtype

What happened to a kind of part between the two windows.

type KindMovement =
/** More places of it are read now than were, which is the sentence a change to a primitive is made for. */
"taken-up"
/** Fewer are. */
 | "abandoned"
/**
 * Exactly as many are, which includes places trading places: two taken up and
 * two fallen away is `held`, and the two counts are published so that a
 * surface can say so.
 */
 | "held"
/**
 * No place of it was read in either window.
 */
 | "still-unread"
/** {@link KindChange.silence} says why nothing can be said. */
 | "unknown";

KIND_MOVEMENTSvalue

const KIND_MOVEMENTS: readonly KindMovement[]

describeKindMovementfunction

One line per movement, for a surface putting a kind's before and after in front of a person.

const describeKindMovement: (movement: KindMovement) => string

KindChangetype

One kind of part, held against itself across two windows.

type KindChange = {
    readonly kind: KindKey;
    /**
     * What part a type plays, or `null`. Always `null` on a role row, which
     * carries it as its key.
     */
    readonly role: PrimitiveRole | null;
    /** Places of this kind that stand in both windows: the same node of the same page, of this kind on both sides. */
    readonly places: number;
    /** Places of it in the later window with no counterpart in the earlier one. */
    readonly gained: number;
    /** Places of it in the earlier window with no counterpart in the later one. */
    readonly lost: number;
    /**
     * Of {@link places}, those with a verdict on **both** sides, which is the
     * denominator of both shares.
     */
    readonly comparable: number;
    /** Comparable places skipped in the earlier window and read in the later one. */
    readonly tookUp: number;
    /** Comparable places read in the earlier window and skipped in the later one. */
    readonly fellAway: number;
    /** Comparable places read in both. */
    readonly keptRead: number;
    /** Comparable places skipped in both. */
    readonly keptSkipped: number;
    /**
     * The share of {@link comparable} places that was read in the earlier window;
     * `null` where {@link silence} says why not.
     */
    readonly readShareWas: number | null;
    /** The same share in the later window, over the same places. */
    readonly readShareNow: number | null;
    readonly movement: KindMovement;
    /**
     * Why the two shares are not there, and `null` where they are.
     */
    readonly silence: KindChangeSilence | null;
};

LibraryChangetype

What a change did to a deployment's library, by kind of part.

type LibraryChange = {
    /**
     * Every type that stands in either window, most places fallen away first.
     */
    readonly byType: readonly KindChange[];
    /**
     * Every role in the vocabulary that stands in either window, then the row for
     * parts whose type declared none, in the same order as {@link byType}.
     */
    readonly byRole: readonly KindChange[];
    /** Forms read in both windows: a page in one of its forms, never a revision. */
    readonly pages: number;
    /** Forms read in the later window only, which is not pages published. */
    readonly pagesGained: number;
    /** Of {@link pagesGained}, forms whose page the earlier window already held. */
    readonly formsGained: number;
    /** Forms read in the earlier window only, which is not pages withdrawn. */
    readonly pagesLost: number;
    /** Of {@link pagesLost}, forms whose page the later window still holds. */
    readonly formsLost: number;
    /** The audiences each window's forms named, published and never refused. */
    readonly audiences: ComparedPopulations;
    /**
     * Paired pages whose revision moved between the windows.
     */
    readonly republished: number;
    /** Places that stand in both windows, which is the sum of every type row's {@link KindChange.places}. */
    readonly placements: number;
    /** Places in the later window only. */
    readonly gained: number;
    /** Places in the earlier window only. */
    readonly lost: number;
    /**
     * Paired nodes whose primitive type changed.
     */
    readonly recast: number;
    /**
     * A floor on the page views of the earlier window, added over the paired
     * pages.
     */
    readonly viewsWas: number;
    /** The same floor for the later window, over the same pages. */
    readonly viewsNow: number;
    /**
     * The type that lost its reading in the most places, which is the kind to look
     * at first.
     */
    readonly mostAbandoned: KindChange | null;
    /** The type that gained its reading in the most places, by the same rule. */
    readonly mostTakenUp: KindChange | null;
    /**
     * Forms read at two revisions in one window, which are in nothing above.
     */
    readonly ambiguous: readonly PageForm[];
    /**
     * Readings of a revision beyond the first, on either side, which were dropped.
     */
    readonly duplicated: number;
    /**
     * Types the two windows disagree about the role of, where the later window's
     * answer stands.
     */
    readonly roleDisagreed: readonly PrimitiveType[];
};

PairedWindowtype

One window's pages, by tree, with the two ways a window can hold a page twice counted apart.

type PairedWindow = {
    /**
     * The window's readings, one per form, keyed by the published form rule.
     */
    readonly byForm: ReadonlyMap<string, PageReading>;
    /**
     * Forms held at two revisions, which have no single counterpart in the other
     * window.
     */
    readonly ambiguous: ReadonlyMap<string, PageForm>;
    /** The same revision of the same form handed in again. */
    readonly duplicated: number;
    /**
     * The audiences this window's forms named, in a stable order.
     */
    readonly audiences: readonly AudienceId[];
    /**
     * The pages behind this window's forms, which two forms of one page share.
     */
    readonly pagesHeld: ReadonlySet<TreeId>;
};

pairedWindowOffunction

One window's readings keyed by page in its form, with a form held at two revisions kept apart from the same revision handed in twice.

const pairedWindowOf: (readings: readonly PageReading[]) => PairedWindow

partsByNodeInfunction

One reading's parts by node, which is what a placement is paired on.

const partsByNodeIn: (reading: PageReading) => ReadonlyMap<NodeId, PartReading>

libraryChangeOffunction

What a change did to a kind of part, across every page it stands on.

const libraryChangeOf: (was: readonly PageReading[], now: readonly PageReading[]) => LibraryChange

Library copy change

signals/library-copy-change

What a change did to the words a kind of part says, everywhere it stands.

KindCopyChangeSilencetype

Why a kind of part has no before and after of its words.

type KindCopyChangeSilence =
/**
 * Nothing in the pages read, in either window, is of this kind.
 */
"unplaced"
/**
 * It stands in both windows and no place of it kept a word.
 */
 | "unpaired"
/**
 * The places it keeps say nothing that could have been read.
 */
 | "wordless"
/**
 * It keeps words and none of them can be spoken for on both sides.
 */
 | "unread"
/**
 * Some of its carried words are a floor, so the signed movement could have
 * the wrong sign.
 */
 | "floored";

KIND_COPY_CHANGE_SILENCESvalue

const KIND_COPY_CHANGE_SILENCES: readonly KindCopyChangeSilence[]

describeKindCopyChangeSilencefunction

One line per silence, for a surface saying why a kind has no before and after.

const describeKindCopyChangeSilence: (silence: KindCopyChangeSilence) => string

KindWordMovementtype

What happened to the reading of the words a kind of part kept.

type KindWordMovement =
/** More of the words it kept are read now than were. */
"taken-up"
/** Fewer are. */
 | "abandoned"
/**
 * As many are, which includes words trading places: a passage taken up and
 * another of the same length fallen away is `held`, and both masses are
 * published so a surface can say so.
 */
 | "held"
/**
 * No word it kept was read in either window.
 */
 | "still-unread"
/** {@link KindCopyChange.silence} says why nothing can be said. */
 | "unknown";

KIND_WORD_MOVEMENTSvalue

const KIND_WORD_MOVEMENTS: readonly KindWordMovement[]

describeKindWordMovementfunction

One line per movement, for a surface putting a kind's words in front of a person.

const describeKindWordMovement: (movement: KindWordMovement) => string

CarriedWordstype

The words two windows say identically, and what happened to the reading of them.

type CarriedWords = {
    /**
     * Words both windows say, word for word, in the places both windows bear.
     */
    readonly carried: number;
    /**
     * Of {@link carried}, the words with a verdict on **both** sides, which is
     * the denominator of both shares.
     */
    readonly comparable: number;
    /**
     * Carried words one window or the other cannot be spoken for.
     */
    readonly unspoken: number;
    /** Comparable words read in both windows. */
    readonly keptRead: number;
    /** Comparable words read in neither — the words a change did not fix. */
    readonly keptSkipped: number;
    /** Comparable words nobody reached before and somebody reaches now. */
    readonly tookUp: number;
    /** Comparable words somebody reached before and nobody reaches now. */
    readonly fellAway: number;
    /**
     * The share of {@link comparable} words that was read in the earlier window;
     * `null` where there are none.
     */
    readonly readShareWas: number | null;
    /** The same share in the later window, over the same words. */
    readonly readShareNow: number | null;
    /**
     * `tookUp − fellAway`: the words that changed hands, signed. `null` where a
     * floor could have given it the wrong sign.
     */
    readonly change: number | null;
    /**
     * Carried words that are a floor, because the type of the part saying them
     * declares no `copy`.
     */
    readonly floored: number;
};

KindCopyChangetype

One kind of part's words, held against themselves across two windows.

type KindCopyChange = {
    readonly kind: KindKey;
    /**
     * What part a type plays, or `null`. Always `null` on a role row,
     * which carries it as its key.
     */
    readonly role: PrimitiveRole | null;
    /** Places of this kind, in both windows, that say the same words in both. */
    readonly placements: number;
    /**
     * Places of it in both windows whose words the change rewrote.
     */
    readonly rewritten: number;
    /** The words of those places, which is two numbers for the reason there are two texts. */
    readonly rewrittenWords: {
        readonly was: number;
        readonly now: number;
    };
    /** Places of it the later window bears and the earlier did not. */
    readonly gained: number;
    /** Places of it the earlier window bore and the later does not. */
    readonly lost: number;
    /** Words of the places it gained, as the later window says them. */
    readonly wordsGained: number;
    /**
     * Of {@link wordsGained}, the words read in the window that has them.
     */
    readonly wordsGainedRead: number;
    /** Words of the places it lost, as the earlier window said them. */
    readonly wordsLost: number;
    /** Of {@link wordsLost}, the words that had been read in the window that had them. */
    readonly wordsLostRead: number;
    /** Places it keeps whose words are a floor, which the row's own words count. */
    readonly flooredPlacements: number;
    /** The carried words and what happened to the reading of them. */
    readonly words: CarriedWords;
    readonly movement: KindWordMovement;
    /**
     * Why there is no verdict, and `null` where there is one.
     */
    readonly silence: KindCopyChangeSilence | null;
};

LibraryCopyChangetype

What a change did to the words of a deployment's library, by kind of part.

type LibraryCopyChange = {
    /**
     * Every type that stands in either window, most words fallen away first.
     */
    readonly byType: readonly KindCopyChange[];
    /**
     * Every role in the vocabulary that stands in either window, then the row for
     * parts whose type declared none, in the same order as {@link byType}.
     */
    readonly byRole: readonly KindCopyChange[];
    /**
     * The whole library's carried words, which is {@link byType} added up.
     */
    readonly words: CarriedWords;
    /** Forms read in both windows: a page in one of its forms, never a revision. */
    readonly pages: number;
    /** Forms read in the later window only, which is not pages published. */
    readonly pagesGained: number;
    /** Of {@link pagesGained}, forms whose page the earlier window already held. */
    readonly formsGained: number;
    /** Forms read in the earlier window only, which is not pages withdrawn. */
    readonly pagesLost: number;
    /** Of {@link pagesLost}, forms whose page the later window still holds. */
    readonly formsLost: number;
    /** The audiences each window's forms named, published and never refused. */
    readonly audiences: ComparedPopulations;
    /**
     * Paired pages whose revision moved between the windows.
     */
    readonly republished: number;
    /** Places that say the same words in both windows, over every kind. */
    readonly placements: number;
    /** Places both windows bear whose words the change rewrote. */
    readonly rewritten: number;
    /** Places the later window bears and the earlier did not, counting a recast node once. */
    readonly gained: number;
    /** Places the earlier window bore and the later does not, counting a recast node once. */
    readonly lost: number;
    /**
     * Paired nodes whose primitive type changed.
     */
    readonly recast: number;
    /** Words of the places the library gained, as the later window says them. */
    readonly wordsGained: number;
    /** Of {@link wordsGained}, the words read in the window that has them. */
    readonly wordsGainedRead: number;
    /** Words of the places it lost, as the earlier window said them. */
    readonly wordsLost: number;
    /** Of {@link wordsLost}, the words that had been read in the window that had them. */
    readonly wordsLostRead: number;
    /**
     * A floor on the page views of the earlier window, added over the paired
     * pages.
     */
    readonly viewsWas: number;
    /** The same floor for the later window, over the same pages. */
    readonly viewsNow: number;
    /**
     * The type whose kept words lost the most reading, which is the kind to look
     * at first.
     */
    readonly mostAbandoned: KindCopyChange | null;
    /** The type whose kept words gained the most reading, by the same rule. */
    readonly mostTakenUp: KindCopyChange | null;
    /**
     * Forms read at two revisions in one window, which are in nothing above.
     */
    readonly ambiguous: readonly PageForm[];
    /**
     * Readings of a revision beyond the first, on either side, which were
     * dropped.
     */
    readonly duplicated: number;
    /**
     * Types the two windows disagree about the role of, where the later window's
     * answer stands.
     */
    readonly roleDisagreed: readonly PrimitiveType[];
};

libraryCopyChangeOffunction

What a change did to the words of a kind of part, across every page it stands on.

const libraryCopyChangeOf: (was: readonly PageReading[], now: readonly PageReading[]) => LibraryCopyChange

Library pace

signals/library-pace

Whether the readers who meet a kind of part have time for what it says.

KindPaceSilencetype

Why a kind of part has no pace.

type KindPaceSilence =
/**
 * The census's own two reasons, which were already a kind's and are reused as
 * values rather than said again.
 */
KindSilence
/**
 * Nothing countable is said anywhere it stands that readers reached, and
 * something in it declares no `copy`.
 */
 | "unreadable"
/**
 * It says nothing that takes time to read, anywhere it stands, and nothing
 * went uncounted either.
 */
 | "wordless";

KIND_PACE_SILENCESvalue

const KIND_PACE_SILENCES: readonly KindPaceSilence[]

describeKindPaceSilencefunction

One line per silence, for a surface saying why a kind has no pace.

const describeKindPaceSilence: (silence: KindPaceSilence) => string

KindPacetype

One kind of part, against the time its readers had for what it says.

type KindPace = {
    readonly kind: KindKey;
    /** What part a type plays, or `null`. Always `null` on a role row, which carries it as its key. */
    readonly role: PrimitiveRole | null;
    /** Element nodes of this kind across the readings, as the census counts them. */
    readonly placements: number;
    /**
     * Placements standing inside another placement of the same kind, which are in
     * no term here.
     */
    readonly nested: number;
    /** Placements in the figures: not nested, reached, and saying something counted. */
    readonly counted: number;
    /** Why the rest have no pace of their own. The counts add to `placements − nested − counted`. */
    readonly silences: Readonly<Record<PaceSilence, number>>;
    /**
     * Every placement a page could be read for, by its own verdict.
     */
    readonly standings: Readonly<Record<PaceStanding, number>>;
    /** Revisions bearing a counted placement. */
    readonly pages: number;
    /** Counted placements whose words are a floor, because a type in them declares no `copy`. */
    readonly floored: number;
    /**
     * Counted placements that are a page's root, which is why a kind holding the
     * whole page is out of {@link LibraryPace.mostSkimmed}.
     */
    readonly whole: number;
    /**
     * Page views that reached a counted placement, at the door's scale, counted
     * once per place it stands.
     */
    readonly readers: number | null;
    /**
     * Time on screen across the counted placements, added, exactly as the rows
     * hold it.
     */
    readonly dwellMs: number;
    /**
     * The time its words take the readers who met it: `readers × wordsWithin ×
     * msPerWord`, added over the counted placements.
     */
    readonly needMs: number | null;
    /** `dwellMs ÷ readers`: the time the typical reader who met a place of it had there. `null` under a silence. */
    readonly spentMs: number | null;
    /**
     * `needMs − dwellMs` where positive: the reading time its readers did not
     * have, and the key the rows are ordered by.
     */
    readonly shortMs: number | null;
    /** `dwellMs ÷ needMs`. `1` is exactly time enough. `null` under a silence. */
    readonly pace: number | null;
    /** The verdict, by `paceStandingOf` — so a floor can hold up anything but `skimmed`. */
    readonly standing: PaceStanding;
    /**
     * Of {@link readers}, those on a page the door could not scale, so no
     * straddle correction was applied to them.
     */
    readonly unscaled: number;
    readonly silence: KindPaceSilence | null;
};

LibraryPacetype

What a deployment's library asks of its readers' time, by kind of part.

type LibraryPace = {
    /**
     * Every type that stands anywhere, most reading time missing first.
     */
    readonly byType: readonly KindPace[];
    /** Every role in the vocabulary, then the row for parts whose type declared none, in the same order. */
    readonly byRole: readonly KindPace[];
    /** Readings counted, which is revisions of pages and not trees. */
    readonly pages: number;
    /** Distinct trees across them. */
    readonly trees: number;
    /** Element nodes across them, which is the sum of every type row's placements. */
    readonly placements: number;
    /** Placements standing inside another of their own type, across the type rows. */
    readonly nested: number;
    /** Pages whose door could scale them, which is where the correction comes from. */
    readonly scaled: number;
    /**
     * The pages bearing a counted placement that the door could not scale, by
     * tree and newest revision first.
     */
    readonly unscaled: readonly UnscaledPage[];
    /**
     * The type whose readers are shortest of the time its words take, which is
     * the kind to rewrite first.
     */
    readonly mostSkimmed: KindPace | null;
    /**
     * Readings of a revision beyond the first, which were dropped.
     */
    readonly duplicated: number;
    /** Door rows for one revision beyond the first, which were ignored. */
    readonly duplicatedRows: number;
    /**
     * Types whose readings disagreed about the role they play, where the first
     * reading's answer stands.
     */
    readonly roleDisagreed: readonly PrimitiveType[];
    /** The costing rate that was applied, which is the default unless one was given. */
    readonly wordsPerMinute: number;
};

LibraryPaceOptionstype

type LibraryPaceOptions = {
    /**
     * The costing rate, where {@link READING_WORDS_PER_MINUTE} is wrong for this
     * deployment's text. Refused the way a page's own reading refuses it.
     */
    readonly wordsPerMinute?: number;
};

libraryPaceOffunction

const libraryPaceOf: (readings: readonly PageReading[], rows: readonly StoredPageViews[], options?: LibraryPaceOptions) => LibraryPace

Library reach

signals/library-reach

Of the readers who met a kind of part, the share that read it.

KindReachSilencetype

Why a kind has no share of the readers who met it.

type KindReachSilence = KindSilence
/**
 * A page it stands on has no page-view row at the door, so no term of it can
 * be put on a scale another page's shares could be added to.
 */
 | "unscaled"
/**
 * A page it stands on has a row and nothing in it says a page view ever
 * began.
 */
 | "unopened"
/**
 * A page it stands on has openings and no rollup has folded a window of them
 * yet.
 */
 | "uncounted";

KIND_REACH_SILENCESvalue

const KIND_REACH_SILENCES: readonly KindReachSilence[]

describeKindReachSilencefunction

One line per silence, for a surface saying why a kind has no share of readers.

const describeKindReachSilence: (silence: KindReachSilence) => string

KindReachtype

One kind of part, against the readers who met the places it stands.

type KindReach = {
    readonly kind: KindKey;
    /** What part a type plays, or `null`. Always `null` on a role row, which carries it as its key. */
    readonly role: PrimitiveRole | null;
    /** Element nodes of this kind across the readings, as the census counts them. */
    readonly placements: number;
    /**
     * Placements a window could speak for, which are the ones in the figures.
     */
    readonly verdicts: number;
    /** Placements nothing could be said about, and therefore excluded. */
    readonly unknown: number;
    /** Revisions bearing at least one placement with a verdict. */
    readonly pages: number;
    /**
     * Page views that began on a page bearing it, counted once per place it
     * stands there. Exact, and the denominator of {@link atMost}.
     */
    readonly openings: number | null;
    /**
     * The same page views at the door's scale, keeping only those a rollup has
     * folded: `appearances ÷ (1 + inflation)` per bearing page, which is
     * `min(appearances, opened)`.
     */
    readonly counted: number | null;
    /**
     * Page views that reached a place this kind stands, at the door's scale.
     */
    readonly met: number | null;
    /** `counted − met`: the page views that met a page bearing it and did not reach the place. */
    readonly missed: number | null;
    /**
     * `met ÷ counted` — the share of the readers who met it that read it.
     */
    readonly share: number | null;
    /**
     * The most the share could be: `min(reached, opened)` per bearing placement
     * over the {@link openings}, never above 1.
     */
    readonly atMost: number | null;
    /** The numerator of {@link atMost}: whole page views, which is what keeps it a bound. */
    readonly atMostMet: number | null;
    /**
     * Appearances in excess of openings across the bearing placements — the
     * straddle that divided out of each page's share before the pages met.
     */
    readonly drift: number;
    /**
     * Openings across the bearing placements whose reading no rollup has folded
     * yet, which is exactly `openings − counted`.
     */
    readonly pending: number;
    /**
     * Nobody's visit spanned a window and no opening is waiting, so the estimate
     * and the ceiling are the same number and the share is exact.
     */
    readonly exact: boolean;
    /**
     * Placements reporting more reach than their page had appearances, which no
     * rollup produces.
     */
    readonly unreconciled: number;
    readonly silence: KindReachSilence | null;
};

UnscaledPagetype

A page bearing a measured placement that the door could not scale, with the reason in the vocabulary a page's own reading publishes.

type UnscaledPage = RevisionOf & {
    readonly silence: ReachSilence;
};

LibraryReachtype

What a deployment's library does for the readers who meet it, by kind of part.

type LibraryReach = {
    /**
     * Every type that stands anywhere, most readers missed first.
     */
    readonly byType: readonly KindReach[];
    /** Every role in the vocabulary, then the row for parts whose type declared none, in the same order. */
    readonly byRole: readonly KindReach[];
    /** Readings counted, which is revisions of pages and not trees. */
    readonly pages: number;
    /** Distinct trees across them. */
    readonly trees: number;
    /** Element nodes across them, which is the sum of every type row's placements. */
    readonly placements: number;
    /**
     * Page views counted at the door across the pages read, added **once per
     * page**.
     */
    readonly arrivals: number;
    /** Pages the door could scale, which is where every share here comes from. */
    readonly scaled: number;
    /**
     * The pages bearing a measured placement that the door could not scale, by
     * tree and newest revision first.
     */
    readonly unscaled: readonly UnscaledPage[];
    /**
     * The type that loses the most readers, which is the kind to look at first.
     */
    readonly mostMissed: KindReach | null;
    /**
     * Readings of a revision beyond the first, which were dropped.
     */
    readonly duplicated: number;
    /**
     * Door rows for one revision beyond the first, which were ignored.
     */
    readonly duplicatedRows: number;
    /**
     * Types whose readings disagreed about the role they play, where the first
     * reading's answer stands.
     */
    readonly roleDisagreed: readonly PrimitiveType[];
};

libraryReachOffunction

What a deployment's library does for the readers who meet it, by kind of part.

const libraryReachOf: (readings: readonly PageReading[], rows: readonly StoredPageViews[]) => LibraryReach

Library reach change

signals/library-reach-change

Of the readers who met a kind of part, the share that read it — before and after.

LibraryWindowtype

One window of a library: the pages read, and the door rows to put them on one scale.

type LibraryWindow = {
    readonly readings: readonly PageReading[];
    /**
     * The whole window of page-view rows a deployment holds.
     */
    readonly rows: readonly StoredPageViews[];
};

ReadingSidetype

Which of the two windows a fact is about.

type ReadingSide = "was" | "now";

READING_SIDESvalue

const READING_SIDES: readonly ReadingSide[]

describeReadingSidefunction

One line per side, for a surface naming the window a page's reason came from.

const describeReadingSide: (side: ReadingSide) => string

UnscaledSidetype

A page bearing a comparable placement that the door could not scale, with the side it is on and the reason in the vocabulary a page's own reading publishes.

type UnscaledSide = UnscaledPage & {
    readonly side: ReadingSide;
    /** The revision read on the other side, which is the page this one is paired with. */
    readonly against: number;
};

KindReachChangeSilencetype

Why a kind of part has no before and after among the readers who met it.

type KindReachChangeSilence =
/**
 * Nothing in the pages read, on either side, is of this kind.
 */
"unplaced"
/**
 * It stands in both windows and in no place that is in both.
 */
 | "unpaired"
/**
 * No place of it that stands in both windows can be spoken for in both.
 */
 | "unread"
/**
 * A page bearing a comparable place of it has no page-view row at the door, on
 * one of the two sides.
 */
 | "unscaled"
/**
 * A page bearing a comparable place of it has a row and nothing in it says a
 * page view began.
 */
 | "unopened"
/**
 * A page bearing a comparable place of it has openings and no rollup has
 * folded a window of them yet.
 */
 | "uncounted";

KIND_REACH_CHANGE_SILENCESvalue

const KIND_REACH_CHANGE_SILENCES: readonly KindReachChangeSilence[]

describeKindReachChangeSilencefunction

One line per silence, for a surface saying why a kind has no before and after.

const describeKindReachChangeSilence: (silence: KindReachChangeSilence) => string

KindReachMovementtype

What happened to the share of the readers who met a kind of part.

type KindReachMovement =
/** A larger share of the readers who met it read it now. */
"taken-up"
/** A smaller share does. */
 | "abandoned"
/**
 * Exactly the same share does.
 */
 | "held"
/**
 * No reader reached any comparable place of it in either window.
 */
 | "still-unread"
/** {@link KindReachChange.silence} says why nothing can be said. */
 | "unknown";

KIND_REACH_MOVEMENTSvalue

const KIND_REACH_MOVEMENTS: readonly KindReachMovement[]

describeKindReachMovementfunction

One line per movement, for a surface putting a kind's before and after in front of a person.

const describeKindReachMovement: (movement: KindReachMovement) => string

ReaderShareCausetype

Which side of the weighted mean the movement came from.

type ReaderShareCause =
/**
 * The readers alone were enough: the later window's per-place shares at the
 * earlier window's traffic would have moved it the same way.
 */
"readers"
/**
 * The pages alone were enough: the earlier window's per-place shares at the
 * later window's traffic would have moved it the same way.
 */
 | "pages"
/** Either alone would have been enough, so the movement is over-determined. */
 | "either"
/**
 * Neither alone would have been enough and the two together were.
 */
 | "together";

READER_SHARE_CAUSESvalue

const READER_SHARE_CAUSES: readonly ReaderShareCause[]

describeReaderShareCausefunction

One line per cause, for a surface saying what moved a share of readers.

const describeReaderShareCause: (cause: ReaderShareCause) => string

KindReachChangetype

One kind of part, held against itself across two windows, among the readers who met it.

type KindReachChange = {
    readonly kind: KindKey;
    /**
     * What part a type plays, or `null`. Always `null` on a role row, which
     * carries it as its key.
     */
    readonly role: PrimitiveRole | null;
    /** Places of this kind that stand in both windows: the same node of the same page, of this kind on both sides. */
    readonly places: number;
    /** Places of it in the later window with no counterpart in the earlier one. */
    readonly gained: number;
    /** Places of it in the earlier window with no counterpart in the later one. */
    readonly lost: number;
    /**
     * Of {@link places}, those with a verdict on **both** sides, which is the set
     * every figure below is taken over.
     */
    readonly comparable: number;
    /**
     * Pages bearing a comparable place of it, which is **forms** and not
     * revisions.
     */
    readonly pages: number;
    /**
     * Page views that met a page bearing a comparable place of it in the earlier
     * window, at the door's scale, counted once per place it stands there.
     */
    readonly countedWas: number | null;
    /** The same for the later window. */
    readonly countedNow: number | null;
    /**
     * Page views that reached a comparable place of it in the earlier window, at
     * the door's scale: `reached × counted ÷ appearances`, added over the places.
     */
    readonly metWas: number | null;
    /** The same for the later window. */
    readonly metNow: number | null;
    /**
     * `metWas ÷ countedWas` — the share of the readers who met it that read it, in
     * the earlier window.
     */
    readonly shareWas: number | null;
    /** The same share in the later window, over the same places. */
    readonly shareNow: number | null;
    /** `shareNow − shareWas`, and `null` with the two shares. */
    readonly shift: number | null;
    /**
     * The movement stated at the later window's scale: `shift × countedNow`.
     */
    readonly readersMoved: number | null;
    /**
     * The later window's per-place shares at the earlier window's weights: the
     * share there would have been if no page's traffic had moved.
     */
    readonly ifTrafficHeld: number | null;
    /**
     * The earlier window's per-place shares at the later window's weights: the
     * share there would have been if no reader had read differently.
     */
    readonly ifReadingHeld: number | null;
    readonly movement: KindReachMovement;
    /** Which side was sufficient, or `null` where the share did not move. */
    readonly cause: ReaderShareCause | null;
    /**
     * How far the weights moved: half the sum of the absolute movements in each
     * comparable place's share of its side's total weight, in `[0, 1]`.
     */
    readonly weightMoved: number | null;
    /** Appearances in excess of openings in the earlier window, over the comparable places: the straddle that divided out of each page's share. */
    readonly driftWas: number;
    /** The same for the later window. */
    readonly driftNow: number;
    /** Openings in the earlier window, over the comparable places, whose reading no rollup has folded. */
    readonly pendingWas: number;
    /** The same for the later window. */
    readonly pendingNow: number;
    /**
     * Comparable places reporting more reach than their page had appearances, on
     * either side, which no rollup produces.
     */
    readonly unreconciled: number;
    /**
     * Nobody's visit spanned a window on either side, nothing is waiting to be
     * folded, and nothing is unreconciled — so both shares are exact.
     */
    readonly exact: boolean;
    /**
     * Why the figures are not there, and `null` where they are.
     */
    readonly silence: KindReachChangeSilence | null;
};

LibraryReachChangetype

What a change did to a deployment's library among the readers who met it, by kind of part.

type LibraryReachChange = {
    /**
     * Every type that stands in either window, most readers lost first.
     */
    readonly byType: readonly KindReachChange[];
    /**
     * Every role in the vocabulary, then the row for parts whose type declared
     * none, in the same order as {@link byType}.
     */
    readonly byRole: readonly KindReachChange[];
    /** Forms read in both windows: a page in one of its forms, never a revision. */
    readonly pages: number;
    /** Forms read in the later window only, which is not pages published. */
    readonly pagesGained: number;
    /** Of {@link pagesGained}, forms whose page the earlier window already held. */
    readonly formsGained: number;
    /** Forms read in the earlier window only, which is not pages withdrawn. */
    readonly pagesLost: number;
    /** Of {@link pagesLost}, forms whose page the later window still holds. */
    readonly formsLost: number;
    /** The audiences each window's forms named, published and never refused. */
    readonly audiences: ComparedPopulations;
    /**
     * Paired pages whose revision moved between the windows.
     */
    readonly republished: number;
    /** Places that stand in both windows, which is the sum of every type row's {@link KindReachChange.places}. */
    readonly placements: number;
    /** Places in the later window only. */
    readonly gained: number;
    /** Places in the earlier window only. */
    readonly lost: number;
    /** Paired nodes whose primitive type changed: a place one kind left and another took. */
    readonly recast: number;
    /**
     * Page views counted at the door across the paired pages in the earlier
     * window, added **once per page**.
     */
    readonly arrivalsWas: number;
    /** The same for the later window. */
    readonly arrivalsNow: number;
    /** Paired pages the door could scale in **both** windows, which is where every share here comes from. */
    readonly scaled: number;
    /**
     * The paired pages bearing a comparable placement that the door could not
     * scale, by tree, newest revision first, with the side they are on.
     */
    readonly unscaled: readonly UnscaledSide[];
    /**
     * The type that lost the most readers, which is the kind to look at first.
     */
    readonly mostAbandoned: KindReachChange | null;
    /** The type that gained the most readers, by the same rule. */
    readonly mostTakenUp: KindReachChange | null;
    /**
     * Forms read at two revisions in one window, which are in nothing above.
     */
    readonly ambiguous: readonly PageForm[];
    /** Readings of a revision beyond the first, on either side, which were dropped. */
    readonly duplicated: number;
    /**
     * Door rows for one revision beyond the first, across the pages of both
     * windows, which were ignored.
     */
    readonly duplicatedRows: number;
    /** Types the two windows disagree about the role of, where the later window's answer stands. */
    readonly roleDisagreed: readonly PrimitiveType[];
};

readerShareCauseOffunction

Which side was sufficient, by the direction each counterfactual carries.

const readerShareCauseOf: (shareWas: number, shareNow: number, ifTrafficHeld: number, ifReadingHeld: number) => ReaderShareCause | null

weightMovedOverfunction

Half the sum of the absolute movements in each place's share of its side's weight, which is the figure a comparison of two readerships publishes, over places rather than regions.

const weightMovedOver: (weights: readonly {
    readonly was: number;
    readonly now: number;
}[], totals: {
    readonly was: number;
    readonly now: number;
}) => number | null

inUnscaledSideOrderfunction

Tree id, then newest revision first, then the side, which is the order the page-view rows are read in.

const inUnscaledSideOrder: (one: UnscaledSide, other: UnscaledSide) => number

ScaledPagetype

One side's pages, each with the door that scales it, worked out once per page.

type ScaledPage = {
    readonly reading: PageReading;
    readonly door: PageDoor;
    readonly duplicatedRows: number;
};

scaledPageOffunction

One page with its door, picked out of the window's rows by the published matching rule.

const scaledPageOf: (reading: PageReading, rows: readonly StoredPageViews[]) => ScaledPage

LibrarySidetype

One whole side: its pages keyed by form, each page's door, and the rows a caller handed in twice.

type LibrarySide = {
    readonly pages: PairedWindow;
    /**
     * Each paired page's door, under the same key the pairing uses.
     */
    readonly scaled: ReadonlyMap<string, ScaledPage>;
    readonly duplicatedRows: number;
};

librarySideOffunction

The pages of one window, keyed by form, with each page's door already worked out.

const librarySideOf: (window: LibraryWindow) => LibrarySide

libraryReachChangeOffunction

const libraryReachChangeOf: (was: LibraryWindow, now: LibraryWindow) => LibraryReachChange

Library senders

signals/library-senders

**Which of a deployment's components are silent.**

SenderSilencetype

Why a kind has no silent-sender share.

type SenderSilence =
/**
 * Nothing in the pages read is of this kind at all.
 */
"unplaced"
/**
 * Every placement of this kind holds nothing, so the defect cannot be seen on
 * it at all.
 */
 | "unwitnessable"
/**
 * It holds parts, and nothing below any of its placements reported reach in
 * this window.
 */
 | "unwitnessed";

SENDER_SILENCESvalue

const SENDER_SILENCES: readonly SenderSilence[]

describeSenderSilencefunction

One line per silence, for a surface saying why a kind has no share.

const describeSenderSilence: (silence: SenderSilence) => string

KindSenderstype

Whether one kind of part reports itself, everywhere it stands in the pages read.

type KindSenders = {
    readonly kind: KindKey;
    /** What part a type plays, or `null`. Always `null` on a role row, which carries it as its key. */
    readonly role: PrimitiveRole | null;
    /** Element nodes of this kind across the readings. */
    readonly placements: number;
    /** Distinct trees it stands in, which is not the number of placements and not the number of readings. */
    readonly trees: number;
    /** Distinct revisions it stands in: two live revisions of one page are two. */
    readonly revisions: number;
    /** Placements holding no part at all, where the defect can never be seen. */
    readonly leaves: number;
    /** Placements holding parts, none of which reported reach in this window. */
    readonly unwitnessed: number;
    /**
     * Placements with at least one part below them reporting reach — the
     * population the rest of this row is about.
     */
    readonly witnessed: number;
    /**
     * Witnessed placements that reported no view of themselves, which is the
     * defect a page's own reading raises exactly as it raises it.
     */
    readonly silent: number;
    /**
     * Witnessed placements whose own standing is `unknown` — something other than
     * a view, with a reader below.
     */
    readonly indeterminate: number;
    /**
     * {@link silent} over {@link witnessed}; `null` where {@link silence} says why
     * not.
     */
    readonly share: number | null;
    /**
     * `(silent + indeterminate) ÷ witnessed`, the other end of the bracket;
     * `null` with {@link share}.
     */
    readonly atMost: number | null;
    /** Why {@link share} is not there, and `null` where it is. */
    readonly silence: SenderSilence | null;
    /**
     * Distinct trees with at least one silent placement of this kind.
     */
    readonly silentTrees: number;
    /**
     * Nodes of this kind that were silent, in the order the readings were handed
     * in, capped at {@link SILENT_EXAMPLES}.
     */
    readonly examples: readonly NodeId[];
};

SILENT_EXAMPLESvalue

How many silent nodes a row carries as examples.

const SILENT_EXAMPLES = 5

LibrarySenderstype

Which of a deployment's kinds of part report themselves, and which are silent.

type LibrarySenders = {
    /**
     * Every type that stands anywhere, most silent placements first.
     */
    readonly byType: readonly KindSenders[];
    /**
     * Every role in the vocabulary that stands anywhere, then the row for parts
     * whose type declared none, in the same order as {@link byType}.
     */
    readonly byRole: readonly KindSenders[];
    /** Readings counted, which is revisions of pages and not trees. */
    readonly pages: number;
    /** Distinct trees across them. */
    readonly trees: number;
    /** Element nodes across them, which is the sum of every type row's placements. */
    readonly placements: number;
    /** Placements the defect could be seen on, over the whole library. */
    readonly witnessed: number;
    /**
     * Silent placements over the whole library, which is the sum of
     * `PageFrontier.notReporting` over the same readings.
     */
    readonly silent: number;
    /** Witnessed placements whose own standing is `unknown`, over the whole library. */
    readonly indeterminate: number;
    /**
     * The type silent in the most places, which is the component to fix first.
     */
    readonly worstSender: KindSenders | null;
    /**
     * Readings of a revision beyond the first, which were dropped.
     */
    readonly duplicated: number;
    /**
     * Types whose readings disagreed about the role they play, where the first
     * reading's answer stands.
     */
    readonly roleDisagreed: readonly PrimitiveType[];
};

librarySendersOffunction

Which of a deployment's kinds of part report themselves.

Shown in use on What your readers do — A part that said nothing

const librarySendersOf: (readings: readonly PageReading[]) => LibrarySenders

Library senders change

signals/library-senders-change

**What fixing a silent component was worth.**

SenderFixSilencetype

Why a kind of part has no before and after for its senders.

type SenderFixSilence =
/**
 * Nothing in the pages read, on either side, is of this kind.
 */
"unplaced"
/**
 * It stands in both windows and in no place that is in both.
 */
 | "unpaired"
/**
 * No place it holds still has an element part inside it on both sides.
 */
 | "unwitnessable"
/**
 * Its places stand in both windows, something stands inside at least one of
 * them on both sides, and none of them could be checked in both.
 */
 | "uncheckable"
/**
 * Every place checkable in both windows is `unknown` in one of them.
 */
 | "unclaimable";

SENDER_FIX_SILENCESvalue

const SENDER_FIX_SILENCES: readonly SenderFixSilence[]

describeSenderFixSilencefunction

One line per silence, for a surface saying why a kind has no before and after.

const describeSenderFixSilence: (silence: SenderFixSilence) => string

SenderMovementtype

What happened to a kind of part's senders between the two windows.

type SenderMovement =
/** More of the places it stands report themselves now, which is what a fix to a primitive looks like. */
"repaired"
/** Fewer do, which is what a release that broke a sender looks like. */
 | "regressed"
/**
 * Exactly as many do, which includes places trading places: two repaired and
 * two gone silent is `held`, and both counts are published so a surface can
 * say so.
 */
 | "held"
/**
 * No place of it reported itself in either window.
 */
 | "still-silent"
/** {@link KindSenderChange.silence} says why nothing can be said. */
 | "unknown";

SENDER_MOVEMENTSvalue

const SENDER_MOVEMENTS: readonly SenderMovement[]

describeSenderMovementfunction

One line per movement, for a surface putting a component's before and after in front of a person.

const describeSenderMovement: (movement: SenderMovement) => string

KindSenderChangetype

One kind of part's senders, held against themselves across two windows.

type KindSenderChange = {
    readonly kind: KindKey;
    /**
     * What part a type plays, or `null`. Always `null` on a role row, which
     * carries it as its key.
     */
    readonly role: PrimitiveRole | null;
    /** Places of this kind that stand in both windows: the same node of the same page, of this kind on both sides. */
    readonly places: number;
    /** Places of it in the later window with no counterpart in the earlier one. */
    readonly gained: number;
    /** Places of it in the earlier window with no counterpart in the later one. */
    readonly lost: number;
    /**
     * Of {@link places}, those something below reported reach at in the **earlier**
     * window.
     */
    readonly checkableWas: number;
    /** The same for the later window. */
    readonly checkableNow: number;
    /**
     * Of {@link places}, those with an element part inside them on **both** sides
     * — the places readers could ever check.
     */
    readonly inhabited: number;
    /**
     * Of {@link places}, those checkable in **both** windows — the population this
     * row is about.
     */
    readonly checkable: number;
    /**
     * Checkable places that reported something other than a view in one of the two
     * windows, which are in no transition.
     */
    readonly indeterminate: number;
    /**
     * `checkable − indeterminate`: the places with a verdict on both sides, which
     * is the denominator of both shares and the sum of the four transitions.
     */
    readonly comparable: number;
    /** Comparable places silent in the earlier window and reporting in the later one. */
    readonly repaired: number;
    /** Comparable places reporting in the earlier window and silent in the later one. */
    readonly wentSilent: number;
    /** Comparable places silent in both. */
    readonly keptSilent: number;
    /** Comparable places reporting in both. */
    readonly keptReporting: number;
    /**
     * The share of {@link comparable} places that was silent in the earlier
     * window; `null` where {@link silence} says why not.
     */
    readonly silentShareWas: number | null;
    /** The same share in the later window, over the same places. */
    readonly silentShareNow: number | null;
    readonly movement: SenderMovement;
    /**
     * Why the two shares are not there, and `null` where they are.
     */
    readonly silence: SenderFixSilence | null;
    /**
     * Distinct trees with at least one place of this kind repaired.
     */
    readonly repairedTrees: number;
    /** Distinct trees with at least one place of this kind gone silent, by the same rule. */
    readonly silencedTrees: number;
    /**
     * Nodes of this kind that went silent, in the order the pages were paired,
     * capped at {@link SILENCED_EXAMPLES}.
     */
    readonly silencedExamples: readonly NodeId[];
};

SILENCED_EXAMPLESvalue

How many newly silent nodes a row carries as examples.

const SILENCED_EXAMPLES = 5

LibrarySendersChangetype

What a change did to a deployment's senders, by kind of part.

type LibrarySendersChange = {
    /**
     * Every type that stands in either window, most places gone silent first.
     */
    readonly byType: readonly KindSenderChange[];
    /**
     * Every role in the vocabulary that stands in either window, then the row for
     * parts whose type declared none, in the same order as {@link byType}.
     */
    readonly byRole: readonly KindSenderChange[];
    /** Forms read in both windows: a page in one of its forms, never a revision. */
    readonly pages: number;
    /** Forms read in the later window only, which is not pages published. */
    readonly pagesGained: number;
    /** Forms read in the earlier window only, which is not pages withdrawn. */
    readonly pagesLost: number;
    /** The audiences each window's forms named, published and never refused. */
    readonly audiences: ComparedPopulations;
    /**
     * Paired pages whose revision moved between the windows.
     */
    readonly republished: number;
    /** Places that stand in both windows, which is the sum of every type row's {@link KindSenderChange.places}. */
    readonly placements: number;
    /** Places in the later window only. */
    readonly gained: number;
    /** Places in the earlier window only. */
    readonly lost: number;
    /**
     * Paired nodes whose primitive type changed.
     */
    readonly recast: number;
    /**
     * Places checkable in both windows, over the whole library, which is the sum
     * of every type row's {@link KindSenderChange.checkable}.
     */
    readonly checkable: number;
    /**
     * Paired places with something inside them on both sides, over the whole
     * library, which is the sum of every type row's
     * {@link KindSenderChange.inhabited}.
     */
    readonly inhabited: number;
    /** Of them, those with a verdict on both sides. */
    readonly comparable: number;
    /** Comparable places that went from silent to reporting, over the whole library. */
    readonly repaired: number;
    /** Comparable places that went from reporting to silent. */
    readonly wentSilent: number;
    /** Comparable places silent in both windows, which is what a fix has not reached yet. */
    readonly keptSilent: number;
    /** Comparable places reporting in both. */
    readonly keptReporting: number;
    /** Checkable places unclaimed on one of the two sides, over the whole library. */
    readonly indeterminate: number;
    /**
     * A floor on the page views of the earlier window, added over the paired
     * pages.
     */
    readonly viewsWas: number;
    /** The same floor for the later window, over the same pages. */
    readonly viewsNow: number;
    /**
     * The type that recovered its reporting in the most places, which is what the
     * fix was worth.
     */
    readonly mostRepaired: KindSenderChange | null;
    /**
     * The type that went silent in the most places, by the same rule.
     */
    readonly mostSilenced: KindSenderChange | null;
    /**
     * Forms read at two revisions in one window, which are in nothing above.
     */
    readonly ambiguous: readonly PageForm[];
    /**
     * Readings of a revision beyond the first, on either side, which were dropped.
     */
    readonly duplicated: number;
    /**
     * Types the two windows disagree about the role of, where the later window's
     * answer stands.
     */
    readonly roleDisagreed: readonly PrimitiveType[];
};

librarySendersChangeOffunction

What a change did to a deployment's senders, across every page a kind of part stands on.

Shown in use on What your readers do — A part that said nothing

const librarySendersChangeOf: (was: readonly PageReading[], now: readonly PageReading[]) => LibrarySendersChange

Library senders reach

signals/library-senders-reach

**Whether a silent component is worth fixing.**

SenderReachSilencetype

Why a kind has no reader-weighted share of its silent places.

type SenderReachSilence =
/**
 * The census's own three reasons, which are already a kind's.
 */
SenderSilence
/**
 * A page bearing a checkable place of this kind has no page-view row at the
 * door, so no weight of it can be put on a scale another page's could be
 * added to.
 */
 | "unscaled"
/**
 * A page bearing a checkable place of this kind has a row and nothing in it
 * says a page view ever began.
 */
 | "unopened"
/**
 * A page bearing a checkable place of this kind has openings and no rollup
 * has folded a window of them yet.
 */
 | "uncounted";

SENDER_REACH_SILENCESvalue

const SENDER_REACH_SILENCES: readonly SenderReachSilence[]

describeSenderReachSilencefunction

One line per silence, for a surface saying why a kind has no reader-weighted share.

const describeSenderReachSilence: (silence: SenderReachSilence) => string

KindSenderReachtype

One kind of part, against the readings that got inside the places it stands.

type KindSenderReach = {
    readonly kind: KindKey;
    /** What part a type plays, or `null`. Always `null` on a role row, which carries it as its key. */
    readonly role: PrimitiveRole | null;
    /** Element nodes of this kind across the readings, as the census counts them. */
    readonly placements: number;
    /**
     * Placements the defect could be seen on, which is the census's own count and
     * the population every weight below is taken over.
     */
    readonly witnessed: number;
    /** Checkable placements that reported no view of themselves, which is the defect. */
    readonly silent: number;
    /** Checkable placements that reported something that was not a view, which is no claim either way. */
    readonly indeterminate: number;
    /** Revisions bearing at least one checkable placement of it. */
    readonly pages: number;
    /**
     * The readings that reached inside a checkable place of this kind, at the
     * door's scale — the denominator, and the figure that says whether any of this
     * is worth an operator's afternoon.
     */
    readonly inside: number | null;
    /** Of those, the ones that reached a place which reported itself. `null` with {@link inside}. */
    readonly reported: number | null;
    /**
     * Of those, the ones that reached a place which said nothing — **the readings
     * this component's silence cost the deployment.**
     */
    readonly unreported: number | null;
    /**
     * Of those, the ones that reached a place which reported something that was
     * not a view.
     */
    readonly unclaimed: number | null;
    /**
     * `unreported ÷ inside` — of the readings that got inside this kind, the share
     * that got inside a copy of it that never reported itself.
     */
    readonly share: number | null;
    /**
     * `(unreported + unclaimed) ÷ inside`, the other end of the bracket.
     */
    readonly atMost: number | null;
    /**
     * Appearances in excess of openings across the bearing pages — the straddle
     * that was divided out of each page's weight before the pages met.
     */
    readonly drift: number;
    /** Openings across the bearing pages whose reading no rollup has folded yet. */
    readonly pending: number;
    /**
     * Checkable placements where more reach was reported inside them than their
     * page had appearances, which no rollup produces.
     */
    readonly unreconciled: number;
    /** Nothing straddled, nothing is pending and nothing is unreconciled, so the weights are exact. */
    readonly exact: boolean;
    readonly silence: SenderReachSilence | null;
};

LibrarySendersReachtype

What a deployment's silent components cost the readers who met them, by kind of part.

type LibrarySendersReach = {
    /**
     * Every type that stands anywhere, most readings lost first.
     */
    readonly byType: readonly KindSenderReach[];
    /** Every role in the vocabulary that stands anywhere, then the row for parts whose type declared none. */
    readonly byRole: readonly KindSenderReach[];
    /** Readings counted, which is revisions of pages and not trees. */
    readonly pages: number;
    /** Distinct trees across them. */
    readonly trees: number;
    /** Element nodes across them, which is the sum of every type row's placements. */
    readonly placements: number;
    /**
     * Page views counted at the door across the pages read, added **once per
     * page**.
     */
    readonly arrivals: number;
    /** Pages the door could scale, which is where every weight here comes from. */
    readonly scaled: number;
    /**
     * The pages bearing a checkable placement that the door could not scale, by
     * tree and newest revision first.
     */
    readonly unscaled: readonly UnscaledPage[];
    /**
     * The type whose silence cost the most readings, which is the component to fix
     * first.
     */
    readonly costliestSender: KindSenderReach | null;
    /**
     * Readings of a revision beyond the first, which were dropped.
     */
    readonly duplicated: number;
    /**
     * Door rows for one revision beyond the first, which were ignored.
     */
    readonly duplicatedRows: number;
    /**
     * Types whose readings disagreed about the role they play, where the first
     * reading's answer stands.
     */
    readonly roleDisagreed: readonly PrimitiveType[];
};

librarySendersReachOffunction

What a deployment's silent components cost the readers who met them.

Shown in use on What your readers do — A part that said nothing

const librarySendersReachOf: (readings: readonly PageReading[], rows: readonly StoredPageViews[]) => LibrarySendersReach

Library senders reach change

signals/library-senders-reach-change

**What fixing a silent component was worth, in readers rather than in places.**

SenderReachChangeSilencetype

Why a kind of part has no before and after among the readings that got inside it.

type SenderReachChangeSilence =
/**
 * The comparison of places' own four reasons, which are already a kind's.
 */
SenderFixSilence
/**
 * A page bearing a comparable place of this kind has no page-view row at the
 * door, on one of the two sides.
 */
 | "unscaled"
/**
 * A page bearing a comparable place of this kind has a row and nothing in it
 * says a page view began.
 */
 | "unopened"
/**
 * A page bearing a comparable place of this kind has openings and no rollup
 * has folded a window of them yet.
 */
 | "uncounted";

SENDER_REACH_CHANGE_SILENCESvalue

const SENDER_REACH_CHANGE_SILENCES: readonly SenderReachChangeSilence[]

describeSenderReachChangeSilencefunction

One line per silence, for a surface saying why a kind has no before and after.

const describeSenderReachChangeSilence: (silence: SenderReachChangeSilence) => string

SenderReachCausetype

Which of the two movers was sufficient to move the share of readings a component's silence costs.

type SenderReachCause =
/**
 * The senders alone were enough: the later window's states at the earlier
 * window's weights would have moved it the same way.
 */
"senders"
/**
 * The readers alone were enough: the earlier window's states at the later
 * window's weights would have moved it the same way.
 */
 | "readers"
/** Either alone would have been enough, so the movement is over-determined. */
 | "either"
/**
 * Neither alone would have been enough and the two together were.
 */
 | "together";

SENDER_REACH_CAUSESvalue

const SENDER_REACH_CAUSES: readonly SenderReachCause[]

describeSenderReachCausefunction

One line per cause, for a surface saying what moved a component's measured share.

Shown in use on What your readers do — A part that said nothing

const describeSenderReachCause: (cause: SenderReachCause) => string

KindSenderReachChangetype

One kind of part's senders, held against themselves across two windows, among the readings that got inside them.

type KindSenderReachChange = {
    readonly kind: KindKey;
    /**
     * What part a type plays, or `null`. Always `null` on a role row, which
     * carries it as its key.
     */
    readonly role: PrimitiveRole | null;
    /** Places of this kind that stand in both windows: the same node of the same page, of this kind on both sides. */
    readonly places: number;
    /** Places of it in the later window with no counterpart in the earlier one. */
    readonly gained: number;
    /** Places of it in the earlier window with no counterpart in the later one. */
    readonly lost: number;
    /**
     * Of {@link places}, those something below reported reach at in the
     * **earlier** window.
     */
    readonly checkableWas: number;
    /** The same for the later window. */
    readonly checkableNow: number;
    /**
     * Of {@link places}, those with an element part inside them on **both** sides
     * — the places the defect could ever be seen on.
     */
    readonly inhabited: number;
    /** Of {@link places}, those the defect could be seen on in **both** windows. */
    readonly checkable: number;
    /** Checkable places that reported something other than a view in one of the two windows, which are in no transition. */
    readonly indeterminate: number;
    /**
     * `checkable − indeterminate`: the places with a verdict on both sides, which
     * is the population every weight below is taken over.
     */
    readonly comparable: number;
    /** Comparable places silent in the earlier window and reporting in the later one. */
    readonly repaired: number;
    /** Comparable places reporting in the earlier window and silent in the later one. */
    readonly wentSilent: number;
    /** Comparable places silent in both. */
    readonly keptSilent: number;
    /** Comparable places reporting in both. */
    readonly keptReporting: number;
    /** Pages bearing a comparable place of it, which is **forms** and never revisions. */
    readonly pages: number;
    /**
     * The readings that got inside a comparable place of it in the earlier
     * window, at that window's door scale.
     */
    readonly insideWas: number | null;
    /** The same for the later window, which is the denominator of {@link silentShareNow} and {@link ifSendersHeld}. */
    readonly insideNow: number | null;
    /** Of {@link insideWas}, the readings that got inside a place which said nothing. */
    readonly unreportedWas: number | null;
    /** Of {@link insideNow}, the same — **what this component's silence is costing now.** */
    readonly unreportedNow: number | null;
    /** `unreportedWas ÷ insideWas`, and `null` where {@link silence} says why not. */
    readonly silentShareWas: number | null;
    /** `unreportedNow ÷ insideNow`, over the same places and this window's readers. */
    readonly silentShareNow: number | null;
    /**
     * What the movement is worth in readings, stated at the later window's scale:
     * `(silentShareWas − silentShareNow) × insideNow`.
     */
    readonly readingsRecovered: number | null;
    /**
     * The later window's states at the earlier window's weights: the share there
     * would have been if no reader had moved.
     */
    readonly ifReadingHeld: number | null;
    /**
     * The earlier window's states at the later window's weights: the share there
     * would have been if no sender had changed.
     */
    readonly ifSendersHeld: number | null;
    /** The verdict over the two shares, which is never the two counts of places. */
    readonly movement: SenderMovement;
    /** Which mover was sufficient, or `null` where the share did not move. */
    readonly cause: SenderReachCause | null;
    /**
     * How far the reading moved between the places of this kind: half the sum of
     * the absolute movements in each comparable place's share of its side's
     * weight, in `[0, 1]`.
     */
    readonly weightMoved: number | null;
    /** Appearances in excess of openings across the bearing pages in the earlier window, added once per comparable place. */
    readonly driftWas: number;
    /** The same for the later window. */
    readonly driftNow: number;
    /** Openings in the earlier window, across the bearing pages, whose reading no rollup has folded. */
    readonly pendingWas: number;
    /** The same for the later window. */
    readonly pendingNow: number;
    /**
     * Comparable places reporting more reach inside them than their page had
     * appearances, on either side, which no rollup produces.
     */
    readonly unreconciled: number;
    /** Nothing straddled on either side, nothing is pending and nothing is unreconciled, so both shares are exact. */
    readonly exact: boolean;
    /**
     * Why the shares are not there, and `null` where they are.
     */
    readonly silence: SenderReachChangeSilence | null;
};

LibrarySendersReachChangetype

What a change did to what a deployment's silent components cost its readers, by kind of part.

type LibrarySendersReachChange = {
    /**
     * Every type that stands in either window, most readings lost first.
     */
    readonly byType: readonly KindSenderReachChange[];
    /** Every role in the vocabulary, then the row for parts whose type declared none, in the same order. */
    readonly byRole: readonly KindSenderReachChange[];
    /** Forms read in both windows: a page in one of its forms, never a revision. */
    readonly pages: number;
    /** Forms read in the later window only, which is not pages published. */
    readonly pagesGained: number;
    /** Forms read in the earlier window only, which is not pages withdrawn. */
    readonly pagesLost: number;
    /** The audiences each window's forms named, published and never refused. */
    readonly audiences: ComparedPopulations;
    /**
     * Paired pages whose revision moved between the windows.
     */
    readonly republished: number;
    /** Places that stand in both windows, which is the sum of every type row's {@link KindSenderReachChange.places}. */
    readonly placements: number;
    /** Places in the later window only. */
    readonly gained: number;
    /** Places in the earlier window only. */
    readonly lost: number;
    /** Paired nodes whose primitive type changed: a place one kind left and another took. */
    readonly recast: number;
    /** Paired places with something inside them on both sides, over the whole library. */
    readonly inhabited: number;
    /** Places the defect could be seen on in both windows, over the whole library. */
    readonly checkable: number;
    /** Of them, those with a verdict on both sides. */
    readonly comparable: number;
    /** Comparable places that went from silent to reporting, over the whole library. */
    readonly repaired: number;
    /** Comparable places that went from reporting to silent. */
    readonly wentSilent: number;
    /** Comparable places silent in both windows, which is what a fix has not reached yet. */
    readonly keptSilent: number;
    /** Comparable places reporting in both. */
    readonly keptReporting: number;
    /** Checkable places unclaimed on one of the two sides, over the whole library. */
    readonly indeterminate: number;
    /**
     * Page views counted at the door across the paired pages in the earlier
     * window, added **once per page**.
     */
    readonly arrivalsWas: number;
    /** The same for the later window. */
    readonly arrivalsNow: number;
    /** Paired pages the door could scale in **both** windows, which is where every weight here comes from. */
    readonly scaled: number;
    /**
     * The paired pages bearing a comparable place that the door could not scale,
     * by tree, newest revision first, with the side they are on.
     */
    readonly unscaled: readonly UnscaledSide[];
    /**
     * The type whose silence costs the fewest readings now against the most
     * before — **what the release was worth.**
     */
    readonly mostRecovered: KindSenderReachChange | null;
    /**
     * The type whose silence costs the most readings now against the fewest
     * before, by the same rule.
     */
    readonly mostCostly: KindSenderReachChange | null;
    /** Forms read at two revisions in one window, which are in nothing above. */
    readonly ambiguous: readonly PageForm[];
    /** Readings of a revision beyond the first, on either side, which were dropped. */
    readonly duplicated: number;
    /**
     * Door rows for one revision beyond the first, across the pages of both
     * windows, which were ignored.
     */
    readonly duplicatedRows: number;
    /** Types the two windows disagree about the role of, where the later window's answer stands. */
    readonly roleDisagreed: readonly PrimitiveType[];
};

librarySendersReachChangeOffunction

What a change did to what a deployment's silent components cost the readers who got inside them.

Shown in use on What your readers do — A part that said nothing

const librarySendersReachChangeOf: (was: LibraryWindow, now: LibraryWindow) => LibrarySendersReachChange

Library word reach change

signals/library-word-reach-change

The words of a kind of part the typical reader who met it reached — before and after.

KindWordReachChangeSilencetype

Why there is no before and after for the words a kind of part puts in front of a reader.

type KindWordReachChangeSilence =
/**
 * Nothing in the pages read, in either window, is of this kind.
 */
"unplaced"
/**
 * It stands in both windows and in no place that is in both.
 */
 | "unpaired"
/**
 * No place of it that stands in both windows carries a passage both revisions
 * say the same way.
 */
 | "wordless"
/**
 * No carried word of it can be spoken for in both windows.
 */
 | "unread"
/**
 * A page bearing a comparable word of it has no page-view row at the door, on
 * one of the two sides.
 */
 | "unscaled"
/**
 * A page bearing a comparable word of it has a row and nothing in it says a
 * page view began.
 */
 | "unopened"
/**
 * A page bearing a comparable word of it has openings and no rollup has
 * folded a window of them yet.
 */
 | "uncounted"
/**
 * Some comparable word of it is a floor, so the movement cannot be signed.
 */
 | "floored";

KIND_WORD_REACH_CHANGE_SILENCESvalue

const KIND_WORD_REACH_CHANGE_SILENCES: readonly KindWordReachChangeSilence[]

describeKindWordReachChangeSilencefunction

One line per silence, for a surface saying why a kind has no before and after.

const describeKindWordReachChangeSilence: (silence: KindWordReachChangeSilence) => string

KindWordReachMovementtype

What happened to the words of a kind of part the typical reader reached.

type KindWordReachMovement =
/** The typical reader who met it reaches more of its words now. */
"taken-up"
/** They reach fewer. */
 | "abandoned"
/**
 * They reach exactly as many.
 */
 | "held"
/**
 * No reader reached a word it kept, in either window.
 */
 | "still-unread"
/** {@link KindWordReachChange.silence} says why nothing can be said. */
 | "unknown";

KIND_WORD_REACH_MOVEMENTSvalue

const KIND_WORD_REACH_MOVEMENTS: readonly KindWordReachMovement[]

describeKindWordReachMovementfunction

One line per movement, for a surface putting a kind's words in front of a person.

const describeKindWordReachMovement: (movement: KindWordReachMovement) => string

ReaderWordstype

The words one reader got to, before and after, with the evidence behind both sides.

type ReaderWords = {
    /**
     * Passages both revisions say word for word, across the places of this kind
     * that stand in both windows.
     */
    readonly passages: number;
    /** The words those passages say, which is the mass this reading is about. */
    readonly carried: number;
    /**
     * Of {@link passages}, those with a verdict on **both** sides, which is the
     * set every figure below is taken over.
     */
    readonly spoken: number;
    /** The words those passages say: the universe of both masses. */
    readonly comparable: number;
    /** Carried words `unknown` on one side or the other, which are in no mass. */
    readonly unspoken: number;
    /**
     * Comparable passages whose word count is a floor, because the part saying
     * them declares no `copy`.
     */
    readonly floored: number;
    /** The visible words in those passages, which is the part of the mass that is certain. */
    readonly flooredWords: number;
    /**
     * Page views at the door's scale across the pages bearing a comparable word
     * of it, in the earlier window, added **once per page**.
     */
    readonly countedWas: number | null;
    /** The same for the later window. */
    readonly countedNow: number | null;
    /**
     * Reader-words in the earlier window at the door's scale:
     * `Σ readers × words` per page, scaled by `counted ÷ appearances`.
     */
    readonly reachedWas: number | null;
    /** The same for the later window. */
    readonly reachedNow: number | null;
    /**
     * `reachedWas ÷ countedWas` — the carried words the typical reader who met it
     * reached, in the earlier window.
     */
    readonly typicalWas: number | null;
    /** The same in the later window, over the same words. */
    readonly typicalNow: number | null;
    /** `typicalNow − typicalWas`, in words per reader. Withheld under a floor. */
    readonly shift: number | null;
    /**
     * The movement stated at the later window's scale: `shift × countedNow`.
     */
    readonly wordsMoved: number | null;
    /**
     * The later window's per-page rates at the earlier window's weights: the
     * words there would have been if no page's traffic had moved.
     */
    readonly ifTrafficHeld: number | null;
    /**
     * The earlier window's per-page rates at the later window's weights: the
     * words there would have been if no reader had read differently.
     */
    readonly ifReadingHeld: number | null;
    /**
     * How far the weights moved: half the sum of the absolute movements in each
     * page's share of its side's total weight, in `[0, 1]`.
     */
    readonly weightMoved: number | null;
    /** Appearances in excess of openings in the earlier window, over the weighted pages. */
    readonly driftWas: number;
    /** The same for the later window. */
    readonly driftNow: number;
    /** Openings in the earlier window, over the weighted pages, whose reading no rollup has folded. */
    readonly pendingWas: number;
    /** The same for the later window. */
    readonly pendingNow: number;
    /**
     * Comparable passages reporting more readers than their page had appearances,
     * on either side, which no rollup produces.
     */
    readonly unreconciled: number;
    /**
     * Nobody's visit spanned a window on either side, nothing is waiting to be
     * folded, nothing is unreconciled and no word is a floor — so both levels are
     * exact.
     */
    readonly exact: boolean;
};

KindWordReachChangetype

One kind of part, held against itself across two windows, by the words one reader got to.

type KindWordReachChange = {
    readonly kind: KindKey;
    /**
     * What part a type plays, or `null`. Always `null` on a role row,
     * which carries it as its key.
     */
    readonly role: PrimitiveRole | null;
    /** Places of this kind that stand in both windows: the same node of the same page, of this kind on both sides. */
    readonly places: number;
    /** Places of it in the later window with no counterpart in the earlier one. */
    readonly gained: number;
    /** Places of it in the earlier window with no counterpart in the later one. */
    readonly lost: number;
    /**
     * Places of it held still whose text the change rewrote, which are in no mass.
     */
    readonly rewritten: number;
    /**
     * Pages bearing a comparable word of it, which is **forms** and not
     * revisions.
     */
    readonly pages: number;
    readonly words: ReaderWords;
    readonly movement: KindWordReachMovement;
    /** Which side was sufficient, or `null` where the figure did not move or is withheld. */
    readonly cause: ReaderShareCause | null;
    /**
     * Why the figures are not there, and `null` where they are.
     */
    readonly silence: KindWordReachChangeSilence | null;
};

LibraryWordReachChangetype

What a change did to the words a deployment's library puts in front of one reader.

type LibraryWordReachChange = {
    /**
     * Every type that stands in either window, most reader-words lost first.
     */
    readonly byType: readonly KindWordReachChange[];
    /**
     * Every role in the vocabulary, then the row for parts whose type declared
     * none, in the same order as {@link byType}.
     */
    readonly byRole: readonly KindWordReachChange[];
    /**
     * The whole library's carried words, added across every kind exactly once.
     */
    readonly words: ReaderWords;
    /** Forms read in both windows: a page in one of its forms, never a revision. */
    readonly pages: number;
    /** Forms read in the later window only, which is not pages published. */
    readonly pagesGained: number;
    /** Of {@link pagesGained}, forms whose page the earlier window already held. */
    readonly formsGained: number;
    /** Forms read in the earlier window only, which is not pages withdrawn. */
    readonly pagesLost: number;
    /** Of {@link pagesLost}, forms whose page the later window still holds. */
    readonly formsLost: number;
    /** The audiences each window's forms named, published and never refused. */
    readonly audiences: ComparedPopulations;
    /**
     * Paired pages whose revision moved between the windows.
     */
    readonly republished: number;
    /** Places that stand in both windows, of the same type on both sides. */
    readonly placements: number;
    /** Places in the later window only. */
    readonly gained: number;
    /** Places in the earlier window only. */
    readonly lost: number;
    /** Paired nodes whose primitive type changed: a place one kind left and another took. */
    readonly recast: number;
    /** Places held still whose text the change rewrote, across every kind once. */
    readonly rewritten: number;
    /**
     * Page views counted at the door across the paired pages in the earlier
     * window, added once per page.
     */
    readonly arrivalsWas: number;
    /** The same for the later window. */
    readonly arrivalsNow: number;
    /** Paired pages the door could scale in **both** windows, which is where every figure here comes from. */
    readonly scaled: number;
    /**
     * The paired pages bearing a comparable word that the door could not scale,
     * by tree, newest revision first, with the side they are on.
     */
    readonly unscaled: readonly UnscaledSide[];
    /**
     * The type that lost the most reader-words, which is the kind to look at
     * first.
     */
    readonly mostAbandoned: KindWordReachChange | null;
    /** The type that gained the most reader-words, by the same rule. */
    readonly mostTakenUp: KindWordReachChange | null;
    /**
     * Forms read at two revisions in one window, which are in nothing above.
     */
    readonly ambiguous: readonly PageForm[];
    /** Readings of a revision beyond the first, on either side, which were dropped. */
    readonly duplicated: number;
    /**
     * Door rows for one revision beyond the first, across the pages of both
     * windows, which were ignored.
     */
    readonly duplicatedRows: number;
    /** Types the two windows disagree about the role of, where the later window's answer stands. */
    readonly roleDisagreed: readonly PrimitiveType[];
};

libraryWordReachChangeOffunction

The words of a kind of part the typical reader who met it reached, before and after.

const libraryWordReachChangeOf: (was: LibraryWindow, now: LibraryWindow) => LibraryWordReachChange

Memory

signals/memory

The buffer and the counters, in the process.

memoryReaderSignalJournalfunction

Shown in use on What your readers do — Where a batch goes after that

const memoryReaderSignalJournal: (clock?: Clock) => ReaderSignalJournal

memoryReaderTallyStorefunction

const memoryReaderTallyStore: () => ReaderTallyStore

memoryReaderRegionStorefunction

Where readers were, in the process.

const memoryReaderRegionStore: () => ReaderRegionStore

Notice

signals/notice

What a published page reports, written for the people it reports about.

FieldSubjecttype

What one field of a delivery is about.

type FieldSubject =
/** The part of the page the observation is about. */
"part"
/** Which page, which revision of it, and which form was served. */
 | "page"
/** What was observed about the part — when, how long, open or closed. */
 | "observation"
/**
 * The one visit the delivery belongs to.
 */
 | "page-view"
/** The delivery itself — when it was sent, and what it carried. */
 | "delivery";

FIELD_SUBJECTSvalue

The closed set, for a surface grouping a notice by what its fields are about.

const FIELD_SUBJECTS: readonly FieldSubject[]

describeFieldSubjectfunction

One line per subject, addressed to the reader, for a surface grouping a notice.

const describeFieldSubject: (subject: FieldSubject) => string

CollectedFieldtype

One field of a payload, and what it says.

type CollectedField = {
    /** The field's name in the delivery, which is what a reader comparing this to a payload sees. */
    readonly field: string;
    /** What it is about. */
    readonly subject: FieldSubject;
    /** One sentence, addressed to the reader. */
    readonly says: string;
};

SIGNAL_FIELDSvalue

Every kind's fields.

const SIGNAL_FIELDS: {
    readonly [Kind in ReaderSignalKind]: FieldsOf<Extract<ReaderSignal, {
        kind: Kind;
    }>>;
}

DELIVERY_FIELDSvalue

What travels with a delivery, whatever observations are in it.

const DELIVERY_FIELDS: FieldsOf<ReaderSignalBatch>

Refusaltype

Something a reader signal never carries, whatever a deployment configures.

type Refusal =
/**
 * No identifier for a person or a device, and nothing standing in for one.
 */
"no-identifier"
/** No signature derived from a device, a browser or its settings. */
 | "no-fingerprint"
/** Nothing the page said to you and nothing you said to it. */
 | "no-content"
/** No cursor, no scroll trace, no recording. */
 | "no-pointer-path"
/** Nothing that joins one visit to another. */
 | "no-stitching"
/** Nothing derived from your address outlives the request it arrived on. */
 | "no-address";

REFUSALSvalue

The closed set, for a surface listing what is refused.

const REFUSALS: readonly Refusal[]

describeRefusalfunction

One line per refusal, addressed to the reader.

const describeRefusal: (refusal: Refusal) => string

RegionNoticetype

Where a deployment counts its readers from, or that it does not.

type RegionNotice = {
    /**
     * The page views a country needs before it is published at all, or `null`
     * where no country is read.
     */
    readonly floor: number | null;
};

describeRegionNoticefunction

One or two sentences about where readers are counted from, addressed to the reader.

const describeRegionNotice: (notice: RegionNotice) => string

SweepNoticetype

How often the deployment's own sweep runs, or that it has not said.

type SweepNotice = {
    readonly state: "stated";
    /** The longest the deployment lets pass between sweeps, as it stated it. */
    readonly everyMs: number;
    /**
     * The longest a delivery can live: the later of its two windows, plus one
     * sweep interval.
     */
    readonly goneWithinMs: number;
}
/** Nothing was stated, so nothing here says when a ripe delivery actually goes. */
 | {
    readonly state: "unstated";
};

CollectionNoticetype

What a published page reports, and what it refuses to.

type CollectionNotice = {
    /** The kinds this configuration broadcasts, in the vocabulary's order. */
    readonly collects: readonly CollectedKind[];
    /** What travels with every delivery. */
    readonly delivery: readonly CollectedField[];
    /** What is never collected, whatever else is configured. */
    readonly refuses: readonly Refusal[];
    /** Where readers are counted from, or that they are not. */
    readonly region: RegionNotice;
    /**
     * How long a delivery waits before it is counted into the totals, in
     * milliseconds.
     */
    readonly bufferMs: number;
    /**
     * How long a delivery itself is kept, measured from when it arrived, in
     * milliseconds.
     */
    readonly keptMs: number;
    /**
     * How often this deployment sweeps, where it has stated it.
     */
    readonly sweep: SweepNotice;
};

CollectedKindtype

One kind of observation, with the fields it carries.

type CollectedKind = {
    readonly kind: ReaderSignalKind;
    /** What the page observed, addressed to the reader. */
    readonly observes: string;
    /** Every field that kind carries, including the ones it sometimes omits. */
    readonly carries: readonly CollectedField[];
};

DeliveryRetentiontype

Every part of how long a delivery lives: the age it is counted at, the age it is deleted at, and how often the deployment's sweep runs.

type DeliveryRetention = Pick<CollectionNotice, "bufferMs" | "keptMs" | "sweep">;

describeBufferfunction

How long a delivery lives, addressed to the reader.

const describeBuffer: (retention: DeliveryRetention) => string

NoticeRequesttype

The configuration a notice is of.

type NoticeRequest = {
    /**
     * The options the page is broadcast with — the same object, so that a notice
     * and the page it is about cannot disagree about which kinds are reported.
     */
    readonly page?: Pick<ReaderSignalOptions, "kinds">;
    /**
     * The window the deployment collects on, from its own `CollectionRequest`
     * (`collect.ts`). The default when absent.
     */
    readonly windowMs?: number;
    /**
     * The region counting this deployment's intake does, where it does any.
     */
    readonly region?: {
        readonly floor?: number | undefined;
    };
    /**
     * How often this deployment's sweep runs, where it has stated it.
     */
    readonly sweep?: {
        readonly everyMs: number;
    };
    /**
     * The window this deployment keeps individual deliveries for, from its own
     * `ExpiryRequest` (`expire.ts`). The default when absent.
     */
    readonly keptMs?: number;
};

collectionNoticeOffunction

What a page broadcast with these options reports, as a deployment may publish it.

const collectionNoticeOf: (request?: NoticeRequest) => CollectionNotice

Pace

signals/pace

Whether a part was read or scrolled past.

READING_WORDS_PER_MINUTEvalue

The rate a page's words are costed at, in words per minute.

const READING_WORDS_PER_MINUTE = 240

SKIMMED_BELOWvalue

Below this much of the time its words take, a part was not read.

const SKIMMED_BELOW = 0.5

LINGERED_ABOVEvalue

Above this much, readers stayed longer than the words account for.

const LINGERED_ABOVE = 3

PaceStandingtype

What the time readers spent says about the words a part puts in front of them.

type PaceStanding =
/**
 * Readers had less than {@link SKIMMED_BELOW} of the time the words take.
 */
"skimmed"
/** Time enough for the words, and not conspicuously more. */
 | "paced"
/** More than {@link LINGERED_ABOVE} times the time the words take. */
 | "lingered"
/** Nothing can be said, and {@link PacedPart.silence} says which nothing. */
 | "unknown";

PACE_STANDINGSvalue

const PACE_STANDINGS: readonly PaceStanding[]

PaceSilencetype

Why a part has no pace.

type PaceSilence =
/**
 * No view reported it coming into view, so there is no time to divide and no
 * reader to divide it between.
 */
"unreached"
/**
 * Its words are a floor, and the verdict that floor would support is not the
 * safe one.
 */
 | "unreadable"
/**
 * It says nothing, as far as anything can tell: no words, and nothing
 * undeclared either.
 */
 | "wordless";

PACE_SILENCESvalue

const PACE_SILENCES: readonly PaceSilence[]

describePaceStandingfunction

One line per standing, for a surface putting the reading in front of a person.

const describePaceStanding: (standing: PaceStanding) => string

describePaceSilencefunction

One line per silence, for the same surface.

const describePaceSilence: (silence: PaceSilence) => string

PacedParttype

One part, with the time its readers had against the time its words take.

type PacedPart = {
    readonly nodeId: NodeId;
    readonly type: PrimitiveType;
    /** What part it plays, or `null` where its type declared none. */
    readonly role: PrimitiveRole | null;
    /** 0 at the root. */
    readonly depth: number;
    /**
     * The **tree** parent, which may be a slot and is then a node no reading has
     * a row for, and `null` at the root.
     */
    readonly parentId: NodeId | null;
    /**
     * The part this part sits inside, and `null` at the outermost part.
     */
    readonly withinId: NodeId | null;
    /** Distinct page views that reported it coming into view; `0` where no row named it. */
    readonly readers: number;
    /** The words this part says itself, counted. Its own, never its subtree's. */
    readonly words: number;
    /**
     * The words of this part and everything under it.
     */
    readonly wordsWithin: number;
    /**
     * Whether {@link wordsWithin} is a floor rather than a count.
     */
    readonly floored: boolean;
    /** Time on screen, summed across every view in the window. */
    readonly dwellMs: number;
    /**
     * The same time per reader, after {@link PaceOptions.inflation}.
     */
    readonly spentMs: number | null;
    /** What {@link wordsWithin} takes at the costing rate. `0` where it says nothing. */
    readonly needMs: number;
    /**
     * Time spent for every unit of time the words take. `1` is exactly enough.
     */
    readonly pace: number | null;
    readonly standing: PaceStanding;
    /** Why there is no verdict, and `null` where there is one. */
    readonly silence: PaceSilence | null;
    /**
     * Readers times the words they were shown here — the ranking key, and a
     * magnitude rather than a census.
     */
    readonly wordsPassed: number;
};

PagePacetype

type PagePace = {
    readonly treeId: TreeId;
    readonly revision: number;
    /** The page's view floor, carried through from the reading unchanged. */
    readonly views: number;
    /** Every element part of the revision, in reading order. */
    readonly parts: readonly PacedPart[];
    readonly standings: Readonly<Record<PaceStanding, number>>;
    /** Why the parts with no verdict have none. Counts only the silent ones. */
    readonly silences: Readonly<Record<PaceSilence, number>>;
    /**
     * The root, judged against the whole page.
     */
    readonly whole: PacedPart | null;
    /**
     * The part of the page most words went unread in: most words passed, then
     * first in reading order.
     */
    readonly mostSkimmed: PacedPart | null;
    /** The inflation that was applied; `0` when none was given. */
    readonly inflation: number;
    /** The costing rate that was applied, which is the default unless one was given. */
    readonly wordsPerMinute: number;
};

PaceOptionstype

type PaceOptions = {
    /**
     * How generous the reader counts are, as `drift ÷ opened` off the page-view
     * rows.
     */
    readonly inflation?: number;
    /**
     * The costing rate, where {@link READING_WORDS_PER_MINUTE} is wrong for this
     * deployment's text.
     */
    readonly wordsPerMinute?: number;
};

paceStandingOffunction

The verdict, which is the asymmetry of the module documentation written once.

const paceStandingOf: (pace: number | null, floored: boolean) => PaceStanding

readingPaceOffunction

Whether readers had time to read what each part of a page says.

const readingPaceOf: (reading: PageReading, options?: PaceOptions) => PagePace

Pace change

signals/pace-change

What a change did to whether readers had time to read what a page says.

PaceChangeSilencetype

Why a comparison of two windows' pace answered nothing.

type PaceChangeSilence =
/**
 * The two readings are of different trees.
 */
"different-trees"
/**
 * The two readings are of two audiences, and so of two populations.
 */
 | "different-audiences"
/**
 * Neither revision says anything that takes time to read.
 */
 | "wordless"
/**
 * One of the two windows holds two forms of the page and named neither.
 */
 | "audiences-mixed"
/**
 * One of the two windows held no page views.
 */
 | "nothing-measured"
/**
 * No part of the page is in both revisions, so there is nothing to compare.
 */
 | "dissolved";

PACE_CHANGE_SILENCESvalue

The closed set, for a surface that has to account for every absent figure.

const PACE_CHANGE_SILENCES: readonly PaceChangeSilence[]

describePaceChangeSilencefunction

One line per silence, for a surface saying why a figure is not there.

const describePaceChangeSilence: (silence: PaceChangeSilence) => string

PaceMovementtype

What happened to the verdict on one part between two windows.

type PaceMovement =
/**
 * Skimmed before, and not now — the sentence a rewrite is made for.
 */
"eased"
/** Read before, and skimmed now. */
 | "rushed"
/**
 * Skimmed before and skimmed now — the parts a change did not fix.
 */
 | "still-skimmed"
/** Read on both sides, whether paced or lingered. */
 | "held"
/**
 * One side has no verdict, so there is nothing to compare.
 */
 | "unknown";

PACE_MOVEMENTSvalue

The closed set, for a surface accounting for every part it was handed.

const PACE_MOVEMENTS: readonly PaceMovement[]

describePaceMovementfunction

One line per movement, for a surface putting a part in front of a person.

const describePaceMovement: (movement: PaceMovement) => string

PaceCausetype

Which side of the division the verdict moved with.

type PaceCause =
/**
 * The change alone was enough: the words the later revision asks for would
 * have produced today's verdict at the earlier window's reading time.
 */
"words"
/**
 * The readers alone were enough: the later window's time would have produced
 * today's verdict against the words the page used to say.
 */
 | "time"
/** Either alone would have been enough, so the move is over-determined. */
 | "either"
/** Neither alone would have been enough and the two together were. */
 | "together"
/**
 * A counterfactual has no verdict, so neither question can be answered.
 */
 | "unknown";

PACE_CAUSESvalue

The closed set, for a surface accounting for every verdict that moved.

const PACE_CAUSES: readonly PaceCause[]

describePaceCausefunction

One line per cause, for a surface saying what moved a verdict.

const describePaceCause: (cause: PaceCause) => string

PaceHeldtype

A pace neither window reported, and the verdict it would have carried.

type PaceHeld = {
    /** `null` where there is nothing to divide: no reader on the side the time came from, or no words on the side the words came from. */
    readonly pace: number | null;
    /**
     * The verdict that pace carries, under **either** side's floor.
     */
    readonly standing: PaceStanding;
};

ComparedPacetype

One part both revisions have, as two windows paced it.

type ComparedPace = {
    readonly nodeId: NodeId;
    /** The later revision's type, which is the page somebody is looking at. */
    readonly type: PrimitiveType;
    /** The later revision's role, or `null` where its type declared none. */
    readonly role: PrimitiveRole | null;
    /** The whole of what the earlier window said about it. */
    readonly was: PacedPart;
    /** The whole of what the later window said about it. */
    readonly now: PacedPart;
    readonly movement: PaceMovement;
    /**
     * `now.pace ÷ was.pace`, with the reason named where there is no quotient
     *.
     */
    readonly paceRatio: Ratio;
    /**
     * `now.spentMs ÷ was.spentMs` — the readers' side of the division.
     */
    readonly timeRatio: Ratio;
    /**
     * `now.needMs ÷ was.needMs` — the page's side of the division.
     */
    readonly needRatio: Ratio;
    /** The later window's time against the earlier revision's words — the readers alone. */
    readonly ifWordsHeld: PaceHeld;
    /** The earlier window's time against the later revision's words — the change alone. */
    readonly ifTimeHeld: PaceHeld;
    /** Which side the verdict moved with, and `null` where it did not move. */
    readonly cause: PaceCause | null;
};

TimeCounttype

A time total, before and after, with the subtraction done once.

type TimeCount = {
    readonly was: number;
    readonly now: number;
    readonly change: number;
};

PaceChangetype

What a change did to the time a page's words ask of its readers, and to whether they had it.

type PaceChange = {
    /** The earlier reading's tree. The two agree unless `silence` is `different-trees`. */
    readonly treeId: TreeId;
    readonly revisions: {
        readonly was: number;
        readonly now: number;
    };
    /**
     * The audience each side was of, where its reading named one.
     */
    readonly audiences: ComparedAudiences;
    /** The two pace readings this comparison is made of. */
    readonly readings: {
        readonly was: PagePace;
        readonly now: PagePace;
    };
    /**
     * Every part both revisions have that says something on either side, in the
     * **later** reading order.
     */
    readonly compared: readonly ComparedPace[];
    /**
     * Parts only the later revision has, as it paced them, in its reading order.
     */
    readonly added: readonly PacedPart[];
    /** Parts only the earlier revision had, as it paced them, in its reading order. */
    readonly removed: readonly PacedPart[];
    /** Compared parts by what happened to the verdict. The five add to {@link compared}'s length. */
    readonly movements: Readonly<Record<PaceMovement, number>>;
    /**
     * The parts whose verdict moved, by what moved it. The five add to
     * `movements.eased + movements.rushed`.
     */
    readonly causes: Readonly<Record<PaceCause, number>>;
    /**
     * The root, compared against itself across the two revisions.
     */
    readonly whole: ComparedPace | null;
    /**
     * The part the change made most room to read: `eased`, most words passed
     * now, then first in the later reading order.
     */
    readonly mostEased: ComparedPace | null;
    /** The part it cost most, on the same terms. */
    readonly mostRushed: ComparedPace | null;
    /**
     * The parts readers skimmed before and skim now, most words passed first,
     * then in the later reading order.
     */
    readonly stillSkimmed: readonly ComparedPace[];
    /**
     * What the two revisions ask of a reader who reads every word of them, before
     * and after.
     */
    readonly need: TimeCount | null;
    /** Why there is no comparison of the reading, or `null` where there is one. */
    readonly silence: PaceChangeSilence | null;
    /** The costing rate both sides were read at, which is the published default unless one was given. */
    readonly wordsPerMinute: number;
    /** The straddle correction applied to each side; `0` where none was given. */
    readonly inflation: {
        readonly was: number;
        readonly now: number;
    };
};

PaceChangeOptionstype

How the two sides were read.

type PaceChangeOptions = {
    readonly inflation?: {
        readonly was?: number;
        readonly now?: number;
    };
    readonly wordsPerMinute?: number;
};

paceChangeOffunction

What a change did to whether readers had time for what a page says.

const paceChangeOf: (was: PageReading, now: PageReading, options?: PaceChangeOptions) => PaceChange

Page views

signals/page-views

How many page views there were — the number every rate on a screen is taken of, and the one number this subsystem could not state.

RevisionViewstype

One revision's worth of page views, as whichever side counted them.

type RevisionViews = {
    readonly treeId: TreeId;
    readonly revision: number;
    readonly views: number;
};

ReaderPageViewstype

Page views of one revision of one tree, counted from both ends.

type ReaderPageViews = {
    readonly treeId: TreeId;
    readonly revision: number;
    /**
     * Page views that *began* on this revision.
     */
    readonly opened: number;
    /**
     * The same page views as the rollups saw them: once per window each appeared
     * in.
     */
    readonly appearances: number;
};

StoredPageViewstype

A page-view row as the store keeps it, which is the pair, when it last moved, and when the fold last touched it.

type StoredPageViews = ReaderPageViews & {
    /** The audience these page views were served under. See `StoredTally.audienceId`. */
    readonly audienceId: AudienceId;
    /**
     * When either writer last moved this row.
     */
    readonly updatedAt: string;
    /**
     * When a rollup last folded a window holding page views of this revision, or
     * absent where nothing attests a fold.
     */
    readonly foldedAt?: string;
};

openingsOffunction

The page views a delivery opened, per revision, deduplicated by view key.

const openingsOf: (batches: readonly ReaderSignalBatch[]) => readonly RevisionViews[]

RevisionPageViewstype

One revision, as a reading reports it — the stored row, and what subtracting its two numbers says.

type RevisionPageViews = ReaderPageViews & {
    /**
     * The audience this reading is of, or `null` where it is of every form the
     * window held.
     */
    readonly audienceId: AudienceId | null;
    /**
     * The audiences whose rows were added into this reading, deduplicated and in
     * a stable order.
     */
    readonly audiences: readonly AudienceId[];
    /**
     * When either writer last moved a row behind this reading — the newest of
     * them where it is a sum, because the question is when the number last
     * changed and the busiest form is what last changed it.
     */
    readonly updatedAt: string;
    /**
     * The fold this reading is waiting on: the oldest fold attested by a row that
     * still has openings pending, or the oldest attested of them all where none
     * has, and absent where nothing attests one.
     */
    readonly foldedAt?: string;
    /**
     * Appearances in excess of openings — the over-count in every distinct view
     * count stored against this revision, measured rather than bounded.
     */
    readonly drift: number;
    /**
     * Page views that began and whose batches no rollup has folded yet — the
     * buffer, as a number.
     */
    readonly pending: number;
    /**
     * `drift ÷ opened`: how generous the distinct counts against this revision
     * are, as a fraction. `null` when nothing has opened, because the question
     * has no answer rather than the answer nought.
     */
    readonly inflation: number | null;
};

PageViewReadingtype

type PageViewReading = {
    /** Page views that began, across every row read. Exact, and addable. */
    readonly opened: number;
    readonly appearances: number;
    readonly drift: number;
    readonly pending: number;
    readonly inflation: number | null;
    /** Newest revision first, trees in id order, so a screen does not reorder on a refresh. */
    readonly revisions: readonly RevisionPageViews[];
};

pageViewReadingOffunction

Rows from the store, read as something a screen may show.

const pageViewReadingOf: (rows: readonly StoredPageViews[]) => PageViewReading

PageViewsFortype

The page-view row a reading of one revision should be divided by, picked out of a window of rows.

type PageViewsFor = {
    /**
     * This revision's door, read through {@link pageViewReadingOf}, or `null`
     * where this revision has none.
     */
    readonly measured: RevisionPageViews | null;
    /**
     * Rows for another tree or another revision, and ignored.
     */
    readonly foreign: number;
    /**
     * Rows for this tree and revision, in another audience, and ignored.
     */
    readonly otherAudience: number;
    /**
     * Rows for this tree, revision **and audience** beyond the first of that
     * audience, where every one after it was ignored.
     */
    readonly duplicated: number;
};

RevisionOftype

A revision of a tree, and the audience the asking is about.

type RevisionOf = {
    readonly treeId: TreeId;
    readonly revision: number;
    readonly audienceId?: AudienceId | null;
};

pageViewsForfunction

Read one revision's door out of a window of rows.

const pageViewsFor: (where: RevisionOf, rows: readonly StoredPageViews[]) => PageViewsFor

inflationForfunction

The straddle correction for one revision of one page: drift ÷ opened off that page's own door — its own form's row where the asking names an audience, and the sum of every form's where it names none.

const inflationFor: (where: RevisionOf, rows: readonly StoredPageViews[]) => number | null

Part pace

signals/part-pace

Whether the readers who reach **one part** have time for what it says, across every page it stands on.

describePartPaceSilencefunction

One line per silence, for a surface saying why one part has no pace.

const describePartPaceSilence: (silence: KindPaceSilence) => string

PacedPlacetype

One page a part stands on, with that page's own figures.

type PacedPlace = {
    readonly treeId: TreeId;
    readonly revision: number;
    /** The audience this page's counters are of, as the reading has it; `null` where nothing said. */
    readonly audienceId: AudienceId | null;
    /**
     * Page views that reached the part here, at this page's own door scale.
     */
    readonly readers: number;
    /** Time on screen here, summed across every view in the window, exactly as the rows hold it. */
    readonly dwellMs: number;
    /** The words this placement puts on screen: its own and its subtree's, which is the denominator's input. */
    readonly wordsWithin: number;
    /** Whether {@link wordsWithin} is a floor rather than a count, because something in it declares no `copy`. */
    readonly floored: boolean;
    /** Whether the part is this page's root, so its words are every word the page says. */
    readonly whole: boolean;
    /**
     * Why no straddle correction was applied to this page's readers, and `null`
     * where one was.
     */
    readonly unscaled: ReachSilence | null;
    /** `readers × wordsWithin × msPerWord`: the time its words take the readers who reached it here. `null` under a silence. */
    readonly needMs: number | null;
    /** `dwellMs ÷ readers`: the time the typical reader who reached it here had. `null` under a silence. */
    readonly spentMs: number | null;
    /**
     * `needMs − dwellMs` where positive: the reading time this page's readers did
     * not have. The ranking key of {@link PartPace.ranked}, and `null` under a
     * silence.
     */
    readonly shortMs: number | null;
    /** `dwellMs ÷ needMs`. `1` is exactly time enough. `null` under a silence. */
    readonly pace: number | null;
    /** This page's own verdict, by `paceStandingOf` — so one page can be `skimmed` while the part is `paced`. */
    readonly standing: PaceStanding;
    /** Why this page has no figures, and `null` where it has them. */
    readonly silence: PaceSilence | null;
};

MeasuredPlacetype

A placement with figures of its own, which is every row of {@link PartPace.ranked} and no row of {@link PartPace.unranked}.

type MeasuredPlace = PacedPlace & {
    readonly needMs: number;
    readonly spentMs: number;
    readonly shortMs: number;
    readonly pace: number;
    readonly silence: null;
};

PartPacetype

One part, against the time its readers had for what it says, across the pages it stands on.

type PartPace = {
    readonly nodeId: NodeId;
    /**
     * What the part is, as the **first** reading holding it has it, and `null`
     * where no reading holds it at all.
     */
    readonly type: PrimitiveType | null;
    /** What part it plays, as the same reading has it; `null` where its type declared none. */
    readonly role: PrimitiveRole | null;
    /**
     * Types a later reading had this node as, where the first reading's answer
     * stands.
     */
    readonly typeDisagreed: readonly PrimitiveType[];
    /** Readings that hold the part at all, after duplicates are dropped. */
    readonly placements: number;
    /** Placements in the figures: reached, and saying something counted. */
    readonly counted: number;
    /** Why the rest have no pace of their own. The counts add to `placements − counted`. */
    readonly silences: Readonly<Record<PaceSilence, number>>;
    /**
     * Every placement by its own page's verdict, which is the census view of the
     * same set.
     */
    readonly standings: Readonly<Record<PaceStanding, number>>;
    /** Revisions bearing a counted placement. */
    readonly pages: number;
    /** Distinct trees across them, which is pages rather than versions of pages. */
    readonly trees: number;
    /** Counted placements whose words are a floor, because a type in them declares no `copy`. */
    readonly floored: number;
    /**
     * Counted placements that are their page's root.
     */
    readonly whole: number;
    /**
     * Page views that reached a counted placement, at each page's own door scale,
     * counted once per page it stands on.
     */
    readonly readers: number | null;
    /**
     * Time on screen across the counted placements, added, exactly as the rows
     * hold it.
     */
    readonly dwellMs: number;
    /**
     * The time its words take the readers who reached it: `readers × wordsWithin
     * × msPerWord`, added over the counted placements.
     */
    readonly needMs: number | null;
    /**
     * `dwellMs ÷ readers`: **the time the typical reader who reached this part
     * had there**, which is the figure a goal's screen asks for.
     */
    readonly spentMs: number | null;
    /**
     * `needMs − dwellMs` where positive: the reading time its readers did not
     * have. Nought where they had enough, `null` under a silence.
     */
    readonly shortMs: number | null;
    /** `dwellMs ÷ needMs`. `1` is exactly time enough. `null` under a silence. */
    readonly pace: number | null;
    /** The verdict, by `paceStandingOf` — so a floor can hold up anything but `skimmed`. */
    readonly standing: PaceStanding;
    /** Why there is no verdict, and `null` where there is one. */
    readonly silence: KindPaceSilence | null;
    /**
     * Of {@link readers}, those on a page the door could not scale, so no
     * straddle correction was applied to them.
     */
    readonly unscaled: number;
    /**
     * The pages bearing a counted placement that the door could not scale, by
     * tree and newest revision first.
     */
    readonly unscaledPages: readonly UnscaledPage[];
    /**
     * Readings of a revision beyond the first, which were dropped.
     */
    readonly duplicated: number;
    /** Door rows for one revision beyond the first, which were ignored. */
    readonly duplicatedRows: number;
    /**
     * Every page the part is **counted** on, by the reading time its readers did
     * not have, most first.
     */
    readonly ranked: readonly MeasuredPlace[];
    /**
     * Every other page it stands on, by tree id and newest revision first.
     */
    readonly unranked: readonly PacedPlace[];
    /**
     * The head of the order: the one page of this part to go and look at.
     */
    readonly worst: MeasuredPlace | null;
    /** The costing rate that was applied, which is the default unless one was given. */
    readonly wordsPerMinute: number;
};

partPaceOffunction

Whether the readers who reach one part have time for what it says.

const partPaceOf: (nodeId: NodeId, readings: readonly PageReading[], rows: readonly StoredPageViews[], options?: LibraryPaceOptions) => PartPace

Parts

signals/parts

What a counter is about, joined on the server from what the page already knows.

PartStandingtype

What a window of counters says about one part of a page.

type PartStanding =
/** At least one view reported it coming into view. */
"read"
/**
 * The window held views of this revision, and none of them said anything
 * about this part at all.
 */
 | "skipped"
/**
 * Nothing can be said.
 */
 | "unknown";

PART_STANDINGSvalue

const PART_STANDINGS: readonly PartStanding[]

spokenForfunction

Whether the window can say either way, which is the one question every figure over a page's words is restricted by.

const spokenFor: (standing: PartStanding) => boolean

describePartStandingfunction

One line per standing, for a surface putting the reading in front of a person.

const describePartStanding: (standing: PartStanding) => string

PartDeclarationstype

Everything the join asks of a deployment. A PrimitiveRegistry satisfies it.

type PartDeclarations = CopyDeclarations & RoleDeclarations;

PartReadingtype

One element node of one revision, with whatever the window said about it.

type PartReading = {
    readonly nodeId: NodeId;
    readonly type: PrimitiveType;
    /** What part it plays, or `null` where its type declared none. */
    readonly role: PrimitiveRole | null;
    /** 0 at the root. */
    readonly depth: number;
    /**
     * The **tree** parent, which may be a node that is in no part's list, and
     * `null` at the root.
     */
    readonly parentId: NodeId | null;
    /**
     * The nearest **addressed** ancestor — the part this part sits inside — and
     * `null` at the outermost part.
     */
    readonly withinId: NodeId | null;
    readonly standing: PartStanding;
    /**
     * The counters, or `undefined` where no signal in the window named it.
     */
    readonly counters: ReaderTally | undefined;
    /**
     * The words this part says itself: its declared copy props, and the text
     * handed to it directly or through a slot.
     */
    readonly copy: NodeCopy;
};

RoleReadingtype

Every part playing one role, added up.

type RoleReading = {
    /** `null` is the row for parts whose type declared no role, which is most of a page today. */
    readonly role: PrimitiveRole | null;
    /** Element nodes of this revision playing it. */
    readonly parts: number;
    readonly standings: Readonly<Record<PartStanding, number>>;
    readonly dwellMs: number;
    readonly activations: number;
    readonly opens: number;
    readonly closes: number;
    readonly completions: number;
};

PageReadingtype

type PageReading = {
    readonly treeId: TreeId;
    readonly revision: number;
    /**
     * The audience whose counters this reading is of, or `null` where nothing
     * said.
     */
    readonly audienceId: AudienceId | null;
    /**
     * Every audience the window named, whether or not it was the one read.
     */
    readonly audiences: readonly AudienceId[];
    /**
     * Counters filed under this tree and revision, in an audience other than the
     * one read, and ignored.
     */
    readonly otherAudience: number;
    /**
     * A floor on the page views the window held, not a count of them.
     */
    readonly views: number;
    /** Every element node, in reading order. */
    readonly parts: readonly PartReading[];
    /** Every role in the vocabulary, then the row for parts that declared none. */
    readonly roles: readonly RoleReading[];
    readonly standings: Readonly<Record<PartStanding, number>>;
    /**
     * Counters handed in that are filed under another tree or another revision,
     * and were ignored.
     */
    readonly foreign: number;
    /**
     * Counters filed under this tree and revision, naming a node this tree does
     * not contain.
     */
    readonly orphaned: readonly NodeId[];
    /**
     * Nodes handed in more than once, where every row but the first was ignored.
     */
    readonly duplicated: readonly NodeId[];
};

pageReadingOffunction

Join a window's counters to the tree and registry they were filed against.

const pageReadingOf: (tree: LoomTree, tallies: readonly (ReaderTally & MaybeAudienceScoped)[], declarations: PartDeclarations, audience?: AudienceId) => PageReading

wordsReadInfunction

The words readers actually reached, in reading order.

const wordsReadIn: (reading: PageReading) => readonly string[]

Progress

signals/progress

Where in a page reading stops.

ReadingSteptype

One part as a point on its parent's sequence.

type ReadingStep = {
    readonly nodeId: NodeId;
    readonly type: PrimitiveType;
    /** What part it plays, or `null` where its type declared none. */
    readonly role: PrimitiveRole | null;
    readonly standing: PartStanding;
    /**
     * Distinct page views that reported it coming into view, and `0` where no row
     * named it at all.
     */
    readonly reached: number;
    /**
     * Whether this step can be either end of a stop.
     */
    readonly anchors: boolean;
};

ReadingStoptype

Two parts of one run, and the readers who reached the first and not the second.

type ReadingStop = {
    /** The part they reached. */
    readonly after: NodeId;
    /** The next part in the run that could anchor a stop, which fewer reached. */
    readonly before: NodeId;
    /** Views that reached `after`, which is the denominator of `share`. */
    readonly reached: number;
    /** Views that reached `after` and not `before`. */
    readonly lost: number;
    /**
     * `lost ÷ reached`, in `(0, 1]`.
     */
    readonly share: number;
};

ReadingRuntype

One part's children, in the order a reader meets them.

type ReadingRun = {
    /**
     * The part the steps sit inside, which is always a part this reading has a
     * row for.
     */
    readonly withinId: NodeId;
    /**
     * The depth of the part the steps sit inside.
     */
    readonly depth: number;
    readonly steps: readonly ReadingStep[];
    /** Every fall, in run order. */
    readonly stops: readonly ReadingStop[];
    /**
     * The last step in run order that any view reached, or `null` where none did.
     */
    readonly furthest: NodeId | null;
    /**
     * Pairs where more views reached the later part than the earlier one.
     */
    readonly gained: number;
};

ReadingProgresstype

type ReadingProgress = {
    readonly treeId: TreeId;
    readonly revision: number;
    /**
     * The audience the reading was of, carried through unchanged.
     */
    readonly audienceId: AudienceId | null;
    /**
     * Every audience the window named, carried through unchanged.
     */
    readonly audiences: readonly AudienceId[];
    /**
     * The page's view floor, carried through from the reading unchanged.
     */
    readonly views: number;
    /**
     * Every run of two or more children, in reading order.
     */
    readonly runs: readonly ReadingRun[];
    /**
     * The sharpest fall on the page: most views lost, then largest share, then
     * first in reading order.
     */
    readonly steepest: ReadingStop | null;
    /**
     * Parts that could not anchor a stop, because they reported something other
     * than coming into view.
     */
    readonly unanchored: readonly NodeId[];
    /** Every run's {@link ReadingRun.gained}, added. */
    readonly gained: number;
};

readingProgressOffunction

Where reading stops, from a reading of one revision.

const readingProgressOf: (reading: PageReading) => ReadingProgress

Ratios

signals/ratios

A quotient of one window's figure against the other's, and the reason there is not one.

RatioAbsencetype

Why there is no quotient.

type RatioAbsence =
/**
 * One of the two windows did not measure this, so there is nothing to divide.
 */
"unmeasured"
/**
 * Both windows measured it and the earlier one measured nought.
 */
 | "from-nothing";

RATIO_ABSENCESvalue

The closed set, for a surface accounting for every absent quotient.

const RATIO_ABSENCES: readonly RatioAbsence[]

describeRatioAbsencefunction

One line per absence, for a surface saying why a ratio is not there.

const describeRatioAbsence: (absence: RatioAbsence) => string

Ratiotype

A quotient of the later window's figure by the earlier one's, or the reason there is none.

type Ratio = {
    /** `now ÷ was`, or `null` where {@link absent} says why there is none. */
    readonly ratio: number | null;
    /** Why there is no quotient, or `null` where there is one. */
    readonly absent: RatioAbsence | null;
};

ratioOffunction

The later window's figure over the earlier one's, with the absence named.

const ratioOf: (was: number | null | undefined, now: number | null | undefined) => Ratio

Reach

signals/reach

How far into a page readers get, as a share of the readers there were.

ReachSilencetype

Why a share of readers cannot be given at all.

type ReachSilence =
/**
 * No page-view row for this tree and revision.
 */
"unmeasured"
/**
 * The row is there and nothing in it says a page view ever began.
 */
 | "unopened"
/**
 * Readers arrived and no rollup has folded a window yet.
 */
 | "uncounted";

REACH_SILENCESvalue

const REACH_SILENCES: readonly ReachSilence[]

describeReachSilencefunction

One line per silence, for a surface putting the reading in front of a person.

const describeReachSilence: (silence: ReachSilence) => string

PartReachtype

How far one part of a page got, against the readers there were.

type PartReach = {
    readonly nodeId: NodeId;
    readonly type: PrimitiveType;
    /** What part it plays, or `null` where its type declared none. */
    readonly role: PrimitiveRole | null;
    /** 0 at the root, as the reading's outline gives it. */
    readonly depth: number;
    readonly standing: PartStanding;
    /**
     * Distinct page views that saw it, exactly as stored: added across rollup
     * windows and therefore generous.
     */
    readonly reached: number;
    /**
     * The share of page views that got this far, as the rollups counted both
     * ends: `reached ÷ appearances`.
     */
    readonly share: number | null;
    /**
     * The most the share could be: `reached ÷ opened`, never above 1.
     */
    readonly atMost: number | null;
    /**
     * The share applied to the exact count of readers who arrived — the number a
     * sentence can say out loud.
     */
    readonly readers: number | null;
    /**
     * The most readers who could have got here: the smaller of `reached` and the
     * openings, which is a whole number of real page views either way.
     */
    readonly atMostReaders: number | null;
    /**
     * More reach than there were page views to be reached in, so the share sits
     * above 1 and no figure here can be drawn.
     */
    readonly unreconciled: boolean;
};

PageReachtype

A window of counters, read against the exact number of readers that window had.

type PageReach = {
    readonly treeId: TreeId;
    readonly revision: number;
    /** Page views that began on this revision. Exact, and addable. */
    readonly opened: number;
    /** The same page views as the rollups counted them: once per window each appeared in. */
    readonly appearances: number;
    /** Appearances in excess of openings — the straddle, measured. Never negative. */
    readonly drift: number;
    /** Openings whose reading no rollup has folded yet. The other sign of the same subtraction. */
    readonly pending: number;
    /** `drift ÷ opened`: how generous every distinct count here is. `null` when nothing opened. */
    readonly inflation: number | null;
    /** When the page-view row last moved, or `null` where there is no row. */
    readonly updatedAt: string | null;
    /**
     * The floor the counters give on their own: the largest `views` any one row
     * reports.
     */
    readonly countedViews: number;
    /**
     * Set where no share can be given, and the reason. `null` where they can.
     */
    readonly silence: ReachSilence | null;
    /**
     * Nobody's visit spanned two windows, so there is nothing to divide out: the
     * estimate and the ceiling are the same number and the shares are exact.
     */
    readonly exact: boolean;
    /** Every part of the revision, in reading order, as the reading had them. */
    readonly parts: readonly PartReach[];
    /**
     * The parts whose reach could not be reconciled with the openings.
     */
    readonly unreconciled: readonly NodeId[];
    /**
     * Page-view rows handed in for another tree or another revision, and ignored.
     */
    readonly foreign: number;
    /**
     * Rows for this tree and revision beyond the first, where every one after it
     * was ignored.
     */
    readonly duplicated: number;
};

pageReachOffunction

Read a window's counters against the readers that window had.

const pageReachOf: (reading: PageReading, rows: readonly StoredPageViews[]) => PageReach

Readable

signals/readable

What *on screen* means, as the two numbers that decide it.

READABLE_VISIBLE_FRACTIONvalue

At least this much of the element is visible.

const READABLE_VISIBLE_FRACTION = 0.5

READABLE_VIEWPORT_FRACTIONvalue

Or the element fills at least this much of the window.

const READABLE_VIEWPORT_FRACTION = 0.3

Readership

signals/readership

Whether two windows of a page were read by the same readership.

READERSHIP_SHIFTED_ABOVEvalue

How much of a readership has to move before a comparison of two windows is not comparing like with like.

const READERSHIP_SHIFTED_ABOVE = 0.1

RegionMovementtype

What happened to one region between the two windows.

type RegionMovement =
/** Named in both windows, and more views in the later one. */
"grew"
/** Named in both windows, and fewer views in the later one. */
 | "shrank"
/** Named in both windows, and exactly as many views. */
 | "steady"
/**
 * Unnamed in the earlier window and named in the later one.
 */
 | "thickened"
/**
 * Named in the earlier window and unnamed in the later one.
 */
 | "thinned";

REGION_MOVEMENTSvalue

const REGION_MOVEMENTS: readonly RegionMovement[]

describeRegionMovementfunction

One line per movement, for a surface putting the comparison in front of a person.

const describeRegionMovement: (movement: RegionMovement) => string

RegionSidetype

What one window's map said about one region, where it said anything.

type RegionSide = {
    /** Page views that began here, or `undefined` where the floor withheld the bucket. */
    readonly views: number | undefined;
    /**
     * {@link views} over every view in that window, named and withheld, or
     * `undefined` with it.
     */
    readonly share: number | undefined;
};

ComparedRegiontype

One region, as the two windows' maps have it.

type ComparedRegion = {
    readonly region: ReaderRegion;
    readonly was: RegionSide;
    readonly now: RegionSide;
    readonly movement: RegionMovement;
    /**
     * `now.share − was.share`, or `undefined` where either window withheld the
     * bucket.
     */
    readonly shift: number | undefined;
    /**
     * `now.views − was.views`, or `undefined` where either window withheld the
     * bucket.
     */
    readonly change: number | undefined;
};

ReadershipComparabilitytype

Whether the comparison beside this one is comparing like with like.

type ReadershipComparability =
/**
 * The mix cannot have moved far enough to matter — `movedAtMost` is under the
 * line, so the withheld buckets cannot carry it over.
 */
"like-for-like"
/** The mix moved, and the region that moved most is a place. */
 | "shifted"
/**
 * The mix moved, and the region that moved most is the bucket that names
 * nowhere.
 */
 | "unplaced"
/**
 * `moved` is under the line and `movedAtMost` is over it: the floor is
 * withholding enough that the question cannot be answered either way.
 */
 | "unsettled"
/** One of the two windows counted no page views at all, so there is no mix to compare. */
 | "unmeasured"
/**
 * The two maps were floored differently, so nothing was compared.
 */
 | "incomparable"
/**
 * The two maps are of two audiences, so nothing was compared.
 */
 | "different-audiences";

READERSHIP_COMPARABILITIESvalue

const READERSHIP_COMPARABILITIES: readonly ReadershipComparability[]

describeReadershipComparabilityfunction

One line per standing, for a surface putting the comparison in front of a person.

const describeReadershipComparability: (comparability: ReadershipComparability) => string

UnaccountedSharestype

What the comparison could not account for, as a share of each window's views.

type UnaccountedShares = {
    readonly was: number;
    readonly now: number;
};

Arrivalstype

How many page views began in each window, which is the weight and never a trend.

type Arrivals = {
    readonly was: number;
    readonly now: number;
};

ReadershipChangetype

Two windows' readerships, held against each other.

type ReadershipChange = {
    /**
     * The floor both maps were read at, or `undefined` where they differ and
     * nothing was compared.
     */
    readonly floor: number | undefined;
    readonly comparability: ReadershipComparability;
    /**
     * The audience each map was of, where it named one.
     */
    readonly audiences: ComparedAudiences;
    /**
     * The audiences each map's rows named, which is what each side was a sum
     * over.
     */
    readonly populations: ComparedPopulations;
    /**
     * Half the sum of the absolute share movements over the regions both maps
     * name, in `[0, 1]`, or `undefined` where nothing was compared.
     */
    readonly moved: number | undefined;
    /**
     * {@link moved} plus the whole unaccounted share of both windows, capped at
     * 1, or `undefined` with it.
     */
    readonly movedAtMost: number | undefined;
    /**
     * Every region either map names, most-moved first.
     */
    readonly regions: readonly ComparedRegion[];
    /**
     * The region carrying the largest absolute {@link ComparedRegion.shift}, or
     * `undefined` where no region is named in both maps.
     */
    readonly loudest: ReaderRegion | undefined;
    /**
     * The share of each window's views that is in no comparable row: its withheld
     * buckets, and the buckets the other window withheld.
     */
    readonly unaccounted: UnaccountedShares;
    /**
     * Page views that began in each window, named and withheld.
     */
    readonly arrivals: Arrivals;
};

readershipChangeOffunction

Two windows' region maps, compared.

const readershipChangeOf: (was: RegionReading, now: RegionReading) => ReadershipChange

Region

signals/region

Where readers are, as a counter and nothing else.

UNKNOWN_REGIONvalue

A region nobody can name.

const UNKNOWN_REGION: ReaderRegion

regionPatternvalue

Two uppercase letters, which is what a country code is.

const regionPattern: RegExp

readerRegionSchemaschema

A country, or the admission that there is none.

const readerRegionSchema: z.ZodBranded<…>

ReaderRegiontype

type ReaderRegion = z.infer<typeof readerRegionSchema>;

readerRegionOffunction

Read a region off whatever the platform wrote, and never fail.

const readerRegionOf: (given: string | null | undefined) => ReaderRegion

inRegionOrderfunction

Two regions, in the order a reading publishes them in: by code, with the sentinel last.

const inRegionOrder: (one: ReaderRegion, other: ReaderRegion) => number

ReaderRegionCounttype

Page views from one region, of one revision of one tree.

type ReaderRegionCount = {
    readonly treeId: TreeId;
    readonly revision: number;
    readonly region: ReaderRegion;
    /** Page views that *began* here, so a longer visit is not a bigger number. */
    readonly views: number;
};

StoredRegionCounttype

A region count as the store keeps it: the count, the audience it was collected under, and when it last moved. See StoredTally.audienceId.

type StoredRegionCount = ReaderRegionCount & {
    readonly audienceId: AudienceId;
    readonly updatedAt: string;
};

ReaderRegionStoreinterface

The durable half, and the only one there is — a region has no raw form to expire, because it was never written down as an observation.

interface ReaderRegionStore {
    /**
     * Add views to the buckets they belong in, creating rows that do not exist
     * yet. Additive for the same reason applying a rollup is: every call reports
     * what just arrived rather than what is true so far.
     */
    readonly count: (counts: readonly ReaderRegionCount[], at: string,
    /** The audience the delivery was served under. Omitted is `aud_everyone`. */
    audience?: AudienceId) => Promise<Result<void, ReaderSignalStoreError>>;
    readonly regions: (request?: TallyReadRequest) => Promise<Result<readonly StoredRegionCount[], ReaderSignalStoreError>>;
    /**
     * The same buckets, by the hour the views in them arrived, over a range
     * ([`region-hours.ts`](region-hours.ts)).
     */
    readonly regionHours: (request?: ArrivalReadRequest) => Promise<Result<StoredRegionHours, ReaderSignalStoreError>>;
}

regionCountsOffunction

What one delivery adds, which is one view per page view it opened.

const regionCountsOf: (openings: readonly RevisionViews[], region: ReaderRegion) => readonly ReaderRegionCount[]

DEFAULT_REGION_FLOORvalue

The smallest a bucket may be before it is named.

const DEFAULT_REGION_FLOOR = 25

regionFloorOffunction

The floor that will actually be used, given what somebody asked for.

const regionFloorOf: (asked: number | undefined) => number

RegionBuckettype

One region, as a reading reports it.

type RegionBucket = {
    readonly region: ReaderRegion;
    readonly views: number;
};

RegionReadingtype

type RegionReading = {
    /** The floor the rows were read at, so a screen can say what it is withholding by. */
    readonly floor: number;
    /**
     * The audience whose arrivals this map is of, or `null` where nothing said.
     */
    readonly audienceId: AudienceId | null;
    /**
     * Every audience the rows this map summed named, deduplicated and in a stable
     * order.
     */
    readonly audiences: readonly AudienceId[];
    /** Buckets large enough to name, most-read first. */
    readonly regions: readonly RegionBucket[];
    /** What was too small to name, as a total that names nowhere. */
    readonly withheld: {
        readonly buckets: number;
        readonly views: number;
    };
    /** Every view in the rows, named or withheld. A reading never loses one. */
    readonly views: number;
};

RegionReadingOptionstype

type RegionReadingOptions = {
    /** Raised above {@link DEFAULT_REGION_FLOOR}; a smaller number is the default.  */
    readonly floor?: number | undefined;
};

regionReadingOffunction

Rows from the store, read as something a screen may show.

const regionReadingOf: (rows: readonly StoredRegionCount[], options?: RegionReadingOptions) => RegionReading

RegionReadingFortype

One revision's region rows, read as a map, without the caller writing the filter.

type RegionReadingFor = {
    /** The revision's own map, floored. */
    readonly reading: RegionReading;
    /**
     * Rows for another tree or another revision, and ignored.
     */
    readonly foreign: number;
    /**
     * Rows for this revision in another audience, and ignored.
     */
    readonly otherAudience: number;
    /**
     * Rows naming a region **and an audience** this revision already had a row
     * for, beyond the first, every one of which was ignored.
     */
    readonly duplicated: number;
};

regionReadingForfunction

Pick one revision's region rows out of a set of them and read them.

const regionReadingFor: (where: RevisionOf, rows: readonly StoredRegionCount[], options?: RegionReadingOptions) => RegionReadingFor

Region hours

signals/region-hours

**When** readers were where they were, which is the one question the region map could never be asked.

RegionHourCounttype

Page views that began in one hour, from one region, of one revision of one tree.

type RegionHourCount = {
    readonly treeId: TreeId;
    readonly revision: number;
    readonly region: ReaderRegion;
    /** The hour they arrived in, as the instant it began (UTC). */
    readonly hour: number;
    /** Page views that *began* here in this hour, so a longer visit is not a bigger number. */
    readonly views: number;
};

StoredRegionHourtype

An hour's bucket as the store keeps it. See StoredTally.audienceId.

type StoredRegionHour = RegionHourCount & {
    readonly audienceId: AudienceId;
    readonly updatedAt: string;
};

StoredRegionHourstype

What a ranged read of the counter hands back.

type StoredRegionHours = {
    /** Every row in the range, in no particular order. */
    readonly hours: readonly StoredRegionHour[];
    /**
     * The first hour this scope has ever counted a placed arrival in, whatever
     * range was asked for.
     */
    readonly begins?: number;
};

regionHoursOffunction

What one call to the region store adds, which is its buckets filed under the hour the door read them in.

const regionHoursOf: (counts: readonly ReaderRegionCount[], at: string) => Result<readonly RegionHourCount[], ReaderSignalStoreError>

RegionWindowStandingtype

What a screen may say about the stretch a map was read over.

type RegionWindowStanding =
/** The whole range is inside the stretch this scope has been counting for. */
"counted"
/**
 * Counting began inside the range, so the map is of the part of it that was
 * counted.
 */
 | "partly-counted"
/**
 * Counting began after the range ended, so this range was never counted at
 * all.
 */
 | "before-counting"
/** Nothing has ever been counted in this scope, so there is no stretch to be inside. */
 | "never-counted";

REGION_WINDOW_STANDINGSvalue

The closed set, for a surface accounting for every window it draws.

const REGION_WINDOW_STANDINGS: readonly RegionWindowStanding[]

describeRegionWindowStandingfunction

One line per standing, for a surface saying what a map is and is not of.

const describeRegionWindowStanding: (standing: RegionWindowStanding) => string

RegionWindowtype

Where readers were over one stretch of time, floored once, over the whole of it.

type RegionWindow = {
    /** The range this map is of, as asked for. */
    readonly range: ArrivalRange;
    /**
     * The map, floored over the summed range.
     */
    readonly reading: RegionReading;
    /** What the range is, relative to what this scope has been counting. */
    readonly standing: RegionWindowStanding;
    /**
     * The first hour this scope has ever counted, carried through from the store.
     */
    readonly begins?: number;
    /**
     * Rows naming a tree, a revision, an audience, a region **and an hour** this
     * map already had a row for, beyond the first, every one of which was
     * ignored.
     */
    readonly duplicated: number;
};

regionWindowOffunction

Rows from the counter, read as a map of one stretch of time.

const regionWindowOf: (stored: StoredRegionHours, range: ArrivalRange, options?: RegionReadingOptions) => RegionWindow

RegionTrendtype

One stretch's map and the equal-length stretch before it, which is what makes a readership comparison a comparison over time.

type RegionTrend = {
    /** The stretch asked for. */
    readonly now: RegionWindow;
    /** The stretch of the same length immediately before it (`arrivalRangeBefore`). */
    readonly before: RegionWindow;
};

regionTrendOffunction

Both maps, from one read.

const regionTrendOf: (stored: StoredRegionHours, range: ArrivalRange, options?: RegionReadingOptions) => RegionTrend

RegionHourHandletype

The one method of the region store a reading of this needs.

type RegionHourHandle = {
    readonly regionHours: (request?: ArrivalReadRequest) => Promise<Result<StoredRegionHours, ReaderSignalStoreError>>;
};

RegionWindowRequesttype

What a surface asks for: a stretch, the narrowing, and the floor.

type RegionWindowRequest = TallyReadRequest & {
    readonly range: ArrivalRange;
    /** Raised above the region floor; a smaller number is the floor. */
    readonly floor?: number | undefined;
};

readRegionTrendfunction

Where readers were over a stretch, and over the stretch before it, in one call against a store handle.

const readRegionTrend: (store: RegionHourHandle, request: RegionWindowRequest) => Promise<Result<RegionTrend, ReaderSignalStoreError>>

Region pages

signals/region-pages

Which of a deployment's pages the readers of one place opened.

RegionPageStandingtype

What a screen may say about one region's breakdown by page.

type RegionPageStanding =
/** Every view in the bucket is on a page the breakdown names. */
"attributed"
/** Some of the bucket's views are on named pages and the rest are withheld. */
 | "partly-attributed"
/**
 * No page in this place cleared the floor, so the bucket's views are named
 * and nothing in it is attributed.
 */
 | "unattributable";

REGION_PAGE_STANDINGSvalue

The closed set, for a surface accounting for every breakdown it draws.

const REGION_PAGE_STANDINGS: readonly RegionPageStanding[]

describeRegionPageStandingfunction

One line per standing, for a surface saying what a breakdown is withholding.

const describeRegionPageStanding: (standing: RegionPageStanding) => string

RegionPagetype

One page the readers of a place opened.

type RegionPage = {
    readonly treeId: TreeId;
    /**
     * Page views that began here, summed over the revisions and the forms the
     * rows named.
     */
    readonly views: number;
    /**
     * This page's share of **the whole bucket**, including the views the
     * breakdown withheld.
     */
    readonly share: number | undefined;
};

RegionPageBreakdowntype

One named region, with the pages its readers opened.

type RegionPageBreakdown = {
    readonly region: ReaderRegion;
    /** The bucket's own total, which is the map's number unchanged. */
    readonly views: number;
    /** Pages with enough readers in this place to name, most-read first. */
    readonly pages: readonly RegionPage[];
    /** What was too small to name here, as a total that names no page. */
    readonly withheld: {
        readonly pages: number;
        readonly views: number;
    };
    readonly standing: RegionPageStanding;
};

RegionPagesOptionstype

What a breakdown is read at.

type RegionPagesOptions = {
    /**
     * The floor under a named cell, which is the deployment's and is required.
     */
    readonly floor: number;
};

RegionPagesReadingtype

A region map and, for each place it named, what the readers there read.

type RegionPagesReading = {
    /** The map itself, unchanged, so a breakdown's totals cannot disagree with it. */
    readonly map: RegionReading;
    /**
     * One breakdown per named bucket, in the map's order, so a surface drawing
     * both reads them side by side.
     */
    readonly regions: readonly RegionPageBreakdown[];
};

regionPagesOffunction

Rows from the store, read as a map and a breakdown of every place it named.

const regionPagesOf: (rows: readonly StoredRegionCount[], options: RegionPagesOptions) => RegionPagesReading

Retention

signals/retention

Whether the deployment keeps the retention ceiling it publishes to its readers.

RetentionPromisetype

How a published retention ceiling stood at the moment of one sweep.

type RetentionPromise =
/**
 * The deployment stated no sweep interval, so its notice publishes no
 * ceiling.
 */
{
    readonly state: "unpromised";
}
/**
 * The run read no delivery, so nothing here says how old the oldest one is.
 */
 | {
    readonly state: "unread";
}
/**
 * Nothing in the table is old enough to delete, so nothing in it can be past
 * the ceiling.
 */
 | {
    readonly state: "unripe";
}
/**
 * The oldest delivery in the buffer is within the ceiling the notice
 * publishes.
 */
 | {
    readonly state: "kept";
    /** How old the oldest delivery still in the table was, in milliseconds. */
    readonly oldestMs: number;
    /** The ceiling the notice publishes: the later of the two windows plus one sweep. */
    readonly goneWithinMs: number;
}
/**
 * A delivery is older than the ceiling the notice publishes, so that sentence
 * is false and was false for `byMs` before this run.
 */
 | {
    readonly state: "broken";
    readonly oldestMs: number;
    readonly goneWithinMs: number;
    /** How far past the ceiling the oldest delivery is. */
    readonly byMs: number;
    /**
     * Whether what is holding the oldest delivery is that no fold has counted
     * it (`expire.ts`).
     */
    readonly uncounted: boolean;
};

retentionPromiseOffunction

Judge one expiry sweep's own evidence against the ceiling its deployment publishes.

const retentionPromiseOf: (outcome: ExpiryOutcome, retention: DeliveryRetention) => RetentionPromise

describeRetentionPromisefunction

One line for the operator who runs the sweep, because they are the only person who can close the gap.

const describeRetentionPromise: (promise: RetentionPromise) => string

Rhythm

signals/rhythm

**The two ways a month of hours can be drawn, and the one of them that is a question nothing else here asks.**

DayBuckettype

One day of a range, which is one bar.

type DayBucket = {
    /** The instant the day began, at this series' offset. */
    readonly day: number;
    /** What was counted in it, partial hours included. */
    readonly count: number;
    /** How many of its twenty-four hours the series could speak for. */
    readonly hours: number;
    /** Whether all twenty-four are present and every one of them over. */
    readonly whole: boolean;
};

DaySeriestype

An hourly series folded into its days.

type DaySeries = {
    /** The range the series was taken over, carried through unchanged. */
    readonly range: ArrivalRange;
    /**
     * One entry per day, ascending, dense.
     */
    readonly days: readonly DayBucket[];
    /** The sum over the days, which is the sum over the hours they were folded from. */
    readonly count: number;
    /** The offset the days were cut at, in whole hours from UTC. */
    readonly offsetHours: number;
    /** Whether the range begins before counting did, carried through from the series. */
    readonly clipped: boolean;
    /** How many of the days above are not whole, which is the two edges and whatever a clock cut. */
    readonly partial: number;
};

DayHourtype

One hour of the day, over every day of a range.

type DayHour = {
    /** The hour of the day, 0 to 23, at this shape's offset. */
    readonly hour: number;
    /** How many days contributed a whole hour here. */
    readonly days: number;
    /** What was counted in those hours, which is nought where no day could speak. */
    readonly count: number;
    /**
     * The mean over the days that could speak for this hour.
     */
    readonly perDay?: number;
};

DayShapeSilencetype

Why a shape has nothing to say about any hour of the day.

type DayShapeSilence =
/** Nothing has ever been counted in this scope, so the series it folds is empty. */
"unmeasured"
/**
 * The range holds hours and not one of them is over.
 */
 | "unsettled";

DAY_SHAPE_SILENCESvalue

The members, published so that the set can be enumerated rather than remembered.

const DAY_SHAPE_SILENCES: readonly DayShapeSilence[]

describeDayShapeSilencefunction

One line per silence, for a surface saying why a day has no shape.

const describeDayShapeSilence: (silence: DayShapeSilence) => string

DayShapetype

The hours of a reader's day on this deployment, over whatever range was read.

type DayShape = {
    /** Twenty-four entries, ascending from hour 0. */
    readonly hours: readonly DayHour[];
    /** What was counted into the shape: the range's whole hours, summed. */
    readonly count: number;
    /**
     * What the range counted and the shape left out, because the hour was not over.
     */
    readonly incomplete: number;
    /** How many days contributed any whole hour at all. */
    readonly days: number;
    /**
     * Whether every hour of the day rests on the same number of days.
     */
    readonly even: boolean;
    /** The offset the hours were named at, in whole hours from UTC. */
    readonly offsetHours: number;
    /** Why there is nothing to read, where there is nothing. */
    readonly silence?: DayShapeSilence;
};

daySeriesOffunction

An hourly series folded into its days.

Shown in use on What your readers do — When your readers are here

const daySeriesOf: <Hour extends SeriesHour>(series: HourlyReading<Hour>, count: (hour: Hour) => number, cut: DayCut) => DaySeries

dayShapeOffunction

The hours of the day a series' whole hours fell in.

Shown in use on What your readers do — When your readers are here

const dayShapeOf: <Hour extends SeriesHour>(series: HourlyReading<Hour>, count: (hour: Hour) => number, cut: DayCut) => DayShape

arrivalDaysOffunction

Page views by day, from the series a surface already drew by hour.

const arrivalDaysOf: (series: ArrivalSeries, cut: DayCut) => DaySeries

actedDaysOffunction

What readers did, by day, in the kind the series is of.

const actedDaysOf: (series: ActedSeries, cut: DayCut) => DaySeries

arrivalDayShapeOffunction

When readers arrive, over every day the range could speak for.

const arrivalDayShapeOf: (series: ArrivalSeries, cut: DayCut) => DayShape

actedDayShapeOffunction

When readers do a thing, over every day the range could speak for.

const actedDayShapeOf: (series: ActedSeries, cut: DayCut) => DayShape

busiestHoursInfunction

The hours of the day with the most, busiest first.

Shown in use on What your readers do — When your readers are here

const busiestHoursIn: (shape: DayShape, most?: number) => readonly DayHour[]

quietestHoursInfunction

The hours of the day with the least, quietest first.

Shown in use on What your readers do — When your readers are here

const quietestHoursIn: (shape: DayShape, fewest?: number) => readonly DayHour[]

Rollup

signals/rollup

Many views, folded into the durable artefact: per-node-per-revision counters, and the funnel pairs a deployment asked about.

ReaderTallytype

One node at one revision, as every view of it added up.

type ReaderTally = {
    readonly treeId: TreeId;
    readonly revision: number;
    readonly nodeId: NodeId;
    readonly type: PrimitiveType;
    /** Distinct page views that produced any signal at all about this node. */
    readonly views: number;
    /** Distinct page views in which it came into view. The denominator of a funnel. */
    readonly reached: number;
    /**
     * Distinct page views in which a reader used something *inside* this node —
     * pressed a link or button, filled a field, opened or closed a disclosure.
     */
    readonly engaged: number;
    readonly dwellMs: number;
    readonly activations: number;
    readonly opens: number;
    readonly closes: number;
    /**
     * Times a form inside this node was submitted and the browser let it go.
     */
    readonly completions: number;
};

FunnelEndtype

One end of a funnel: a node, and what a reader has to have done to it.

type FunnelEnd = {
    readonly nodeId: NodeId;
    /**
     * What a reader has to have done to the node, as one of the five kinds.
     */
    readonly kind: ReaderSignalKind;
};

FunnelPairtype

A question a deployment names, phrased about the tree rather than about anyone: *of the views that did X to node A, how many did Y to node B*.

type FunnelPair = {
    readonly from: FunnelEnd;
    readonly to: FunnelEnd;
    /**
     * The pages it is asked on, or absent for every page the window holds.
     */
    readonly pages?: readonly TreeId[];
};

FunnelAnswertype

type FunnelAnswer = {
    readonly treeId: TreeId;
    readonly revision: number;
    readonly pair: FunnelPair;
    /** Views that satisfied `from`. */
    readonly reached: number;
    /** Views that satisfied both. Never greater than `reached`. */
    readonly converted: number;
};

Rolluptype

type Rollup = {
    readonly tallies: readonly ReaderTally[];
    readonly funnels: readonly FunnelAnswer[];
    /**
     * The same answers, cut into the hours the views in each of them entered the
     * funnel (`funnel-hours.ts`).
     */
    readonly funnelHours: readonly FunnelHourCount[];
    /** Distinct page views seen, across every tree and revision in the input. */
    readonly views: number;
    /**
     * The same page views, per tree and revision — one appearance each, in this
     * window.
     */
    readonly appearances: readonly RevisionViews[];
    /**
     * Batches that carried no view key.
     */
    readonly uncorrelated: number;
    /**
     * Batches this fold refused as a repeat of one it had already folded.
     */
    readonly redelivered: number;
    /**
     * The same occurrences as the tallies' three delegated kinds, filed under the
     * hour the door received them in (`acted.ts`).
     */
    readonly acted: readonly ActedHourCount[];
    /**
     * Batches that carried no instant the door received them at, so their
     * occurrences are in the tallies and in no hour.
     */
    readonly undated: number;
};

EMPTY_ROLLUPvalue

const EMPTY_ROLLUP: Rollup

FunnelQuestiontype

One question, and the pages it is asked on: null for every page the window holds.

type FunnelQuestion = {
    readonly pair: FunnelPair;
    readonly pages: ReadonlySet<TreeId> | null;
};

funnelQuestionsOffunction

The questions a list of pairs asks, one per pair of ends, with the scopes of the pairs that ask the same question unioned.

const funnelQuestionsOf: (pairs: readonly FunnelPair[]) => readonly FunnelQuestion[]

RollupOptionstype

type RollupOptions = {
    /**
     * The funnels this deployment asked for. Absent means none: a pair is a
     * question somebody wrote down, and a rollup does not invent questions.
     */
    readonly pairs?: readonly FunnelPair[];
};

DatedBatchtype

A batch as a buffer holds it: with the instant **the door** received it.

type DatedBatch = ReaderSignalBatch & {
    readonly receivedAt?: string;
};

rollUpfunction

const rollUp: (batches: readonly DatedBatch[], options?: RollupOptions) => Rollup

Signal

signals/signal

What a published page may say about how it is being read.

readerSignalKindSchemaschema

const readerSignalKindSchema: z.ZodEnum<…>

ReaderSignalKindtype

type ReaderSignalKind = z.infer<typeof readerSignalKindSchema>;

viewKeySchemaschema

The key that says two batches came from the same page view, and says nothing else.

const viewKeySchema: z.ZodBranded<…>

ViewKeytype

type ViewKey = z.infer<typeof viewKeySchema>;

signalAddressSchemaschema

One addressed node, as a signal names it.

const signalAddressSchema: z.ZodObject<…>

readerSignalSchemaschema

The five kinds.

const readerSignalSchema: z.ZodDiscriminatedUnion<…>

ReaderSignaltype

type ReaderSignal = z.infer<typeof readerSignalSchema>;

readerSignalBatchSchemaschema

One delivery: the signals a page gathered since the last one, all about the same tree at the same revision.

const readerSignalBatchSchema: z.ZodEffects<…>

ReaderSignalBatchtype

type ReaderSignalBatch = z.infer<typeof readerSignalBatchSchema>;

ReaderSignalParseErrortype

type ReaderSignalParseError = {
    readonly code: "invalid-batch";
    readonly issues: readonly {
        readonly path: string;
        readonly message: string;
    }[];
};

parseReaderSignalBatchfunction

Read a batch that arrived from somewhere untrusted — a request body, a queue.

Shown in use on What your readers do — Reading a batch back

const parseReaderSignalBatch: (input: unknown) => Result<ReaderSignalBatch, ReaderSignalParseError>

Silence census

signals/silence-census

What a window could not answer, and what each reason cost it.

ReadingSilencetype

One reading's silence, with the page it was a reading of.

type ReadingSilence = {
    /**
     * What the reading reported, as the matching `meaningOf…Silence` gives it, or
     * `null` where it answered.
     */
    readonly meaning: SilenceMeaning | null;
    /**
     * The page in the form this reading was of, or absent where the reading is of
     * no one page.
     */
    readonly form?: PageForm | null;
};

SilenceStandingtype

One state the window is in, and what it cost.

type SilenceStanding = {
    readonly condition: SilenceCondition;
    readonly subject: SilenceSubject;
    /**
     * The vocabulary of the **first** reading that reported it, kept so that a
     * surface can still print that reading's own sentence.
     */
    readonly vocabulary: SilenceVocabulary;
    /** Every vocabulary that reported it, each once, in the order they arrived. */
    readonly vocabularies: readonly SilenceVocabulary[];
    /** How many readings reported it. */
    readonly readings: number;
    /** The pages it cost, each once however many of their readings reported it. */
    readonly forms: readonly PageForm[];
    /** How many of the readings that reported it were of no one page. */
    readonly wide: number;
};

SilenceGrouptype

What one group of readings answered.

type SilenceGroup = {
    /** Every reading handed over in this group, silent or not. */
    readonly readings: number;
    /** How many of them were silent. */
    readonly silent: number;
    /**
     * The distinct states they are in, in the order they arrived, each keeping the
     * first reading's vocabulary.
     */
    readonly states: readonly SilenceMeaning[];
};

FormSilencestype

What one page in one form answered.

type FormSilences = SilenceGroup & {
    readonly form: PageForm;
};

SilenceCensustype

The states a window is in, and what each of them cost.

type SilenceCensus = {
    /**
     * Every reading handed over, silent or not, which is the denominator the
     * caller chose by choosing what to hand in.
     */
    readonly readings: number;
    /** How many of them were silent. `readings = silent + answered`. */
    readonly silent: number;
    readonly answered: number;
    /**
     * The distinct states, in the order the readings were handed over.
     */
    readonly states: readonly SilenceStanding[];
    /** The same readings by page, in form order rather than arrival order. */
    readonly byForm: readonly FormSilences[];
    /** The readings of no one page, which no form row holds. */
    readonly wide: SilenceGroup;
};

silenceCensusOffunction

The states a window is in, out of the silences its readings published.

const silenceCensusOf: (readings: readonly ReadingSilence[]) => SilenceCensus

Silences

signals/silences

What two readings mean when they both say nothing, and whether they mean the same thing.

SilenceSubjecttype

What a silence is a fact about.

type SilenceSubject =
/** One revision of one page, and the window of counters read against it. */
"page"
/** One part of one revision. */
 | "part"
/**
 * The two readings held against each other, naming neither side.
 */
 | "comparison"
/**
 * One kind of part, everywhere it stands in the pages read.
 */
 | "kind"
/**
 * The run of hours a series holds, at whatever scope its counters were read.
 */
 | "series";

SILENCE_SUBJECTSvalue

const SILENCE_SUBJECTS: readonly SilenceSubject[]

describeSilenceSubjectfunction

One line per subject, for a surface naming what a reason is about.

const describeSilenceSubject: (subject: SilenceSubject) => string

SilenceVocabularytype

Which reading published a silence.

type SilenceVocabulary = "action-change" | "change" | "conversion" | "copy" | "copy-change" | "deployment" | "deployment-change" | "form-action" | "form-copy" | "forms" | "funnel-change" | "funnel-rhythm" | "library" | "library-action" | "library-change" | "library-copy-change" | "library-pace" | "library-reach" | "library-reach-change" | "library-senders" | "library-senders-change" | "library-senders-reach" | "library-senders-reach-change" | "library-word-reach-change" | "pace" | "pace-change" | "reach" | "rhythm";

SILENCE_VOCABULARIESvalue

const SILENCE_VOCABULARIES: readonly SilenceVocabulary[]

SUBJECT_OF_VOCABULARYvalue

What each reading's reasons are about.

const SUBJECT_OF_VOCABULARY: Readonly<Record<SilenceVocabulary, SilenceSubject>>

SilenceConditiontype

The state of the world a silence reports, named once for the whole subsystem.

type SilenceCondition =
/** The two readings are of different trees, so nothing in either is comparable. */
"two-pages"
/**
 * The two readings are of two audiences, so they are of two populations.
 */
 | "two-audiences"
/**
 * Nothing reported a view of it.
 */
 | "no-view-reported"
/**
 * There is no page-view row at the door for this revision.
 */
 | "no-arrivals-counted"
/**
 * The row is there and nothing in it says a page view ever began.
 */
 | "no-openings-marked"
/** Readers arrived and no rollup has folded a window of their reading yet. */
 | "no-window-folded"
/** It says nothing that could have been read: no words, and nothing undeclared either. */
 | "says-nothing"
/**
 * Some of its words are a floor, because a type in it declares no `copy`
 *.
 */
 | "words-a-floor"
/**
 * It reports more readers than it has views, which no rollup produces.
 */
 | "readers-above-views"
/** The change left no word of the page as it was, so there is no carried text to read. */
 | "nothing-carried"
/**
 * The window holds actions and credits none of them to a reader.
 */
 | "no-action-credited"
/**
 * There is none of it in the pages read.
 */
 | "nothing-of-the-kind"
/**
 * It has nothing inside it, so there is nothing a reader could act in.
 */
 | "nothing-inside"
/**
 * Its counters are there and not one of them reports being reached.
 */
 | "no-reach-reported"
/**
 * One window holds two forms of the page and the asking named neither.
 */
 | "two-forms-unsplit"
/**
 * The two readings are of two revisions of the page.
 */
 | "two-revisions"
/**
 * Both readings are of one audience, so there is not a second population.
 */
 | "one-population"
/**
 * Nothing recorded which audience the window was of.
 */
 | "no-audience-named"
/**
 * Every question it is asked names a part the page no longer has.
 */
 | "questions-stale"
/**
 * Nothing below it reported being reached, so nothing it holds can witness
 * anything about it.
 */
 | "no-reach-below"
/**
 * No hour of it has ever been counted, so the run of hours is empty.
 */
 | "no-hour-counted"
/**
 * It holds hours and not one of them is over.
 */
 | "no-hour-settled"
/**
 * No place it holds still across the two readings could be checked in both of
 * them, and at least one of those places holds something inside it on both
 * sides.
 */
 | "nothing-checkable"
/**
 * Every place it could be compared at is unclaimed in one of the two
 * readings.
 */
 | "nothing-claimed";

SILENCE_CONDITIONSvalue

const SILENCE_CONDITIONS: readonly SilenceCondition[]

describeSilenceConditionfunction

One line per condition, written so that it reads after the subject it is about rather than naming one itself.

const describeSilenceCondition: (condition: SilenceCondition) => string

SilenceMeaningtype

What one reading's silence reports, and what it reports it of.

type SilenceMeaning = {
    readonly condition: SilenceCondition;
    readonly subject: SilenceSubject;
    /** The reading that published it, kept so that its own sentence can still be printed. */
    readonly vocabulary: SilenceVocabulary;
};

meaningOfActionChangeSilencefunction

What a comparison of what readers *did* reports.

const meaningOfActionChangeSilence: (silence: ActionChangeSilence) => SilenceMeaning

meaningOfChangeSilencefunction

What a before-and-after reading's silence reports.

const meaningOfChangeSilence: (silence: ChangeSilence) => SilenceMeaning

meaningOfCopySilencefunction

What a copy reading's silence reports.

const meaningOfCopySilence: (silence: CopySilence) => SilenceMeaning

meaningOfCopyChangeSilencefunction

What a comparison of two windows' words reports.

const meaningOfCopyChangeSilence: (silence: CopyChangeSilence) => SilenceMeaning

meaningOfDeploymentSilencefunction

What an order over a deployment's pages reports, of one of them.

const meaningOfDeploymentSilence: (silence: DeploymentSilence) => SilenceMeaning

meaningOfDeploymentChangeSilencefunction

What an order over what a change did to a deployment reports, of one page's comparison.

const meaningOfDeploymentChangeSilence: (silence: DeploymentChangeSilence) => SilenceMeaning

meaningOfKindSilencefunction

What a census of the library reports, of one kind of part.

const meaningOfKindSilence: (silence: KindSilence) => SilenceMeaning

meaningOfKindReachSilencefunction

What a kind's share of the readers who met it reports, of one kind.

const meaningOfKindReachSilence: (silence: KindReachSilence) => SilenceMeaning

meaningOfKindReachChangeSilencefunction

What a reader-weighted comparison of a kind of part reports, of one kind.

const meaningOfKindReachChangeSilence: (silence: KindReachChangeSilence) => SilenceMeaning

meaningOfKindWordReachChangeSilencefunction

What a comparison of the words one reader got to reports, of one kind.

const meaningOfKindWordReachChangeSilence: (silence: KindWordReachChangeSilence) => SilenceMeaning

meaningOfKindActionSilencefunction

What a kind's share of the readers who acted inside it reports, of one kind.

const meaningOfKindActionSilence: (silence: KindActionSilence) => SilenceMeaning

meaningOfKindChangeSilencefunction

What a comparison of two windows of one library reports, of one kind.

const meaningOfKindChangeSilence: (silence: KindChangeSilence) => SilenceMeaning

meaningOfKindCopyChangeSilencefunction

What a comparison of two windows' words at the scale of a library reports.

const meaningOfKindCopyChangeSilence: (silence: KindCopyChangeSilence) => SilenceMeaning

meaningOfKindPaceSilencefunction

What a kind of part's pace reports, of one kind.

const meaningOfKindPaceSilence: (silence: KindPaceSilence) => SilenceMeaning

meaningOfSenderFixSilencefunction

What a comparison of two windows' senders reports, of one kind.

const meaningOfSenderFixSilence: (silence: SenderFixSilence) => SilenceMeaning

meaningOfPaceSilencefunction

What a pace reading's silence reports, of one part.

const meaningOfPaceSilence: (silence: PaceSilence) => SilenceMeaning

meaningOfPaceChangeSilencefunction

What a comparison of two windows' pace reports.

const meaningOfPaceChangeSilence: (silence: PaceChangeSilence) => SilenceMeaning

meaningOfReachSilencefunction

What a share-of-readers silence reports, which is also a funnel's.

const meaningOfReachSilence: (silence: ReachSilence) => SilenceMeaning

meaningOfFunnelChangeSilencefunction

What a comparison of two windows' funnels reports.

const meaningOfFunnelChangeSilence: (silence: FunnelChangeSilence) => SilenceMeaning

meaningOfFormComparisonSilencefunction

What a comparison of two forms of one page reports.

const meaningOfFormComparisonSilence: (silence: FormComparisonSilence) => SilenceMeaning

meaningOfFormActionSilencefunction

What a comparison of what two forms' readers *did* reports.

const meaningOfFormActionSilence: (silence: FormActionSilence) => SilenceMeaning

meaningOfFormCopySilencefunction

What a comparison of what two forms *say* reports.

const meaningOfFormCopySilence: (silence: FormCopySilence) => SilenceMeaning

meaningOfConversionSilencefunction

What an order of a deployment's conversions reports.

const meaningOfConversionSilence: (silence: ConversionSilence) => SilenceMeaning

meaningOfSenderReachSilencefunction

What a reader-weighted reading of a library's silent senders reports, of one kind.

const meaningOfSenderReachSilence: (silence: SenderReachSilence) => SilenceMeaning

meaningOfSenderReachChangeSilencefunction

What a comparison of two windows of a library's silent senders, among the readings that got inside them, reports of one kind.

const meaningOfSenderReachChangeSilence: (silence: SenderReachChangeSilence) => SilenceMeaning

meaningOfDayShapeSilencefunction

What a fold of an hourly series into the hours of a day reports.

const meaningOfDayShapeSilence: (silence: DayShapeSilence) => SilenceMeaning

meaningOfFunnelShapeSilencefunction

What a fold of one funnel's hours into the hours of a day reports.

const meaningOfFunnelShapeSilence: (silence: FunnelShapeSilence) => SilenceMeaning

meaningOfSenderSilencefunction

What a census of a library's silent senders reports, of one kind.

const meaningOfSenderSilence: (silence: SenderSilence) => SilenceMeaning

SilenceOftype

Which closed set of reasons each reading publishes, as a table from the vocabulary to the set it names.

type SilenceOf = {
    readonly "action-change": ActionChangeSilence;
    readonly change: ChangeSilence;
    readonly conversion: ConversionSilence;
    readonly copy: CopySilence;
    readonly "copy-change": CopyChangeSilence;
    readonly deployment: DeploymentSilence;
    readonly "deployment-change": DeploymentChangeSilence;
    readonly "form-action": FormActionSilence;
    readonly "form-copy": FormCopySilence;
    readonly forms: FormComparisonSilence;
    readonly "funnel-change": FunnelChangeSilence;
    readonly "funnel-rhythm": FunnelShapeSilence;
    readonly library: KindSilence;
    readonly "library-action": KindActionSilence;
    readonly "library-change": KindChangeSilence;
    readonly "library-copy-change": KindCopyChangeSilence;
    readonly "library-pace": KindPaceSilence;
    readonly "library-reach": KindReachSilence;
    readonly "library-reach-change": KindReachChangeSilence;
    readonly "library-senders": SenderSilence;
    readonly "library-senders-change": SenderFixSilence;
    readonly "library-senders-reach": SenderReachSilence;
    readonly "library-senders-reach-change": SenderReachChangeSilence;
    readonly "library-word-reach-change": KindWordReachChangeSilence;
    readonly pace: PaceSilence;
    readonly "pace-change": PaceChangeSilence;
    readonly reach: ReachSilence;
    readonly rhythm: DayShapeSilence;
};

meaningOfSilencefunction

What one reading's silence reports, read through the vocabulary it came from.

const meaningOfSilence: <V extends SilenceVocabulary>(vocabulary: V, silence: SilenceOf[V] | null) => SilenceMeaning | null

SilenceRelationtype

How two readings' reasons for saying nothing stand to each other.

type SilenceRelation =
/**
 * One condition about one subject: the two readings are silent for the same
 * reason about the same thing, and one sentence serves both.
 */
"one-state"
/**
 * One condition about two subjects.
 */
 | "one-reason"
/** Two conditions, which a surface has to print separately or choose between. */
 | "unrelated";

SILENCE_RELATIONSvalue

const SILENCE_RELATIONS: readonly SilenceRelation[]

relateSilencesfunction

Hold two readings' reasons against each other.

const relateSilences: (one: SilenceMeaning, other: SilenceMeaning) => SilenceRelation

distinctSilencesfunction

The states a card is actually in, out of the readings on it.

const distinctSilences: (meanings: readonly (SilenceMeaning | null)[]) => readonly SilenceMeaning[]

Tally

signals/tally

Where the counters live once the batches they came from are gone.

StoredTallytype

One node's line as the store keeps it, which is a tally plus the audience it was collected under and when it last changed.

type StoredTally = ReaderTally & {
    readonly audienceId: AudienceId;
    readonly updatedAt: string;
};

StoredFunneltype

One funnel answer as the store keeps it. See StoredTally.audienceId.

type StoredFunnel = FunnelAnswer & {
    readonly audienceId: AudienceId;
    readonly updatedAt: string;
};

TallyReadRequesttype

type TallyReadRequest = {
    /** Absent reads every tree the handle can see, which is the scope rule. */
    readonly treeId?: TreeId;
    /**
     * Absent reads every audience.
     */
    readonly audience?: AudienceId | undefined;
    /**
     * Absent reads every revision.
     */
    readonly revision?: number;
};

ReaderOpeningCounterinterface

The one write the door makes into the durable counters.

interface ReaderOpeningCounter {
    /**
     * Add the page views a delivery opened, creating rows that do not exist yet.
     */
    readonly opened: (openings: readonly RevisionViews[], at: string,
    /**
     * The audience the delivery was served under. Omitted is
     * `aud_everyone`, so a door that serves one form of every page calls this
     * exactly as it did.
     */
    audience?: AudienceId) => Promise<Result<void, ReaderSignalStoreError>>;
}

AppliedCounterstype

One fold's output, as a caller hands it over.

type AppliedCounters = {
    readonly tallies: readonly ReaderTally[];
    readonly funnels: readonly FunnelAnswer[];
    /**
     * The window's page views, per revision, for the counter the exact count
     * is compared against.
     */
    readonly appearances?: readonly RevisionViews[];
    /**
     * The same window's occurrences of the three delegated kinds, filed under the
     * hour the door received them in (`acted.ts`).
     */
    readonly acted?: readonly ActedHourCount[];
    /**
     * The same window's funnel answers, cut into the hours the views in each of
     * them entered the funnel (`funnel-hours.ts`).
     */
    readonly funnelHours?: readonly FunnelHourCount[];
};

AudienceCounterstype

One audience's share of a window, which is what {@link ReaderTallyStore.applyWindow} takes a list of.

type AudienceCounters = AppliedCounters & {
    /** The audience this fold was taken over. Omitted is `aud_everyone`. */
    readonly audience?: AudienceId | undefined;
};

ReaderTallyStoreinterface

interface ReaderTallyStore extends ReaderOpeningCounter {
    /**
     * Add a whole window's counters to what is already there, every audience in
     * it, in one atomic write — creating rows that do not exist yet.
     */
    readonly applyWindow: (window: readonly AudienceCounters[], at: string) => Promise<Result<void, ReaderSignalStoreError>>;
    /**
     * One audience's counters, which is {@link applyWindow} over a single entry
     * and is implemented as exactly that in both shipped stores — so the two
     * cannot drift on the half that matters.
     */
    readonly apply: (counters: AppliedCounters, at: string,
    /**
     * The audience whose counters these are. Omitted is `aud_everyone`.
     */
    audience?: AudienceId) => Promise<Result<void, ReaderSignalStoreError>>;
    readonly tallies: (request?: TallyReadRequest) => Promise<Result<readonly StoredTally[], ReaderSignalStoreError>>;
    readonly funnels: (request?: TallyReadRequest) => Promise<Result<readonly StoredFunnel[], ReaderSignalStoreError>>;
    /**
     * How many page views there were, which is the denominator every rate on a
     * screen needs and the only row here written from two sides.
     */
    readonly pageViews: (request?: TallyReadRequest) => Promise<Result<readonly StoredPageViews[], ReaderSignalStoreError>>;
    /**
     * The same page views, by the hour they began in, over a range (`arrivals.ts`).
     */
    readonly arrivals: (request?: ArrivalReadRequest) => Promise<Result<StoredArrivals, ReaderSignalStoreError>>;
    /**
     * What readers did, per part, by the hour they did it in, over a range
     * (`acted.ts`).
     */
    readonly acted: (request?: ActedReadRequest) => Promise<Result<StoredActed, ReaderSignalStoreError>>;
    /**
     * A funnel pair's answers, by the hour the readers in each entered it, over a
     * range (`funnel-hours.ts`).
     */
    readonly funnelHours: (request?: FunnelHourReadRequest) => Promise<Result<StoredFunnelHours, ReaderSignalStoreError>>;
}

ArrivalReadRequesttype

A counter read, narrowed to a stretch of time.

type ArrivalReadRequest = TallyReadRequest & {
    /** Inclusive. Absent reads from the first hour the scope has. */
    readonly from?: number;
    /** Exclusive. Absent reads to the last hour the scope has. */
    readonly to?: number;
};

ActedReadRequesttype

The same read, narrowed to one part as well.

type ActedReadRequest = ArrivalReadRequest & {
    readonly nodeId?: NodeId;
};

FunnelHourReadRequesttype

The same read, narrowed to one funnel as well.

type FunnelHourReadRequest = ArrivalReadRequest & {
    readonly pair?: FunnelPair;
};

Unread

signals/unread

**The places a deployment's readers stopped, by what one fix recovers.**

UnreadStandingtype

Where one page stands in the order of places, or why it is not in it.

type UnreadStanding =
/** In the order, with at least one place the reading stopped and a sound pair behind it. */
"ranked"
/**
 * Every part of the page was reached by somebody.
 */
 | "whole"
/**
 * Nothing reported a view of this revision in the window, so nothing can be
 * said about any part of it.
 */
 | "unread"
/**
 * One window holds two forms of the page and the asking named neither, so it
 * is read as neither.
 */
 | "unsplit"
/**
 * The reading names nodes this revision does not contain, so the tree and the
 * window do not belong together.
 */
 | "mismatched";

UNREAD_STANDINGSvalue

const UNREAD_STANDINGS: readonly UnreadStanding[]

describeUnreadStandingfunction

One line per standing, for a surface naming why a page is where it is.

const describeUnreadStanding: (standing: UnreadStanding) => string

PageUnreadtype

One revision of one page, as the order of places has it.

type PageUnread = {
    readonly treeId: TreeId;
    readonly revision: number;
    /**
     * The audience this row is about, or `null` where the reading named none.
     */
    readonly audienceId: AudienceId | null;
    readonly standing: UnreadStanding;
    /** The page's frontier reading, carried whole and unchanged. */
    readonly reading: PageFrontier;
    /**
     * The place one fix recovers the most of this page at, or `null` where the
     * order did not rank it.
     */
    readonly at: UnreachedPart | null;
    /**
     * Parts of the page that one place accounts for, which is the key the order is
     * on.
     */
    readonly costs: number | null;
    /**
     * What share of the page's parts that one place accounts for, or `null` on the
     * same terms as {@link PageUnread.costs}.
     */
    readonly share: number | null;
};

DeploymentPlacetype

One place the reading of a page stopped, with the page it is on.

type DeploymentPlace = {
    readonly treeId: TreeId;
    readonly revision: number;
    readonly audienceId: AudienceId | null;
    /** The place itself, carried whole off its page's reading. */
    readonly at: UnreachedPart;
    /** What share of that page's parts this one place accounts for. */
    readonly share: number;
};

DeploymentUnreadtype

A deployment's pages, by what one fix to each would recover.

type DeploymentUnread = {
    /**
     * Every page with a place the reading stopped and a sound pair behind it,
     * worst first.
     */
    readonly ranked: readonly PageUnread[];
    /** Every other page, by tree id and newest revision first. */
    readonly unranked: readonly PageUnread[];
    /** The head of the order, which is the one place in this deployment to go to first. */
    readonly worst: PageUnread | null;
    /** How many pages stand in each state, over the ranked and the unranked alike. */
    readonly standings: Readonly<Record<UnreadStanding, number>>;
    /**
     * Distinct trees across every page read, which is not the number of pages.
     */
    readonly trees: number;
    /**
     * Places the reading stopped, added across the **ranked** pages.
     */
    readonly places: number;
    /**
     * Parts nobody reached, added across the **ranked** pages.
     */
    readonly unseen: number;
    /**
     * Pages whose reading names a part that said nothing while a part inside it
     * reported reach — a **slice** of the rows and not a further list.
     */
    readonly notReporting: readonly PageUnread[];
    /**
     * Readings of a revision beyond the first, which were dropped.
     */
    readonly duplicated: number;
};

deploymentUnreadOffunction

Read a deployment's pages as the places their readings stopped.

Shown in use on What your readers do — A count of parts is not a count of things to fix

const deploymentUnreadOf: (pages: readonly PageFrontier[]) => DeploymentUnread

worstPlacesInfunction

Every place the reading stopped across the deployment, worst first.

Shown in use on What your readers do — A count of parts is not a count of things to fix

const worstPlacesIn: (unread: DeploymentUnread, limit?: number) => readonly DeploymentPlace[]

View

signals/view

The one value in the reader-signal seam that correlates anything.

VIEW_KEY_BYTESvalue

128 bits, the same width a UUID spends on randomness.

const VIEW_KEY_BYTES = 16

VIEW_KEY_LENGTHvalue

const VIEW_KEY_LENGTH: number

viewKeyPatternvalue

const viewKeyPattern: RegExp

RandomBytestype

Where the randomness comes from. A parameter so a test can mint a key it can name, and for no other reason — a host has no business supplying this.

type RandomBytes = (count: number) => Uint8Array;

mintViewKeyfunction

A fresh view key. Called once per broadcast, never per batch — the whole point is that the batches of one page view agree.

const mintViewKey: (random?: RandomBytes) => ViewKey

Window

signals/window

The step between a store and a question: read a window of counters, and join it to the trees and the registry the counters were filed against.

ReaderWindowSourcestype

The stores a window is read from.

type ReaderWindowSources = {
    /** The counters, the funnel answers and the door rows. */
    readonly tallies: Pick<ReaderTallyStore, "tallies" | "funnels" | "pageViews">;
    /**
     * Where readers were, which is a second store and an optional one.
     */
    readonly regions?: Pick<ReaderRegionStore, "regions">;
};

ReaderWindowtype

One window of counters, as the stores answered.

type ReaderWindow = {
    readonly tallies: readonly StoredTally[];
    readonly funnels: readonly StoredFunnel[];
    readonly pageViews: readonly StoredPageViews[];
    /**
     * The region buckets, or `undefined` where no region store was offered.
     */
    readonly regions: readonly StoredRegionCount[] | undefined;
};

readReaderWindowfunction

Read one window from the stores, with one scope rather than four.

const readReaderWindow: (sources: ReaderWindowSources, request?: TallyReadRequest) => Promise<Result<ReaderWindow, ReaderSignalStoreError>>

WindowRevisiontype

One revision of one page, which is what a tree has to be found for.

type WindowRevision = {
    readonly treeId: TreeId;
    readonly revision: number;
};

revisionsInfunction

Every revision the window's rows name, deduplicated and in a stable order.

const revisionsIn: (window: ReaderWindow) => readonly WindowRevision[]

RevisionTreestype

Where the trees come from, as the join needs to see it.

type RevisionTrees = {
    /** The tree at that revision, or `undefined` where this source has none. */
    readonly treeFor: (where: WindowRevision) => LoomTree | undefined;
};

treesInfunction

The trees a caller already holds, as a source.

const treesIn: (trees: Iterable<LoomTree>) => RevisionTrees

UnjoinedCausetype

Why a revision the rows name has no reading.

type UnjoinedCause =
/**
 * The source has no tree at that revision.
 */
"no-tree"
/**
 * The source answered with a different page or a different revision from the
 * one asked for.
 */
 | "mismatched";

UNJOINED_CAUSESvalue

The closed set, for a surface accounting for every revision it cannot draw.

const UNJOINED_CAUSES: readonly UnjoinedCause[]

describeUnjoinedCausefunction

One line per cause, for a surface saying why a page is not on the screen.

const describeUnjoinedCause: (cause: UnjoinedCause) => string

UnjoinedRevisiontype

A revision whose rows could not be joined, and why.

type UnjoinedRevision = WindowRevision & {
    readonly cause: UnjoinedCause;
    /** Counter rows left unread, so the cost of not drawing it is a number. */
    readonly tallies: number;
};

WindowRegionReadingtype

A region map the window joined, keyed so it pairs with the page reading of the same form.

type WindowRegionReading = WindowRevision & {
    /**
     * The form these arrivals were served, or `null` where the rows named none.
     */
    readonly audienceId: AudienceId | null;
    /** The map itself, floored, as {@link regionReadingOf} reads it. */
    readonly reading: RegionReading;
};

WindowRegionReadingstype

Where a window's readers were, at the floor the caller handed in.

type WindowRegionReadings = {
    /**
     * One map per revision, per form, in a stable order.
     */
    readonly maps: readonly WindowRegionReading[];
    /**
     * The deployment's readership, over every row in the window.
     */
    readonly readership: RegionReading;
    /**
     * Rows beyond the first for one tree, revision, form and region — dropped
     * from every map, and counted here.
     */
    readonly duplicated: number;
};

WindowReadingOptionstype

What the join was asked to read the regions at.

type WindowReadingOptions = RegionReadingOptions;

DistinctRegionRowstype

The rows one region map may be read from, and the repeats it dropped.

type DistinctRegionRows = {
    /** The first row for each tree, revision, form and region, in the order they arrived. */
    readonly kept: readonly StoredRegionCount[];
    /** Rows beyond the first for one of those keys, which are in {@link kept} nowhere. */
    readonly duplicated: number;
};

distinctRegionRowsfunction

The rows of a window with the repeats of one bucket dropped, which is the one thing every reading of a region row set has to do first.

const distinctRegionRows: (rows: readonly StoredRegionCount[]) => DistinctRegionRows

WindowReadingstype

What a window came to once its rows were joined to the pages they are about.

type WindowReadings = {
    /**
     * One reading per page, per revision, per form — which is what one reading is
     * — in a stable order.
     */
    readonly pages: readonly PageReading[];
    /** Revisions the rows name that have no reading, in the same order. */
    readonly unjoined: readonly UnjoinedRevision[];
    /**
     * Where the readers were, or `undefined` where no region store was offered.
     */
    readonly regions: WindowRegionReadings | undefined;
};

windowReadingsOffunction

Join a window of counters to the pages it is about.

const windowReadingsOf: (window: ReaderWindow, trees: RevisionTrees, declarations: PartDeclarations, options?: WindowReadingOptions) => WindowReadings

WindowPairtype

A page in one form, with the two revisions of it a comparison is of.

type WindowPair = PageForm & {
    /** The earlier side. Its revision is always below `now`'s. */
    readonly was: PageReading;
    readonly now: PageReading;
    /**
     * Revisions of this form the window holds below `was`, oldest first.
     */
    readonly superseded: readonly number[];
};

UnpairedFormtype

A form the window holds one revision of, so there is nothing to compare it against.

type UnpairedForm = PageForm & {
    /** The one reading of it, carried so a surface drawing the page still has it. */
    readonly reading: PageReading;
};

WindowPairstype

What a window came to once its readings were paired into before-and-afters.

type WindowPairs = {
    /** One per form that has two revisions in the window, in a stable order. */
    readonly pairs: readonly WindowPair[];
    /** The forms that have one, in the same order. */
    readonly unpaired: readonly UnpairedForm[];
    /**
     * Readings handed in twice under one `readingKeyOf`, dropped before pairing.
     */
    readonly duplicated: number;
};

windowPairsOffunction

Pair a window's readings into the before-and-afters the comparisons take.

const windowPairsOf: (readings: readonly PageReading[]) => WindowPairs

FormPlacingtype

Where a form the window holds one revision of belongs, which is the one thing in this rung the counters cannot answer.

type FormPlacing =
/**
 * First served inside the window: the later library holds it and the earlier
 * one did not.
 */
"published"
/**
 * Served when the window began and not at its end: the earlier library held
 * it and the later one does not.
 */
 | "withdrawn"
/**
 * Served throughout and never republished: both libraries hold it, at the one
 * revision there is.
 */
 | "unchanged";

FORM_PLACINGSvalue

The closed set, for a surface accounting for every form it was asked about.

const FORM_PLACINGS: readonly FormPlacing[]

describeFormPlacingfunction

One line per placing, for a surface saying which library a page is in and why.

const describeFormPlacing: (placing: FormPlacing) => string

FormPlacingstype

Where the placings come from, as the libraries need to see them.

type FormPlacings = {
    /** Where that form belongs, or `undefined` where this source cannot say. */
    readonly placingFor: (form: PageForm) => FormPlacing | undefined;
};

PlacedFormtype

One form a deployment has placed, as {@link placingsIn} takes them.

type PlacedForm = PageForm & {
    readonly placing: FormPlacing;
};

placingsInfunction

The placings a caller already holds, as a source.

const placingsIn: (placed: Iterable<PlacedForm>) => FormPlacings

WindowLibrariestype

The two libraries a window holds, as the four library comparisons take them.

type WindowLibraries = {
    /** The deployment's pages at the revisions the window opened on. */
    readonly was: LibraryWindow;
    /** The same pages at the revisions it closed on. */
    readonly now: LibraryWindow;
    /**
     * Forms held at one revision that the placings could not place, in a stable
     * order.
     */
    readonly unplaced: readonly UnpairedForm[];
    /**
     * Forms named more than once across `pairs` and `unpaired`, dropped after the
     * first.
     */
    readonly duplicated: number;
};

windowLibrariesOffunction

Assemble a window's pairs into the two libraries the library comparisons take.

const windowLibrariesOf: (held: WindowPairs, rows: readonly StoredPageViews[], placings: FormPlacings) => WindowLibraries

DeploymentReadingContexttype

The configuration a deployment hands a reading of its own window.

type DeploymentReadingContext = {
    /** The trees the window's revisions were filed against, as the caller holds them. */
    readonly trees: RevisionTrees;
    /** What each primitive declares it plays and says, from the registry. */
    readonly declarations: PartDeclarations;
    /**
     * The smallest region bucket this deployment will name, in page views.
     */
    readonly floor: number;
    /**
     * Where a form the window holds one revision of belongs.
     */
    readonly placings: FormPlacings;
};

WindowAssemblytype

Everything a window holds, as the readings and the comparisons take it.

type WindowAssembly = {
    /** One reading per page, per revision, per form, with the regions beside them. */
    readonly readings: WindowReadings;
    /** The before-and-afters, which is what five of the nine comparisons take. */
    readonly pairs: WindowPairs;
    /** The two libraries, which is what the other four take. */
    readonly libraries: WindowLibraries;
};

windowAssemblyOffunction

Assemble a window into every subject a reading or a comparison of it takes.

const windowAssemblyOf: (window: ReaderWindow, context: DeploymentReadingContext) => WindowAssembly

Window agenda

signals/window-agenda

The deployment's fix-list, off one window, in one call.

WindowAgendatype

A deployment's fix-list and each of the readings it was joined from.

type WindowAgenda<TReason extends string = string> = {
    /**
     * Where reading stops on each page the window holds, in the readings' own
     * order.
     */
    readonly progress: readonly ReadingProgress[];
    /**
     * The pages by the readers each loses at its sharpest fall, worst first.
     */
    readonly order: DeploymentReading;
    /**
     * The pages by the readers each loses between the two ends of its sharpest
     * question, worst first.
     */
    readonly conversion: DeploymentConversion;
    /**
     * What is wrong with what this deployment collects, page by page.
     */
    readonly health: CollectionHealth;
    /**
     * Whether anything is arriving at this deployment, and what its door turned
     * away.
     */
    readonly arrival: ArrivalStanding<TReason>;
    /**
     * The pages by what one fix to each would recover, worst first, and every
     * place the reading of each stopped.
     */
    readonly unread: DeploymentUnread;
    /**
     * The fix-list: the two orders of pages, the measurements to repair, and the
     * one thing to do first.
     */
    readonly agenda: DeploymentAgenda;
};

windowAgendaOffunction

Read a deployment's fix-list off a window, its assembly and its funnels.

const windowAgendaOf: <TReason extends string = string>(window: ReaderWindow, assembly: WindowAssembly, funnels: WindowFunnels, schedule: CollectionSchedule | null, turnedAway: readonly TurnedAwayTally<TReason>[] | undefined) => WindowAgenda<TReason>

Window figures

signals/window-figures

The second rung: the figures a window holds about **itself**, rather than about one of the subjects the assembly under this publishes.

WindowFigurestype

What a window says about itself, once its subjects have been assembled.

type WindowFigures = {
    /**
     * Where the readers were and what the readers of each place read, or
     * `undefined` where no region store was offered.
     */
    readonly regions: RegionPagesReading | undefined;
    /** What the library asks of its readers' time, by kind of part, over every reading the window holds. */
    readonly pace: LibraryPace;
    /**
     * The states this window is in, over the caller's readings and the pace's own
     * rows.
     */
    readonly census: SilenceCensus;
    /**
     * Every entry the census was taken over, the caller's first and then the
     * pace's, so a caller may slice it and take a census of its own.
     */
    readonly silences: readonly ReadingSilence[];
};

WindowFigureOptionstype

What the figures are read at, beyond what the context already says.

type WindowFigureOptions = LibraryPaceOptions & {
    /**
     * The silences of the readings the caller took over this window's subjects,
     * one entry per reading and each already mapped through its own vocabulary's
     * `meaningOf…Silence`.
     */
    readonly silences?: readonly ReadingSilence[];
};

windowFiguresOffunction

Read the figures a window holds about itself off one call.

const windowFiguresOf: (window: ReaderWindow, assembly: WindowAssembly, context: DeploymentReadingContext, options?: WindowFigureOptions) => WindowFigures

Window funnels

signals/window-funnels

The one reading of a window that the assembly cannot be asked for in one call, published in one call.

FunnelPairingtype

Two revisions of one form, as their funnels answered.

type FunnelPairing = {
    readonly was: FunnelReach;
    readonly now: FunnelReach;
};

WindowFunnelstype

A window's funnels, read against the pages and the arrivals the window holds.

type WindowFunnels = {
    /**
     * One answer per reading the window holds, in the readings' own order.
     */
    readonly pages: readonly FunnelReach[];
    /**
     * One before-and-after per form the window paired, in the pairs' own order.
     */
    readonly pairs: readonly FunnelPairing[];
};

windowFunnelsOffunction

Read a window's funnels off the window and its assembly.

const windowFunnelsOf: (window: ReaderWindow, assembly: WindowAssembly) => WindowFunnels