Presence
presence: { label, field, release } states a label below the fact’s label at
which a fact’s existence is known: its key and the listed fields. ctx.has
reads at it, so a frame that clears the presence label but not the fact’s
label learns whether the fact exists, and nothing else.
release is the standing release the listed fields
stand under. An index whose fields are all known at the presence label serves
selections from frames that clear only that label. A labelled table is
protected, so that index keeps tokens of its
fields at the store: it answers exact lookups, and other shapes through
ctx.list(selection.atMost(n)). A reviewed store exposure lets the store serve ordered shapes on that index.
Totals
total: [{ group, sum, erased }] declares counts, and exact sums, that the
host maintains for each group of the group fields (one to four) on every
write. Totals are unnamed and matched by structure, like indexes.
sum names each summed field with its fixed scale: a t.decimal at the given
number of places, or a t.int at scale 0. erased: true keeps erased facts
in the count, and then sums nothing. A .total() no declared total serves is
refused with TotalMissing and the entry to add.
ctx.count(selection) is the exact count of any served selection, maintained
or not. On a protected table it counts only a
selection that fixes every field of an index by equality, a minted table
whole, or an exposed store order; count anything else with a total. A total
is cheaper for a figure read often over many facts.
Maintained totals need disjoint contributions and bounded closure evidence.
For example, put an operations ledger at one fixed operations label and
declare total: [{ group: ["status"] }] on it. A query under
operations can read ctx.get(ledger.where({ status: "open" }).total()).
A family-member total that needs to enumerate covered sources refuses.
An ordinary Root row count can combine overlapping covers for a complete
equality selection when the cover has a bounded source population without
erasable or expiring rows. The read counts each admitted identity once.
Collections that need source closure or range evidence use a disjoint path
or a separately published figure.
To publish a lower-audience figure, have a high-side app compute the approved
figure at a declared cut and write it to an operations.seal(t.int) field.
A mutation with the reviewed Release can use
ctx.open(report.openCount, { release: publishCount }) and write the number
to its audience’s report table. Give that Release a fixed output shape,
cadence, and erasure policy. Review the effect of repeated exact counts or
adaptive filters as part of the same disclosure.
Disclosure
State machines
machine: { field, initial, edge, undeclared, history } states the values one
field may hold and the named edges along which it may change. The host
enforces it on every write.
initialis the state or states a fact may be born in.edgenames each allowed change. An edge’sduenames a field holding the instant the edge falls due: while the fact is infromand the field holds an instant, the fact moves totoat it. Nothing runs at the instant; every write that leaves the fact infromdecides the edge again, and taking another edge, clearing the field or deleting the fact ends it.undeclaredsays what any other change does:refuse(the default),keep(commit and record it) ordrop(commit nothing for that fact).historykeeps the fact’s superseded machine versions readable for that long.
Marks
mark on a series or timeline is the width of the valid-time buckets the
host marks on every write. A rollup reads which buckets changed, instead of
scanning the series.
ctx.retract on a mark clears it once the rollup
has handled the bucket. A marked series also keeps readings.spans: the spans
a range retraction dirtied, as a table of { meter, at, dirtyEnd, dirtyTier, dirtyAfter } facts that a rollup reads, patches and deletes.
Writers
writers: () => [...] restricts which mutations or subtrees in the app tree
may write to the table. Each entry is a placed mutation (exact path) or a
placed subtree (any function under that path). app() resolves the thunk once
the tree is placed and lowers the list onto the table; the host compiles it
into a write guard on act.write(table) that refuses any other application
writer with Forbidden (with guard set to the table’s path).
A direct operator write has no writer function. The guard refuses it.
To prevent writes at compile time as well, expose the table through
table.readOnly(t). Callers receive a ReadOnlyTable handle that keeps point
reads and selections but rejects insert, patch, replace, put, delete
and retract at type-check time (NotWriter).
Private tables
private: true keeps a table to the subtree that holds it: vault.secrets
belongs to vault. Only functions placed under that subtree read or write
the table, including the ones another function reaches with ctx.call.
Every other function is refused, whoever calls it: a read with
LibraryTableReaderRequired, a write at commit by the table’s write guard
(LibraryTableWriterRequired in its message). A library uses it for facts
the app must not touch directly, such as credentials, while the app still
places the tables by placing the library. The installation itself (the
operator and the /test harness’s k.get and k.list) still reads them.
A private table is never placed at the root (PrivateAtRoot). With
writers, every writer stays inside the subtree (PrivateWriters).