Skip to content

The check

What `cases check` compares, where the code side comes from, and what it reports.

Applies to EngineCloud
View as Markdown
On this page
  1. What it compares
  2. What it reports
  3. Every finding
Terminal
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 production

What it compares

  1. The map against its schema. Every file is valid, every id is unique, every actor, area, case, place and event a file names exists.
  2. 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.
  3. The map against the code. The code side comes from one of two places:
    • Sypnorm (best): npx @sypnia/cases map --json lists every useCase with 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, so product in a case file is the table products in 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 is unmapped. Sent alone to the server’s check (caseIds), the map is checked by itself, and an id it does not have is reported as unmapped.
  4. The plan. cases/plan.md lists the milestones and their cases (The contract). An approved case of a delivered milestone with no code is unbuilt; a case whose status is idea or retired is skipped.
  5. Production, with the map linked to Telemetry: app.telemetry in map.yaml, or telemetry in the [cases] table of sypnia.toml, names the Telemetry project, and SYPNIA_TELEMETRY_TOKEN holds a read token of it (SYPNIA_TELEMETRY_API for an engine other than Sypnia Cloud’s). The check reads the last 30 days of environment=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-telemetry skips it.
  6. The contract (--contract): promises and milestones, as in The contract.

What it reports

Text
✗ 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

FindingLevelWhat it means
invaliderrora file does not match the format; the message says the file and the field
unmappederrorcode, a Case: trailer, a // case: note or production names a use case no case describes (Scope errors)
unbuilterroran approved case in a delivered milestone of cases/plan.md has no code (a use case, a trailer or a note)
drifterrorcode and case disagree on data, outcomes, failures or allowed actors
broken-promiseerrorthe landing promises something with no cases, or a milestone of the plan names no case (--contract)
orphanerrora case has no starts: nothing can run it
unknown-placeerrora case’s where is not in the navigation map
where-not-in-apperrora case with where does not start in_app
place-actorerrorthe case’s actor does not come in through the root of its place
nav-cycleerrorfollowing parents in the navigation map never reaches a root
unknown-eventerrora case listens to an outcome no case declares
internal-outcomeerrora case listens to another area’s outcome that the area did not make public
self-subscriptionerrora case listens to its own outcome
looperrora cycle of events with no bounded loop (Loops)
breaking-changeerroran outcome’s payload changed in a way that breaks its listeners, under the same version
old-versionwarning, then errora 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-outcomeerrorthe code, or production, ends in an outcome or failure the case does not declare (a gap in the map)
missing-outcomewarninga declared outcome the code never ends in
ai-task-unlistederrorthe case calls a Sypnia AI task it does not list in ai.tasks
ai-task-unusedwarningthe case lists an AI task it never calls
files-unlisted, files-unusederror, warningthe case writes or reads a Files bucket it does not list, or lists one it never uses
mail-unlisted, mail-unusederror, warningthe case sends a Mail template it does not list, or lists one it never sends
no-placewarninga case that starts in_app has no where, in an app with a navigation map
unused-outcomeinfoan outcome of an external or scheduled case nothing listens to, and nobody waits for
nav-missing-edgewarningpeople 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-unreachedwarningnobody reached a place of the map in 30 days
nav-unknown-routewarningpeople visited a route that no place marks
case-unusedwarninga 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.

  1. What it compares
  2. What it reports
  3. Every finding

    Search pages, sections and terms