Skip to content
Talk to our solutions team

Keeping Runs and the Studio

Every run of kis test run and kis test load is kept, so it can be listed, compared and sent to the Studio later. The DuckDB file keeps the newest ten runs by default. This page covers where runs are kept, what a kept run holds, how secrets are masked, and how runs reach the Studio.

--store takes a comma-separated list of ways to keep the run:

GivenKeeps the run in
nothingDuckDB at .kis/test/results.db
--store duckdbDuckDB at .kis/test/results.db
--store duckdb=<file>DuckDB at that file
--store jsonl.kis/test/runs/<run id>.jsonl
--store jsonl=<dir><dir>/<run id>.jsonl
--store studiothe Studio that .kisai/studio.yaml names
--store duckdb,jsonl,studioall three
--store nonenowhere

--db <file> is the same as --store duckdb=<file>, and can be given with --store jsonl or --store studio.

Paths are relative to the product root: the nearest folder at or above the tests root (the --tests folder, or a test file’s folder) that holds product.yaml, else the top of the git work tree, else the tests root itself.

The exit code is the tests’ alone. A store that fails during a run is reported once on stderr and is not used for the rest of the run; the other stores keep the whole run. When a store you named cannot open before the run starts, the run does not start. The default DuckDB file that cannot open is reported as a warning and the run goes on.

Every store is closed before the process exits, so the DuckDB file is complete and the JSONL and Studio stores have flushed, whatever the tests’ outcome.

Every store keeps the same records, in the shape talos.run/v1, published as the JSON Schema run-record.v1.json with the talos schemas.

A run is a stream of records, one JSON object each:

{"v":1,"kind":"step","id":"a1b2c3d4e5f6a7b8c9d0e1f2","run_id":"6f1c2a9b0d3e4f5a6b7c8d9e", ...}
  • run, written when the run starts (status running) and again when it ends;
  • suite, test and step, written as each finishes: a test’s steps, then the test, then its suite when the suite ends;
  • load_stat, load_threshold, load_error, load_window and load_resource for a load run;
  • route_coverage, code_coverage and coverage_summary for coverage.

Each record has the engine’s id, the same in every store. A later record with the same id replaces the earlier one. Times are RFC 3339 in UTC, durations are *_ms, and paths are relative: a test’s file and a suite’s path to the tests root (the root suite’s path is .), a kept file’s path to the run’s artifacts folder, and a CLI step’s cwd to the product root.

A step record carries its hook (before_all, after_all, before_each, after_each), its place among its siblings (sort_order), its group (parent_id), its attempts, summary, log, assertions, the variables it captured with how far each travelled (variable_info: test, suite or run, and its source), its evidence (one object, its protocol naming which), and the files it kept with their size and SHA-256. A test record carries its ref, tests/<file>#<table group or name>, which is how the Studio matches it to a test case.

The run record also says what the tests ran on and how the run started:

FieldFrom
git.repositorygit remote get-url origin, as host/path without credentials or .git
git.commitgit rev-parse HEAD
git.ref, git.ref_typeKIS_TEST_REF and KIS_TEST_REF_TYPE; else the CI’s variables (GitHub and Forgejo Actions, GitLab, Jenkins, Buildkite); else the checked-out branch, or a tag at the commit; else detached
git.dirtyuncommitted changes or untracked files outside .kis/ and .kisai/
triggerKIS_TEST_TRIGGER when set; else ci when CI is true or a CI’s variables are present; else local. With the CI provider, its job URL and run id
tests_rootthe tests root, relative to the product root
environment--name, else the env file’s name
tags_filter, exclude_tags--tags and --exclude-tags
runner_versiontest.svc’s version and build commit
host, userthe machine and the OS user
distributed.agentshow many agents ran a distributed run

A detached checkout with no branch or tag prints a warning: set KIS_TEST_REF (and KIS_TEST_REF_TYPE=tag for a tag) to name it.

Secrets are masked in a step before any store or report sees it, so DuckDB, JSONL, the Studio, the HTML report, JUnit and the console all show the same masked step. The tests themselves run with the real values.

  • Headers by name: Authorization, Proxy-Authorization, Cookie, Set-Cookie, X-Api-Key, X-Auth-Token, and any whose name contains token, secret, password or api-key. The value becomes [masked]; Authorization keeps its scheme (Bearer [masked]). The same values are masked anywhere else in the step, such as a response that echoes them.
  • Secret variables: those an env file lists under secrets:, those given with --secret name=value, and any variable whose name matches password, passwd, secret, token, api_key, private_key or credential (any case, - or _). Their values, four characters or longer, are masked in bodies, URLs, headers, SQL parameters and rows, gRPC payloads and metadata, CLI arguments and output, script output and logs, captured variables, assertions, errors, summaries and logs.
  • URL query parameters whose names match the same pattern.
env.yaml
secrets: [shared_phrase]
default:
base_url: http://localhost:8080
shared_phrase: open-sesame
Terminal window
kis test run -t tests/ --secret api_token=$API_TOKEN

--secret sets the variable as --vars does, and marks it secret. Precedence, low to high: suite.yaml variables, the env file, --vars, --secret.

One file per run, .kis/test/runs/<run id>.jsonl under the product root, one record per line, appended as the engine writes and synced when the run ends. A file whose last run record is not final is an unfinished run: runs list shows it as unfinished, and runs sync leaves it.

The tables are listed in Outputs & Reports. They hold the same fields as the records, and kis test runs sync reads a run back from them as records, in the order the engine wrote them.

