Regression suites
A regression suite is a named, versioned set of cases that a change to a namespace's memory must not break. A suite belongs to one namespace.
A regression suite is a named, versioned set of cases that a change to a namespace’s
memory must not break. A suite belongs to one namespace. It names the memory keys and key
prefixes it covers and holds the cases: a prompt, and what the answer to it must do. Loom
stores the suite. The job that asks the prompts and grades the answers runs outside Loom
and fetches the suite with knowledge.suites.get. For a proposed change to a covered
key, the job records how each case went with knowledge.suites.submit_results, and a
reviewer reads the outcome with knowledge.suites.results.
Only an administrator of the namespace reads or publishes a suite, or records its results or reads them case by case, so the agents under test cannot read the expected answers or state their own outcome:
- The five operations need the
adminrole on the namespace. A writer, a viewer and a token narrowed to one user or session are refused. - None of them is an MCP tool, under any toolset, and a call through
loom_opis refused withOP_NOT_ON_MCP. An agent that runs on its developer’s administrator token does not pull a case into its context that way. - Case text is in no memory row, embedding or search index. Search, recall, context packs and exports do not return it.
A reader of the namespace sees the state of a pending proposal’s checks and no case (What others can see).
A token with admin on every namespace (*) reads the cases of every suite of its org.
The operations are
knowledge.suites.publish,
knowledge.suites.get,
knowledge.suites.list,
knowledge.suites.submit_results
and
knowledge.suites.results.
They are experimental. Regression suites in the
architecture section describes the design.
What a suite holds
| Field | Meaning |
|---|---|
suite |
The name: lower-case letters, digits, _, . and -, at most 64 characters. |
memory_keys |
Exact memory keys the suite covers, at most 200. |
memory_key_prefixes |
Prefixes of memory keys the suite covers, at most 50. A key that starts with a prefix is covered. |
cases |
At most 200 cases. A suite that covers a key holds at least one. |
revision |
Counts from 1. Each publish that changes the suite writes the next revision; a revision is frozen. |
A memory key is covered by at most one suite of its namespace. A publish whose keys or prefixes overlap another suite’s current revision is refused with 409, and the message names the key or prefix and the other suite. A namespace holds at most 200 suites, retired ones included.
A case:
| Field | Meaning |
|---|---|
case_id |
The case’s id in its suite: letters, digits, _, ., : and -, at most 128 characters. Unique in a revision. |
kind |
expect: the answer must show expectation. decline: the agent must decline. must_not_state: the answer must not say withdrawn. |
prompt |
What the job asks the agent, at most 4,000 characters. |
expectation |
The expected behaviour, or the rubric a grader follows, at most 4,000 characters. Required for expect. |
withdrawn |
The statement the answer must not make, at most 2,000 characters. Required for must_not_state and refused on the other kinds. |
origin |
The runs the case was written from: at most 8 entries of namespace and run_id. |
Keep a case’s id when you reword the case: the id is what ties a result on one revision
to a result on the next. An id that starts with draft- is kept for ids the server
issues, so a publish cannot add a case under one. A revision names at most 16 distinct
origin namespaces.
Maintain a suite from a file
A maintainer keeps each suite as a JSON file and publishes it with loom call. The file
is the body of knowledge.suites.publish without org and namespace, which loom call
fills from the session or from --org and --namespace.
Create a suite by publishing a file with expected_revision 0:
{
"suite": "finance",
"expected_revision": 0,
"memory_keys": ["billing/refund-window"],
"memory_key_prefixes": ["billing/plans/"],
"cases": [
{
"case_id": "refund-window",
"kind": "expect",
"prompt": "How long does a customer have to ask for a refund?",
"expectation": "Thirty days from delivery."
},
{
"case_id": "old-refund-window",
"kind": "must_not_state",
"prompt": "Is the refund window fourteen days?",
"withdrawn": "The refund window is fourteen days."
}
]
}
To change a suite, fetch its current revision into a file, edit the file and publish it:
$ loom call knowledge.suites.get suite=finance | jq '{suite: "finance", expected_revision: .revision, memory_keys, memory_key_prefixes, cases}' > suite.json
$ loom call knowledge.suites.publish --data @suite.json | jq -e '.conflict | not'
expected_revision in the file says which revision the file was written on. A publish
answers 200 with one of three outcomes, so a job checks the answer and not only the exit
status of loom call:
| Answer | Meaning |
|---|---|
written: true |
The file is now revision revision. |
written: false |
The file is the current revision already. Nothing was written, and revision is the current one. |
written: false, conflict: true |
Someone published after expected_revision and the file differs from the current revision. Fetch, merge and retry. |
The order of memory_keys, memory_key_prefixes and cases is not part of a revision:
keys and prefixes are stored sorted and without duplicates, and cases sorted by id.
A publish that is refused writes nothing:
| Status | When |
|---|---|
| 422 | Two cases share an id; a case lacks the field its kind needs, or has withdrawn on another kind; the first revision covers nothing; a suite that covers a key has no case; a new case id starts with draft-; an origin entry is added to a case already stored; the namespace is a personal collection. |
| 409 | The selection overlaps another suite’s, or the namespace already holds 200 suites. |
| 503 | Another publish to the namespace’s suites is being saved, or a rolling upgrade is not finished (rule 86). Retry after retry_after_s. |
knowledge.suites.get with revision set reads a past revision, and
knowledge.suites.list lists every suite of the namespace with what it covers and its
number of cases by kind, without case text or ids.
Retire a suite
A suite is not deleted. Publish it with both memory_keys and memory_key_prefixes
empty and it covers nothing: its keys are free for another suite, and its cases may stay
in the file or be removed. Its revisions stay readable.
Origin runs
origin records which runs a case came from. The server sets it when a case id is first
published and keeps it from then on: a later publish may leave the entries out but
cannot add one to a stored case. knowledge.suites.get serves an entry only to a caller
who holds viewer on the entry’s namespace, and only while the run still exists, and
leaves the others out without a marker. Publishing a file as get served it therefore
loses no stored entry and, with nothing else changed, writes nothing.
Maintain a suite in the dashboard
An administrator of the namespace finds its suites on the dashboard’s
Regression suites page (/admin/suites, in the admin
drawer’s Review group on a memory namespace). The page lists each suite with what it
covers, its cases by kind and its revision, and marks a suite that covers nothing.
New suite creates a suite from a name, at least one memory key or key prefix, and a first case. The name cannot be changed afterwards. A name the namespace already uses is refused in the dialog.
A suite’s own page shows its keys, its prefixes and its cases, and edits them: add or remove a key or a prefix, add a case, open a case to change it, or remove one. A case made in the page has no origin run, and an edited case keeps the origin it was stored with. The id of a case that a published revision holds cannot be changed, as What a suite holds explains.
Edits are unpublished changes until Publish, which lists them and sends them
together: a session of edits writes one revision, not one for each field. Publishing a
revision makes the result sets recorded for the revision before it outdated, as
Read the results of a proposal describes. The
confirmation says so, and a session of edits published together outdates them once. The
publish is made from the revision the page read. When someone published the suite in
between, nothing is written: the page reads the newer revision, applies the unpublished
changes to it, names the cases that were changed on both sides, and publishes only when
Publish is chosen again. A refusal from the table in
Maintain a suite from a file is shown in the server’s
words and the changes are kept.
Unpublished changes exist only in the open page. Leaving the page or switching the namespace asks before it discards them, and a reload discards them after the browser’s own prompt.
Retire… in a suite’s menu publishes the suite’s current cases with nothing covered, as Retire a suite describes, on the revision the list showed. Its confirmation says that the results recorded for that revision stop counting. A suite published after the list was read is not retired, and the page reads the list again. A retired suite is edited like any other: adding a key or a prefix and publishing makes it cover keys again.
Record results from a runner
A runner is the evaluation job: a program outside Loom that runs a suite’s cases for a
proposed fact and records how each case went. One call of
knowledge.suites.submit_results stores one result set: every case of the suite’s
current revision, for one memory key the suite covers and one exact content of it. Loom
runs no case and calls no model. Nothing is enforced on a result: an accept does not
read it.
- Read the pending keys with
memory.proposals, each proposal’s full value and itscontent_sha256withmemory.get_by_id, and the cases withknowledge.suites.get. The hash ofmemory.get_by_idis the one an accept sends; the listing serves none for a row ofhighsensitivity. - Run both arms of every case in one run. The baseline arm is the agent’s ordinary
read. The candidate arm is the same read plus the one candidate row, which the
harness adds, or
memory.searchwithinclude_proposedwith everyproposedhit of another key dropped. - A result checks the candidate as an addition beside every served fact, which is what
accepting it publishes. A
must_not_statecase is for a statement that is no longer served. - Send every case. A case that could not run is sent as
unavailable. Name the model, the grader and the trial rule inconfig. - Do not grade the case runs with
run.grade: that moves the proposal’s graded-run counts, and under an automatic policy enough fails reject it. - The runner’s service account is an
adminof the namespace: it can also publish a suite, reject proposals and delete memory. It cannot accept a proposal.
The body, as a file for loom call:
{
"suite": "finance",
"revision": 5,
"memory_key": "billing/refund-window",
"content_sha256": "<content_sha256 from memory.get_by_id>",
"outcomes": [
{ "case_id": "refund-window", "candidate": "pass", "baseline": "fail" },
{ "case_id": "old-refund-window", "candidate": "pass", "baseline": "pass" }
],
"config": { "model": "<model id>", "grader": "rubric", "trials": "3 of 3" }
}
$ loom call knowledge.suites.submit_results --data @results.json | jq -e '.state == "satisfied"'
| Field | Meaning |
|---|---|
revision |
The revision whose cases were run. It must be the suite’s current revision. |
content_sha256 |
The hash the server served for the candidate’s content: 64 lower-case hex characters. Send it as read; do not compute it. |
outcomes |
One entry per case of the revision, each case once: candidate is pass, fail or unavailable; baseline is the same case on the published state in the same run, and may be left out. |
config |
What produced the outcomes, at most 16 pairs: a key of 1 to 32 lower-case letters, digits and _, a value of at most 128 characters. model is required; grader, trials and candidate_read are the other documented keys. |
The answer is the state and the counts of the set as sent: state (satisfied,
failed or missing), passed, failed and unavailable. An answered call exits 0
whatever the state, so a job checks .state. Loom computes no pass rate and takes no
threshold or trial count: the runner applies its trial rule, sends one outcome per case
and states the rule in config.
The runner is recorded from its token, never from the body. Every call stores a new
set and none is replaced; a retry sent with the same Idempotency-Key stores one. A
submit that is refused stores nothing:
| Status | When |
|---|---|
| 404 | The suite has no revision. |
| 409 | revision is not the suite’s current revision. The message names both; fetch the suite and run again. |
| 422 | The suite does not cover the key; outcomes leaves out a case of the revision, names one it does not hold, or names one twice; config has no model or a pair out of shape; the hash is not 64 lower-case hex characters. |
| 503 | A rolling upgrade is not finished (rule 91). Retry after retry_after_s. |
Read the results of a proposal
knowledge.suites.results takes a memory key and a content_sha256 and answers for
that exact content. For a key no suite covers it answers covered: false and nothing
else. For a covered key it names the suite and its current revision and gives a state:
| State | Meaning | What clears it |
|---|---|---|
satisfied |
The newest result set for this content at the current revision has every case passed. | Nothing to clear. |
failed |
The newest set has a failed case. | The proposer edits the content, or the runner records a newer set. |
missing |
No set names this key, or the newest set has no failed case and at least one that could not run. | The runner records a set in which every case ran. |
outdated |
The only sets for this key are for other content or for an earlier revision of the suite. | The runner runs the current revision against this content. |
The newest set decides. Of two sets stored at the same millisecond, the worse one
decides: one with a failed case first, then one with a case that could not run.
earlier counts the older sets for the same content and revision, and earlier_failed
those of them with a failed case, so a run repeated until it passed stays visible.
Editing a proposal changes its hash, and publishing a suite revision changes the
revision: both leave the recorded sets in place and make them outdated.
With a deciding set the answer also carries passed, failed and unavailable, the
runner that recorded it, its config, recorded_at (the server’s clock), and one row
per case:
change |
Meaning |
|---|---|
fixed |
The baseline failed and the candidate passed. |
regressed |
The baseline passed and the candidate failed. |
same |
Both arms had the same outcome: the case does not tell the two apart. |
unavailable |
Either arm could not run. It is neither a failure nor a regression. |
no_baseline |
The runner sent no baseline for the case. |
kinds counts the current revision’s cases by kind and names every kind, so a suite
with no must_not_state or no decline case shows it. The answer holds case ids and no
case text; read the prompts and expectations with knowledge.suites.get.
A pass says the candidate did not break these cases, and nothing about other questions.
The graded runs of a proposal are a different measure: they count the runs that relied
on the key and were graded with run.grade, for whatever content the key held then.
Results are the suite’s cases for this exact content.
The state on each pending proposal
memory.proposals lists the same state on each proposal
it returns, as checks: the suite, its current revision, the state and the deciding
set’s passed, failed and unavailable, for the content hash stored with the row. A
high row, whose hash the listing does not serve, lists its state too. checks is null
for a key no suite covers. The listing serves it to every reader of the namespace and
holds no case id or text; a token narrowed to one user or session gets no checks. When
the checks cannot be read the listing still answers, with checks null on every row and
checks_unread in degraded.
In the dashboard the Proposals tab of the Review queue shows it in a Suite checks column, beside Graded runs. The column is drawn when a listed proposal has checks:
checks |
The cell says | Drawn as |
|---|---|---|
| null | nothing | an empty cell |
satisfied |
4 of 4 passed | a neutral mark, never a success |
failed |
1 failed | a danger mark |
missing, no set |
No results yet | a warning mark |
missing, a case could not run |
1 could not run | a warning mark |
outdated |
Results outdated | a warning mark |
not read (checks_unread) |
Checks unavailable | plain text, on every row of the list |
Suite checks in a proposal’s review
The dashboard shows the results case by case to an administrator of the namespace. The
review of a proposal that lists checks holds Suite checks between the fact’s text
and the reason field. The panel reads the results for the content_sha256 the review
read with the text it shows, which is the hash an accept sends. A role below admin
reads there the state the list served on the row, with the suite’s name and revision,
and no case: the review sends no call it would be refused. A proposal with no checks
has no panel.
The panel opens with the state, then names the suite and its current revision:
| State | The panel says |
|---|---|
satisfied |
4 of 4 passed · revision 5, drawn as a neutral mark and never as a success. |
failed |
1 failed |
missing |
No results yet, or 1 could not run when the newest set holds such a case. |
outdated |
Results are for other content or an earlier revision |
With a deciding set it shows who recorded the set, the model of its config and when,
and “2 earlier result sets, 1 failed” when older sets exist. A table then lists the
cases, 20 at a time: regressed first, then failed, could not run, fixed and unchanged.
A row gives the case’s id and prompt, its kind, the baseline and the candidate outcome
as Passed, Failed or Could not run, and the change: Regressed,
Fixed, Unchanged (the case does not tell the two apart), Could not run or
No baseline. A case’s id opens the row to its expected behaviour or rubric, or to
the statement it withdraws, read from the revision the results name.
Under the table the panel names each kind the suite holds no case of, and says what a pass does and does not say. Without a deciding set it says that a runner records results and links to Record results from a runner. When the suite stopped covering the key after the list was read, it says No regression suite covers this key and links to the Regression suites page.
The panel decides nothing: both decisions work the same whatever it shows. When its read fails it says so in its own line, and on a server that does not serve the results the review shows no panel.
What others can see
The audit log is read by every reader of the namespace. Each publish is recorded there
with the suite’s name, the revision, the number of keys, prefixes and cases by kind, and
the length and a keyed hash of the cases, never a case’s id or text. A suite’s name must
therefore not carry an expectation. Each submit of results is recorded with 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, never a case’s id or a config value.
Every reader of the namespace also sees, on each pending proposal memory.proposals
lists, the name of the suite that covers its key, the suite’s revision, the state of the
proposal’s content and the number of cases by outcome
(The state on each pending proposal). An agent
that proposed a fact learns from it why the proposal waits, and no case.
Storage and erasure
Every revision stays stored, with its case text, until the namespace is erased: a
namespace erasure deletes the namespace’s suites and every result set recorded for
them. A user’s erasure does not reach a suite or a result set, because a case belongs
to the namespace and names no user. Do not put a person’s data in a case or in a
config value.