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

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:

  • Six of the seven operations need the admin role on the namespace. A writer, a viewer and a token narrowed to one user or session are refused.
  • None of the six is an MCP tool, under any toolset, and a call through loom_op is refused with OP_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.

The seventh, knowledge.suites.add_draft, is the one a writer calls: an agent files a draft case for a maintainer to take, and is answered the draft’s id and nothing of the suite (File a draft case from an agent).

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.add_draft, knowledge.suites.dismiss_drafts, 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.
required Whether an accept of a covered key needs satisfied checks (below).
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 to drafts, so a publish adds a case under one only when it is the id of a pending draft of the suite. 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- and is not a pending draft’s; an origin entry is added to a case already stored or drafted; 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, a rolling upgrade is not finished (rules 86 and 102), or the record of a change to the requirement could not be written. 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 is drafted or its 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.

File a draft case from an agent

An agent that meets a failure worth keeping as a test files a draft case with knowledge.suites.add_draft. The call needs the writer role. It names the memory key the case is about, not a suite, and holds the case without an id:

{
  "memory_key": "billing/refund-window",
  "case": {
    "kind": "expect",
    "prompt": "Can a customer ask for a refund after forty days?",
    "expectation": "No: the window is thirty days from delivery.",
    "origin": [{ "namespace": "support", "run_id": "run-8f2c" }]
  }
}
$ loom call knowledge.suites.add_draft --data @case.json
{"case_id": "draft-3f9a1c0b7e42"}

The answer is the id the server issued, draft- and twelve hexadecimal digits, and nothing else: not the suite’s name, a case of it or how many drafts it holds. A draft changes no served fact and is in no revision until a maintainer publishes it.

Over MCP the operation is called by name through loom_op. No toolset lists it.

A draft that is refused stores nothing:

Status When
422 The case lacks the field its kind needs or has withdrawn on another kind, as for a published case.
404 No suite of the namespace covers the key. The message is no regression suite covers this key.
409 The suite that covers the key holds 200 pending drafts. A maintainer adds or dismisses them.
503 A rolling upgrade is not finished (rule 86). Retry after retry_after_s.

The limit is read before the draft is stored, so drafts filed at the same moment may pass it by as many as were in flight.

Take or dismiss a draft

knowledge.suites.get of a suite’s current revision serves its pending drafts in drafts, oldest first, each with its case_id, the draft as a case under that id, drafted_by and drafted_at. A read that names a revision serves none. knowledge.suites.list gives each suite’s number of them in pending_drafts. A draft’s origin runs are served like a case’s (Origin runs).

A maintainer takes a draft by publishing a case under the draft’s id, reworded or not. The case keeps the origin the drafter stored, whatever the publish sends, and the draft is no longer pending. A publish that leaves a draft out changes nothing about it.

knowledge.suites.dismiss_drafts with suite and up to 200 case_ids dismisses the pending drafts it names and answers how many, in dismissed. An id that is not a pending draft of the suite is skipped. A dismissed draft cannot be restored, and its id cannot be published.

Two limits follow from how a draft is stored:

  • A user’s erasure does not remove a draft, or a case written from that user’s run.
  • A dismissed draft’s text stays stored until the namespace is erased.

Write the case in your own words, and put no person’s data in it.

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.

The suite’s page lists its pending drafts under Draft cases: each draft’s prompt, its kind, who drafted it and when, and the origin runs the server served. The list of suites shows how many each suite holds. Add to suite on a draft adds it to the unpublished changes as a case under the draft’s id, which cannot be changed; the case is edited like any other and goes out with Publish. Removing it before the publish puts the draft back as it was drafted. Dismiss… in a draft’s menu dismisses it after a confirmation, since a dismissed draft cannot be restored.

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.

The switch Require passing results to accept a proposal on the suite’s page sets the requirement. It is one more unpublished change and goes out with Publish, whose confirmation adds that proposals on the suite’s keys wait for new results. Under the switch the page says what the requirement holds and what it does not check. After the publish the page compares the answer’s required with what it sent and says so when a server a release behind did not take it. The list of suites says Required beside the name of a suite that is.

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. A result holds an acceptance only where the suite is required (Require passing results); elsewhere an acceptance records the state it read and is not held by it.

  1. Read the pending keys with memory.proposals, each proposal’s full value and its content_sha256 with memory.get_by_id, and the cases with knowledge.suites.get. The hash of memory.get_by_id is the one an accept sends; the listing serves none for a row of high sensitivity.
  2. 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.search with include_proposed with every proposed hit of another key dropped.
  3. A result checks the candidate as an addition beside every served fact, which is what accepting it publishes. A must_not_state case is for a statement that is no longer served.
  4. Send every case. A case that could not run is sent as unavailable. Name the model, the grader and the trial rule in config.
  5. 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.
  6. The runner’s service account is an admin of 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, and required, whether the suite requires them. 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.

