The check
What `cases check` compares, where the code side comes from, and what it reports.
On this page
npx @sypnia/cases check # the map is valid, and the code matches it
npx @sypnia/cases check --contract # also the landing and the plan
npx @sypnia/cases check --json # for machines
npx @sypnia/cases check --no-telemetry # without productionWhat it compares
- The map against its schema. Every file is valid, every id is unique, every actor, area, case, place and event a file names exists.
- The map against itself. Every case has a start and at least one outcome; the navigation tree has one parent per place and no cycles; the event graph has no loop without a stop, no case listening to itself, and no area listening to another area’s internal outcome.
- The map against the code. The code side comes from one of two places:
- Sypnorm (best):
npx @sypnia/cases map --jsonlists everyuseCasewith its actor, input, the tables it touches, the outcomes and failures it can end in, and who is allowed. The check matches them to cases by id. Table names compare by singular and plural, soproductin a case file is the tableproductsin the code. A use case whose code names no table (a fresh skeleton) is not compared on data. - Code without Sypnorm (any language): a commit among the last 2000 carries a trailer
Case: place-order, or a source file carries a note// case: place-order(also after#,/*or<!--). The check learns which cases have code; it cannot compare data or outcomes. An id no case has isunmapped. Sent alone to the server’s check (caseIds), the map is checked by itself, and an id it does not have is reported asunmapped.
- Sypnorm (best):
- The plan.
cases/plan.mdlists the milestones and their cases (The contract). An approved case of a delivered milestone with no code isunbuilt; a case whosestatusisideaorretiredis skipped. - Production, with the map linked to Telemetry:
app.telemetryinmap.yaml, ortelemetryin the[cases]table ofsypnia.toml, names the Telemetry project, andSYPNIA_TELEMETRY_TOKENholds a read token of it (SYPNIA_TELEMETRY_APIfor an engine other than Sypnia Cloud’s). The check reads the last 30 days ofenvironment=production: real moves against the navigation tree, the cases that ran, and the outcomes seen against the outcomes declared. Endings the runtime records itself (error,WindowExpired,LoopStopped) are never a gap. Without a token the check says so, as information, and goes on;--no-telemetryskips it. - The contract (
--contract): promises and milestones, as in The contract.
What it reports
✗ unmapped GiftCardRedeem src/cases/gift-cards.ts:12 no case describes this use case
✗ drift place-order writes customer_points the case does not list it
✗ orphan resume-deliveries cases/deliveries/resume-deliveries.case.yaml no starts: nothing can run it
✓ 18 cases match the code
1 waiver applies (rebuild-search-index, until 2027-03-01)Every finding
| Finding | Level | What it means |
|---|---|---|
invalid | error | a file does not match the format; the message says the file and the field |
unmapped | error | code, a Case: trailer, a // case: note or production names a use case no case describes (Scope errors) |
unbuilt | error | an approved case in a delivered milestone of cases/plan.md has no code (a use case, a trailer or a note) |
drift | error | code and case disagree on data, outcomes, failures or allowed actors |
broken-promise | error | the landing promises something with no cases, or a milestone of the plan names no case (--contract) |
orphan | error | a case has no starts: nothing can run it |
unknown-place | error | a case’s where is not in the navigation map |
where-not-in-app | error | a case with where does not start in_app |
place-actor | error | the case’s actor does not come in through the root of its place |
nav-cycle | error | following parents in the navigation map never reaches a root |
unknown-event | error | a case listens to an outcome no case declares |
internal-outcome | error | a case listens to another area’s outcome that the area did not make public |
self-subscription | error | a case listens to its own outcome |
loop | error | a cycle of events with no bounded loop (Loops) |
breaking-change | error | an outcome’s payload changed in a way that breaks its listeners, under the same version |
old-version | warning, then error | a case listens to an old version of an event: a warning with the days left while both versions are emitted, an error once the 90 days are over and the old version is no longer emitted (Versions) |
undeclared-outcome | error | the code, or production, ends in an outcome or failure the case does not declare (a gap in the map) |
missing-outcome | warning | a declared outcome the code never ends in |
ai-task-unlisted | error | the case calls a Sypnia AI task it does not list in ai.tasks |
ai-task-unused | warning | the case lists an AI task it never calls |
files-unlisted, files-unused | error, warning | the case writes or reads a Files bucket it does not list, or lists one it never uses |
mail-unlisted, mail-unused | error, warning | the case sends a Mail template it does not list, or lists one it never sends |
no-place | warning | a case that starts in_app has no where, in an app with a navigation map |
unused-outcome | info | an outcome of an external or scheduled case nothing listens to, and nobody waits for |
nav-missing-edge | warning | people moved between two places with no way between them on the map. A move is along the tree when it goes to a child, back up the chain, to a sibling (another tab of the same screen), to a root, or along a shortcut (The navigation map) |
nav-unreached | warning | nobody reached a place of the map in 30 days |
nav-unknown-route | warning | people visited a route that no place marks |
case-unused | warning | a case on the map that never ran in 30 days: not built, not reachable or not used |
ai-task-*, files-* and mail-* need the project linked to Sypnia AI, Files or Mail; nav-*, case-unused, and undeclared-outcome or unmapped from production need Telemetry.
Exit code 1 when there is any error, 0 otherwise. With --ci it writes annotations that GitHub, Sypnia Git and Sypnia Run show on the lines.