The file records its schema version in schema_meta. A file written by an earlier test.svc is migrated when it is opened: its tables gain the new columns, and its runs still list and compare. Migrating a file from before schema 6 copies each table once, so the first open after an upgrade takes a few seconds on a large file. A file written by a newer test.svc is opened read-only, with a warning.

As a run starts, the file drops the runs beyond the newest ones, so it keeps a bounded number: ten by default. --keep-runs N on run, load, load merge, eval run and eval send sets the number, KIS_TEST_KEEP_RUNS sets the default, and 0 keeps every run. kis test runs prune --keep N drops the older runs without starting one. The space of the runs dropped is reused by the next ones, so the file stops growing; the file’s size on disk does not shrink.

The JSONL folder and the --artifacts folders keep every run. Send the runs you want to keep to the Studio, which holds the long history.

A results file is opened with DuckDB’s memory bounded to 512 MB, so a large file does not raise the memory test.svc needs. KIS_TEST_DB_MEMORY sets another bound, in DuckDB’s notation (1GB, 300MB).

.kisai/studio.yaml in the product root names the Studio and the product, and is committed:

url: https://sar.studio.kisai.dev/studio
product: SAR

Both fields are required, and an unknown field is an error.

The key is an app connection you make in the Studio (Account, AI tools and connections, or the Automated runs screen’s Send runs from test.svc panel) with the tests.report scope, or tests.write. The runs it sends are yours.

--store studio and kis test runs sync look for it in order:

  1. --studio-key <key>, given with the command;
  2. KIS_STUDIO_KEY in the environment, which keeps it out of shell history and suits CI and deploy flows;
  3. ~/.kisai/studio.yaml, kept by kis test login.
Terminal window
kis test run -t tests/ --store duckdb,studio --studio-key "$KEY"
KIS_STUDIO_KEY="$KEY" kis test runs sync

kis test login keeps a key on your machine, so it is not given each time:

Terminal window
kis test login # the Studio .kisai/studio.yaml names; asks for the key
echo "$KEY" | kis test login --key-stdin
kis test login https://sar.studio.kisai.dev/studio --product SAR
kis test logout

It checks the key with the Studio and keeps it only when the Studio takes it. The file is readable by you alone (mode 0600) and holds keys by Studio address:

# Keys for Studios, by address. Written by kis test login.
studios:
https://sar.studio.kisai.dev/studio:
key: kisak_...

The key is never written to a store, a log or a report; a message shows its first 10 characters at most.

Terminal window
kis test run -t tests/ --store duckdb,studio --studio-key "$KEY"

The run is sent as it goes, in batches of up to 200 records every 2 seconds, on a goroutine of its own, so the tests never wait on the network. A body or output over 64 KB, and every kept file, is uploaded first and the record carries a reference to it with its size, SHA-256 and first 4 KB.

When .kisai/studio.yaml or the key is missing, the run does not start, and the exit code is 2.

Only runs of committed code at a branch or tag are sent. A run with uncommitted changes, or on a detached checkout with no branch or tag, is kept by the other stores and the Studio store says why it was not sent:

not sent to the Studio: the tests ran on uncommitted changes
not sent to the Studio: no branch or tag (set KIS_TEST_REF)

When the Studio does not answer (after waiting 1, 2, 4, 8 and 16 seconds), the records it was not sent are kept in the run’s JSONL file, and kis test runs sync sends them later. At the end of a run the Studio store waits up to 30 seconds for what is left.

What became of each run is kept in the delivery ledger, .kis/test/deliveries.jsonl, and in the DuckDB file’s studio_deliveries table: complete, partial or refused, with the reason.

Sends kept runs to the Studio.

Terminal window
kis test runs sync --studio-key "$KEY" # every run in the DuckDB file and the JSONL folder
kis test runs sync --db results.db # one DuckDB file
kis test runs sync --from run.jsonl # one JSONL file, such as a CI artifact
kis test runs sync --from results/ # every .jsonl in a folder
kis test runs sync --run 6f1c2a # one run
kis test runs sync --dry-run # what would be sent

Runs are read oldest first. A run is skipped when it has not finished, when it is local only (uncommitted changes, or no branch or tag), or when the ledger says the Studio has it whole. For each other run, sync asks the Studio what it has: a run it has whole is noted in the ledger, and any other run is sent whole. The Studio keeps each record once, so a run sent again is not doubled.

sent 6f1c2a9b0d3e 214 records
skipped 0a9e4c2f71b8 already in the Studio
sent 1, skipped 1, failed 0

The exit code is 0 when every run was sent or skipped, and 1 when any failed. --artifacts names the folder the runs kept their files under, so the files are sent too.

The Studio saystest.svc
the key is unknown, expired or revoked (401)stops, and says to check the key given, or run kis test login
the key lacks the tests.report scope (403)stops, and says so
the product is unknown, or out of the key’s reach (404)stops, and says so
the run is of uncommitted code, or names no branch, tag or commit (409)does not send it again
another send of the run is in flight (409)waits 1 second and tries again, up to 5 times
more than 1000 records, or a body over 4 MBsends smaller batches
the records’ schema is one it does not keep, or a record is malformed (400)stops sending the run, and prints the Studio’s message
too many requests (429), a server error (5xx), or no answerwaits 1, 2, 4, 8 and 16 seconds, then leaves the rest to kis test runs sync

runs list lists the runs in the DuckDB file and the JSONL folder together, newest first, with a STUDIO column from the ledger: complete, partial, refused (<reason>), not sent, or local only for a run that is never sent.