The stored hash and the hash memory.get_by_id serves differ for some values, such as an object with a null field. For such a row the listing’s state and advice are for the stored hash, and an acceptance reads the state of the served one, which is the hash a runner records under. Once the runner has recorded results, the row lists outdated, and under a required suite the blocker checks_required, while its acceptance goes through when those results are satisfied. knowledge.suites.results with the hash of the full read answers the state the acceptance reads.

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

A cell of a required suite ends with · required, as in No results yet · required.

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 for a suite that is not required: both decisions work the same whatever it shows. For a required suite whose results the review read as not satisfied, Accept is unavailable and gives the reason, A required suite’s checks are not satisfied: followed by the panel’s own first line. The comparison still opens and a rejection works. When the panel’s read fails it says so in its own line and Accept stays available: the server decides, and answers the key with its reason. On a server that does not serve the results the review shows no panel.

Require passing results

A suite’s owner makes satisfied checks a condition of an acceptance by publishing the suite with required: true:

$ loom call knowledge.suites.publish --data @suite.json required:=true | jq '{revision, required}'

Read required in the answer: a server a release behind ignores the field and answers without it. knowledge.suites.get, each row of knowledge.suites.list, knowledge.suites.results and each proposal’s checks carry required too.

While the suite is required, memory.proposal_decide accepts a covered key only when the state of the proposal’s content, for the hash a full read serves, is satisfied at the suite’s current revision. Otherwise the key answers the code checks_required and stays pending, the other keys of the call are decided, and reason names the suite, its revision and what the results say:

State reason ends with
failed 1 case failed for this content, or 2 cases failed …
outdated its results are for other content or an earlier revision
missing, a case could not run 1 case could not run for this content, or 2 cases …
missing, no set no results for this content

The check comes after the other refusals of an acceptance, so a key answers checks_required only when nothing else holds it. When the checks cannot be read the call fails with a 5xx and decides no key: an unread state never passes as satisfied. A rejection reads no checks, whoever sends it, and neither does the rejection an owner’s policy writes.

The requirement is part of the revision:

  • A publish without required keeps the suite’s value. A first revision without it is not required.
  • Turning it on or off writes a revision even when nothing else changes, and a revision makes the recorded result sets outdated. Proposals on the suite’s keys then wait for the runner to record results for the new revision.
  • knowledge.suites.get with revision set answers the requirement in force at that revision.

Turning the requirement on, turning it off, and removing a key, a prefix or a case from a required suite each write an audit row, knowledge.suites.requirement, before the revision. A publish whose row cannot be written answers 503 and publishes nothing.

What a required suite does not hold:

  • A write that is not a proposal. memory.set without proposed, memory.update and memory.update_by_id by a writer of the namespace are not checked.
  • A definition draft approved in the review queue, and a promotion.
  • A proposal under a key outside the suite’s selection. Select by a prefix that puts the topic first in the key, such as metric/net_revenue/, so a new key for the topic is covered.
  • A key the suite stops covering. Retiring the suite, or removing the key or its prefix, frees the key, and the audit row names what was removed.

required: true answers 503 until every server runs a release that checks it (rule 102). There is nothing to turn off before a rollback: a build a release behind accepts without the check, keeps the stored requirement through the revisions it publishes, and the check applies again once the newer build serves.

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. Each draft is recorded with its memory key, the id the server issued, its kind, the length and a keyed hash of the case and the number of origin runs, and each dismissal with the suite’s name and the ids of the drafts, never a draft’s text. A change to a suite’s requirement is recorded with the suite’s name, the two revisions, the requirement before and after, the keys and prefixes removed and the number of cases removed, and an acceptance of a covered key with the suite’s name, its revision and the state the acceptance read.

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, whether it is required, 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, every result set recorded for them and every draft filed for them, dismissed ones included. A user’s erasure does not reach a suite, a result set or a draft, because a case belongs to the namespace and names no user. Do not put a person’s data in a case, a draft or a config value.

Last updated on

Was this page helpful?