Skip to content
Loom Docs
Esc
↑↓navigate↵open⌘Jpreview
Product
View as Markdown
On this page

Regression suites

A regression suite is a record of one namespace: a name, the memory keys and key prefixes it covers, and a set of cases that a change to those keys must not…

A regression suite is a record of one namespace: a name, the memory keys and key prefixes it covers, and a set of cases that a change to those keys must not break. Each publish writes one frozen revision. Loom stores suites and serves them to the namespace’s administrators; the job that runs the cases and grades the answers is outside Loom. The job records how each case went for one content of a covered key, and Loom derives the state of that content from what was recorded. Regression suites in the features section is the maintainer’s guide.

A suite is a record about memory, not a memory: it changes no served fact and takes no part in belief revision. It has no agent, user or session axis. Its identity is (org, namespace, suite), taken from the gated request, and written_by is the actor of the token (writer_actor).

Storage

loom.knowledge_suites is a plain MergeTree ordered by (org, namespace, suite, revision), insert only, with no partition and no TTL.

Column Holds
org, namespace, suite The suite.
revision Counts from 1.
memory_keys, memory_key_prefixes What the revision covers, sorted and without duplicates.
case_ids, case_kinds The cases’ ids and kinds, in id order.
cases The cases, text included, as canonical JSON: sorted by id, sorted keys, compact.
written_by, written_at The publishing actor and the time.

A revision is one row and is never rewritten, so a merge has nothing to collapse and a read needs no FINAL. The current revisions of a namespace are one aggregate: per suite, max(revision) and argMax of a tuple of the other columns. Taking the columns as one tuple means two rows can never contribute different columns to one answer. That read selects no case text and no case id; only knowledge.suites.get and the publish’s read of its own suite add cases to the tuple.

The table sets index_granularity = 64: it is small and every read names one namespace, so a small granule keeps a read from loading other namespaces’ rows. The value is set when the table is created, because a self-hosted server refuses to change it on a table that holds parts.

Publishing

knowledge.suites.publish takes the whole document and the revision it was made from. In order:

  1. A personal collection is refused: it has no suite.
  2. The body is checked without a read (server/knowledge/domain/suites.py): one case per id, the field each kind needs, a first revision that covers something, a case for a suite that covers something. A refusal names the case id and the field, never text.
  3. The fleet gate: 503 unless every live replica can erase a suite (rolling upgrades).
  4. A claim on the namespace’s suites, held for the rest of the call. A publish that cannot take it within 5 seconds answers 503.
  5. Under the claim, two reads: the current revision of every suite of the namespace (coverage only) and this suite’s current row with its cases.
  6. The origin rule (below), which needs the stored cases.
  7. The document equal to the current revision answers written=false. A document made from an older revision answers conflict=true with the current revision. Neither writes.
  8. A selection that overlaps another suite’s current revision, or a new suite in a namespace that holds 200, is refused with 409.
  9. One insert at revision + 1.

The claim is what makes the revision a compare-and-set. The table keeps every row it is given, so two publishes that both read revision 3 would both insert revision 4. The claim is per namespace, not per suite, because the overlap check reads every suite of the namespace. It is taken with settled writes: an insert sent under the claim ends before the claim can pass to another publish, so the insert of a cancelled or timed-out call cannot land after the next publish has read the head.

Keys and prefixes are stored sorted and without duplicates and cases sorted by id, so a reordered file is the same document and writes nothing.

One suite per key

A key is covered by at most one suite of its namespace. The check and the lookup share one structure (Coverage): exact keys in a dictionary, prefixes in a dictionary, and the distinct prefix lengths. suite_for(key) looks the key up, then each key[:n] for the distinct lengths. A publish is refused when one of its keys is covered by another suite, or when one of its prefixes is covered by, or covers, another suite’s key or prefix.

A suite published with an empty selection covers nothing and frees its keys. It still counts toward the 200 suites, since its revisions stay stored.

The origin rule

A case may name the runs it was written from (origin: a namespace and a run id). The server sets a case’s origin, and the body only proposes it:

  • A case id the current revision does not hold takes the body’s entries. An id that starts with draft- is refused there: the prefix is kept for ids the server issues.
  • A case id the current revision holds keeps its stored entries. The body may leave entries out, and may not add one.

