CControxity Docs
GuidesReferenceHTTP APIOpen Controxity
How it works

Expectations

Say what must always be true. When it doesn't hold, it's a problem with a test target, even though nothing crashed.

Most wrong results never throw. A total comes out negative, an order ships with no items, a discount is bigger than the price, and the app carries on. An expectation says what must always be true, so Controxity sees it when it isn't.

controxity.expect("total-not-negative", total >= 0, { input: { cart } });

When the condition holds, the app carries on and it's counted. When it doesn't:

Every expectation also shows on the product's page, under Expectations, broken or not: how often it held and broke these 7 days on production and on staging, a bar for each day's breaks, when it was last checked, and a link to its problem if it broke. One not checked for two days or more is marked still in the code?: it may be dead code, or its name may be misspelt.

It returns the condition, so it can guard too:

if (!controxity.expect("has-items", cart.items?.length > 0, { input: { cart } })) return emptyCart();

Names#

A name is a short code: letters, digits, and - _ . : /. Each name is its own problem, wherever it's checked. Name what must be true, not what went wrong: total-not-negative, paid-orders-have-a-receipt, stock.never-below-zero.

Good ones to write#

Your coding agent is good at writing these: ask it for the expectations a function should keep, then let Controxity watch them in production.

What's sent#

When it breaks: the name, where it was checked (file, line, function), the count, and the shape of input. With each send, about once a minute: each name with how many times it held and broke. Never the values involved. Counting needs Node SDK 0.14.0 or Python SDK 0.11.0; older ones send only the breaks. See What never leaves your server.

Controxity 1.132.0These pages are in the repository: docs/site