So an origin is never dropped by an edit, and never added to a case after the fact.

Reading

knowledge.suites.get reads one revision, the current one by default. It filters each case’s origin before it answers: an entry is served only when the caller holds viewer on the entry’s namespace and the run still exists (one statement over loom.agent_runs for all the entries). An entry that fails either test is left out with no marker, so the answer does not confirm a run the caller cannot read, or one that was erased. With the origin rule, a caller who is served fewer entries than are stored can publish what it read without losing them.

knowledge.suites.list reads the current revision of every suite: names, coverage, counts by kind, who published and when.

Both run inside own_write_reads(), so a read that follows a publish on another replica sees the publish.

Results

A result set records, for one memory key a suite covers and one exact content of it (content_sha256), how every case of one suite revision went with that content as the candidate and, when the runner sent it, on the published state in the same run (baseline). A result set is evidence about a proposal. It changes no fact and takes no part in belief revision, a pass grants nothing, and no decision reads it.

loom.knowledge_suite_results is a plain MergeTree ordered by (org, namespace, memory_key, suite, recorded_at), insert only, with no partition and no TTL, at index_granularity = 256.

Column Holds
org, namespace, suite The suite.
memory_key, content_sha256 What was run: the key, and the hash of the candidate content.
suite_revision The revision whose cases were run.
case_ids, candidate, baseline Parallel arrays in case id order: each case’s outcome with the candidate (pass, fail, unavailable) and on the published state (the same, or '' when not sent).
config What the runner said produced the outcomes; model is always present.
runner, recorded_at The actor of the token (writer_actor), and the serving replica’s clock.

The table holds no case text. A set has no agent, user or session axis: like the suite, it is a record of the namespace.

Recording a set

knowledge.suites.submit_results, in order:

  1. Checks without a read (server/knowledge/domain/suite_state.py): each case named once, and a config with a non-empty model and pairs in shape.
  2. The fleet gate: 503 unless every live replica can erase a result set (rolling upgrades).
  3. One read of the suite’s current revision: what it covers and its case ids, no case text. It runs inside own_write_reads().
  4. The refusals: 404 when the suite has no revision, 409 when revision is not the current one, 422 when the suite does not cover the key or the outcomes do not name every case of the revision exactly once.
  5. One insert. The answer is the state and counts of the set as sent.

The submit reads no memory row, so a set for a hash that no proposal holds is stored. A set is complete by construction: a case that could not run is sent as unavailable, and a revision is frozen, so a stored set names every case of its revision. That is why the state needs only counts. No claim is taken: a publish that lands between the read and the insert leaves a set for the revision before it, which reads outdated.

The state

The state is derived on every read by one pure function and is never stored. For a key covered by suite S at current revision N and a content hash H, with C the newest set for (key, S, H, N):

State When Counts served
satisfied C exists, no case failed and none was unavailable of C
failed C exists and a case failed of C
missing C exists with no failed case and an unavailable one, or no set names the key under S of C, or zeros
outdated No C, and a set names the key under S with another hash or another revision zeros

No evidence is no verdict: an unavailable case and an absent set read missing, never satisfied.

knowledge.suites.results reads the namespace’s suite heads (coverage and case ids), then one aggregate over the sets of the key under S, grouped by content hash and revision (server/knowledge/store/suite_results.py). The group of (H, N) is ordered first and the read takes two rows, so the answer holds two rows at most: the group of (H, N) when it has a set, and another group when one exists. The scan is not bounded: the statement reads every set stored for the key under S and builds every group before it orders them. Only a namespace erasure removes a set, so the scan grows with the key’s history. Inside a group the deciding set is argMax(columns, (recorded_at, has a failed case, has an unavailable case)): the newest set, and of sets with one recorded_at the worse one. recorded_at is the serving replica’s clock, and the skew between replicas is below the length of a run. earlier is the group’s size less one, and earlier_failed its sets with a failed case, less the deciding set when it has one.

Each case of C carries a change, derived inside the set: fixed (baseline fail, candidate pass), regressed (the reverse), same, unavailable (either side, so an outage is never a fix or a regression) and no_baseline. Loom computes no rate, threshold or statistic; the runner states its trial rule in config.

The state on a proposal listing

memory.proposals serves the same state on each row it returns, as checks: the covering suite, its current revision, the state and the counts of C for the row’s stored content hash. A high row lists it too: the server reads with the stored hash, which the row does not serve. The listing and knowledge.suites.results call the one state function over the same deciding set (server/knowledge/app/suite_checks.py), so they agree for one key and hash.

The checks are read after only and limit, for the page alone, in two statements: what each suite’s current revision covers (no case kind, id or text), then, only when a listed key is covered, one aggregate over the sets of the covered keys, grouped by key, suite, content hash and revision, that selects each group’s deciding outcomes and no case id, baseline or config. The keys are bound a slice at a time, so a page of long keys takes one statement a slice. A slice that holds more than 20,000 groups is not cut: the read fails, since a cut read could drop the group that decides. count_only reads neither table. The reads are plain: a set recorded on another replica shows on the next listing.

The listing never fails on the checks. When either read fails it answers with checks null on every row and checks_unread in degraded: an unread state is never served as satisfied, and the listing decides nothing.

Who reads a suite

A case states the answer an agent is expected to give, so the agents under test must not read it, and must not record how they did on it:

  • The five ops need admin on the namespace.
  • memory.proposals, at its viewer floor, serves for a pending proposal the name of the suite that covers its key, the suite’s revision, the state and the number of cases by outcome. A proposer learns why its proposal waits, and no case id or text. A token narrowed below the namespace gets no checks: a set carries no user or session, so the state of the caller’s row would show that a set exists for another user’s content of the key.
  • A token narrowed below the namespace (to a user or a session) is refused at the gate: a suite row carries no user to filter by.
  • The ops are hidden from MCP, under every toolset.
  • Case text is stored in loom.knowledge_suites and reaches no memory row, record, embedding or text index. Search, recall, context packs and exports cannot return it.
  • An answer of knowledge.suites.get sent with an Idempotency-Key is kept for 24 hours in the replay cache (loom.idempotency). It is served to the same caller only and removed by the namespace’s erasure.
  • The audit row of a publish holds the suite’s name, the revisions, the outcome, the number of keys, prefixes and cases by kind, the length of the canonical cases and a keyed hash prefix of them. It holds no case id and no text. The hash is keyed with the deployment’s signing secret because the audit log is read by every reader of the namespace and outlives the suite: a plain hash would let a reader confirm a guessed case.
  • The audit row of a submit holds the suite’s name, the revision, the memory key, the content hash, the number of cases by outcome and the names of the config pairs. It holds no case id and no config value.

Erasure

Both tables are in the erasure census at namespace scope. A namespace erasure deletes the namespace’s rows of both in the knowledge_suites.delete step, one mutation a table. A user’s erasure has no step for either table: a case and a result set belong to the namespace and name no user. Nothing short of erasing the namespace removes a revision or a result set.

Rolling upgrades

A build without the table serves none of the ops, and its namespace erasure has no step for the table. knowledge.suites.publish therefore answers 503 OVERLOADED until every live replica of every deployment on the store runs the migration that adds the table, and while the fleet cannot be read. The reads are not held. A rollback leaves the rows stored and unserved; a namespace erasure the older build runs leaves them, and is run again once the newer build serves (rule 86, the rollback note).

The results table follows the same rule at the migration that adds it. A build without it serves neither results op, and its knowledge_suites.delete step deletes the suites and leaves the result sets. knowledge.suites.submit_results therefore answers 503 OVERLOADED until every live replica runs the migration that adds the results table; knowledge.suites.results is not held (rule 91).

Limits

Limit Value
Suites in a namespace 200
Cases in a revision 200
Exact keys in a revision 200
Key prefixes in a revision 50
Origin entries in a case 8
Origin namespaces named in a revision 16
Outcomes in a result set 200
Pairs in a result set’s config 16

The limits are fixed, not settings: they bound the size of one row and of the coverage read a publish makes under its claim.

Last updated on

Was this page helpful?