cassis-cli 4.0.1__tar.gz → 4.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/PKG-INFO +4 -4
  2. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/README.md +3 -3
  3. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/eval.py +11 -10
  4. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/guide.py +1 -1
  5. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/issues.py +6 -5
  6. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/ontology.py +9 -10
  7. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/ontology_design_guide.md +94 -21
  8. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/pyproject.toml +1 -1
  9. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/LICENSE +0 -0
  10. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/NOTICE +0 -0
  11. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/__init__.py +0 -0
  12. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/api.py +0 -0
  13. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/auth.py +0 -0
  14. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/chats.py +0 -0
  15. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/common.py +0 -0
  16. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/credentials.py +0 -0
  17. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/dbt.py +0 -0
  18. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/main.py +0 -0
  19. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/projects.py +0 -0
  20. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/schema.py +0 -0
  21. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/schema_plan.py +0 -0
  22. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/status.py +0 -0
  23. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/tables.py +0 -0
  24. {cassis_cli-4.0.1 → cassis_cli-4.0.2}/cassis_cli/verify.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cassis-cli
3
- Version: 4.0.1
3
+ Version: 4.0.2
4
4
  Summary: Validate, test and evaluate your Cassis context from your terminal, then publish it
5
5
  License: Apache-2.0
6
6
  License-File: LICENSE
@@ -36,7 +36,7 @@ Validate, test and evaluate your context from your terminal, then publish it. Th
36
36
  - The CLI identifies itself to the API (`User-Agent: cassis-cli/<version>`), and successful API responses advertise the newest published version. When you are behind, commands print a one-line upgrade notice on stderr (purely informational; output and exit codes are unchanged).
37
37
  - `cassis eval run` runs the project's eval suite against your local context files (scored in-memory, nothing is pushed to Cassis) and prints per-question results, so you can test the changes on your git branch before merging.
38
38
  - `cassis context test` runs individual questions through the text-to-SQL agent using your local context files, so you can check that a change actually works (e.g. a new column gets picked), where `eval run` only checks for regressions on existing eval cases.
39
- - `cassis eval cases add` adds a gold question/SQL case to the project's eval suite: after fixing a context issue, add the question users were failing on so `eval run` guards it from regressing. Cassis then runs the new case three times in the background, and `eval cases list` flags it if the attempts fail or disagree. When the fix is still in a pull request, pass `--pending-change`: the check waits for the next publication instead of failing on a context that lacks the change. `cassis context test -q "..." --save-case` does the same from a probe that succeeded on your checkout.
39
+ - `cassis eval cases add` adds a gold question/SQL case to the project's eval suite, for an answer the project relies on: `eval run` then tells you when a change breaks it. Not every fix needs one. Cassis then runs the new case three times in the background, and `eval cases list` flags it if the attempts fail or disagree. When the fix is still in a pull request, pass `--pending-change`: the check waits for the next publication instead of failing on a context that lacks the change. `cassis context test -q "..." --save-case` does the same from a probe that succeeded on your checkout.
40
40
  - `cassis eval run --repeat N` runs every case N times (2 to 5) on the same context and model and compares the attempts per case: which cases flipped, and whether a flip came from the agent writing different SQL or the judge ruling differently on the same SQL. `cassis eval runs show <run-id>` prints that comparison again. A repeat run measures noise: it opens no issue, is not the run shown before publishing, and exits 1 only when a case failed every attempt.
41
41
  - Runs freeze their SQL dialect and query guidance. Runs with different source settings are kept separate when measuring noise; historical runs without those settings remain explicitly unknown.
42
42
  - `cassis eval cases list`, `cassis eval cases show` and `cassis eval cases delete` maintain the suite. `cases list` prints one line per case, the cases asking for attention first: its id, its health over the latest results (noisy, failing, passing, or changed across configurations) with how many passed, and its question, then what to do about a case that needs it, whether it waits for the change it guards, an unstable check after creation, and gold SQL references the context lacks. `cases show <id>` prints one case in full: question, gold SQL, expected answer, comparison rules, linked issues, and how it has behaved across runs (pass rate, whether repeated runs under one configuration disagree, divergences and timings, a repeat run counted as one run with its attempts, each result's error and the comparison rule that decided it). `cases delete` prunes one that is stale or wrong (e.g. its gold SQL encodes a definition the context has since changed).
@@ -47,7 +47,7 @@ Validate, test and evaluate your context from your terminal, then publish it. Th
47
47
  - DDL imports describe one schema snapshot/export file, including ordinary and materialized views; they do not replay incremental migrations. Extraction diagnostics include object names and statement locations. If extraction is incomplete, `schema plan` and `--dry-run` show the extracted inventory and exit 1; `apply`, `push`, and `--write-checkout` cannot save that result. Unknown column types are warnings when all output names are known. Plans also show object-kind, view-definition, comment, and constraint changes. `--json` preserves structured diagnostics and the server-capped inventory.
48
48
 
49
49
  - `cassis status` shows the project's published version (number, label, git commit), whether unpublished changes await publication, the git-sync binding, a schema plan waiting to be applied, and how your local git HEAD relates to the published commit (in sync / N commits ahead / diverged). `cassis status --watch` polls until the published commit matches your local HEAD (e.g. right after merging a PR whose CI publishes the context) instead of watching the GitHub Actions tab.
50
- - `cassis issues` triages the issues Cassis raised on the project (what it found wrong while answering questions: a context gap, missing data) without leaving the checkout: `issues list` (filterable by status, impact, cause and context domain, and showing each issue's domain so you can work through one domain at a time; and each issue's reach, the chat answers that used its context tables in the last 30 days), `issues show <id>` for the diagnosis, suggested action, the fix proposal and its changes, the questions to guard with an eval case (with candidate SQL), its five newest occurrences (`--occurrences N` for more), its reach and evidence (removed from dbt, an AI review suggestion, user feedback, a failed eval, or the chat analysis) and the next step, `issues evidence <id> <occurrence-id>` for what the agent actually saw, and `issues resolve` / `dismiss` / `reopen` once you've acted on it (answering no at the `resolve` prompt says what to do instead). Resolving by hand starts the checks of the eval cases waiting for the issue. When the fix ships through a pull request, write the `Resolves <id>` line that `issues show` prints under `Next step` in the PR description instead: Cassis resolves the issue when the PR merges, and `issues show` then reports how it was closed and through which PR. Tables users asked for are not issues: see `cassis tables`.
50
+ - `cassis issues` triages the issues Cassis raised on the project (what it found wrong while answering questions: a context gap, missing data) without leaving the checkout: `issues list` (filterable by status, impact, cause and context domain, and showing each issue's domain so you can work through one domain at a time; and each issue's reach, the chat answers that used its context tables in the last 30 days), `issues show <id>` for the diagnosis, suggested action, the fix proposal and its changes, the questions users were failing on, candidates for an eval case (with candidate SQL), its five newest occurrences (`--occurrences N` for more), its reach and evidence (removed from dbt, an AI review suggestion, user feedback, a failed eval, or the chat analysis) and the next step, `issues evidence <id> <occurrence-id>` for what the agent actually saw, and `issues resolve` / `dismiss` / `reopen` once you've acted on it (answering no at the `resolve` prompt says what to do instead). Resolving by hand starts the checks of the eval cases waiting for the issue. When the fix ships through a pull request, write the `Resolves <id>` line that `issues show` prints under `Next step` in the PR description instead: Cassis resolves the issue when the PR merges, and `issues show` then reports how it was closed and through which PR. Tables users asked for are not issues: see `cassis tables`.
51
51
  - `cassis tables list` lists the warehouse tables users asked for that the context does not describe: one line per table, the most asked first, with a suggested domain (`--layer`, `--domain`, `--search`, `--offset` and `--limit` narrow and page it). `cassis tables dismiss <TABLE>...` records the tables the team will not add (`--undo` takes them back); a table you add leaves the list on its own once published.
52
52
  - `cassis dbt push` sends your dbt project's artifacts (`target/manifest.json`, and `catalog.json` when present) to Cassis from the dbt project's CI, with the commit they were built from. Cassis checks the files, matches each dbt model, seed, snapshot and source to a table of the project's data source, and keeps the upload as the project's dbt baseline unless a newer one is already there. The command prints how many relations matched and how many tests they declare. Cassis compares the upload with the previous baseline and saves findings about the context the merged change puts in doubt for grouping and issue curation. The command distinguishes findings awaiting curation from published issues, printing the source observation for pending findings and links for published issues. Nothing the agent answers with changes.
53
53
  - `cassis dbt check` runs the same comparison on a pull request, before the change merges: it uploads the PR's artifacts (after `dbt compile` on the production target), compares them with the baseline, and prints the context tables, columns, joins and metrics the change puts in doubt, with why it matters and the context change to make. Each finding also says its **reach**, how many chat answers used its context tables in the last 30 days, and within each section the most-reached objects print first, the order the Review page will show them in. Findings are advisory: nothing is filed, the baseline doesn't move, and the check exits 0 with or without findings.
@@ -210,7 +210,7 @@ carrying the same sensitivity as the queries themselves when you decide who can
210
210
  # (one full agent run per question, expect ~30-90s each; repeat -q for several):
211
211
  cassis context test --project ... -q "How much was refunded last month?" -q "Net revenue in Q1?"
212
212
 
213
- # Happy with a probe's SQL? Keep it as an eval case in the same command
213
+ # An answer the project relies on? Keep the probe as an eval case in the same command
214
214
  # (question + the SQL it produced; a probe that failed or asked is skipped):
215
215
  cassis context test --project ... -q "Net revenue in Q1?" --save-case
216
216
 
@@ -11,7 +11,7 @@ Validate, test and evaluate your context from your terminal, then publish it. Th
11
11
  - The CLI identifies itself to the API (`User-Agent: cassis-cli/<version>`), and successful API responses advertise the newest published version. When you are behind, commands print a one-line upgrade notice on stderr (purely informational; output and exit codes are unchanged).
12
12
  - `cassis eval run` runs the project's eval suite against your local context files (scored in-memory, nothing is pushed to Cassis) and prints per-question results, so you can test the changes on your git branch before merging.
13
13
  - `cassis context test` runs individual questions through the text-to-SQL agent using your local context files, so you can check that a change actually works (e.g. a new column gets picked), where `eval run` only checks for regressions on existing eval cases.
14
- - `cassis eval cases add` adds a gold question/SQL case to the project's eval suite: after fixing a context issue, add the question users were failing on so `eval run` guards it from regressing. Cassis then runs the new case three times in the background, and `eval cases list` flags it if the attempts fail or disagree. When the fix is still in a pull request, pass `--pending-change`: the check waits for the next publication instead of failing on a context that lacks the change. `cassis context test -q "..." --save-case` does the same from a probe that succeeded on your checkout.
14
+ - `cassis eval cases add` adds a gold question/SQL case to the project's eval suite, for an answer the project relies on: `eval run` then tells you when a change breaks it. Not every fix needs one. Cassis then runs the new case three times in the background, and `eval cases list` flags it if the attempts fail or disagree. When the fix is still in a pull request, pass `--pending-change`: the check waits for the next publication instead of failing on a context that lacks the change. `cassis context test -q "..." --save-case` does the same from a probe that succeeded on your checkout.
15
15
  - `cassis eval run --repeat N` runs every case N times (2 to 5) on the same context and model and compares the attempts per case: which cases flipped, and whether a flip came from the agent writing different SQL or the judge ruling differently on the same SQL. `cassis eval runs show <run-id>` prints that comparison again. A repeat run measures noise: it opens no issue, is not the run shown before publishing, and exits 1 only when a case failed every attempt.
16
16
  - Runs freeze their SQL dialect and query guidance. Runs with different source settings are kept separate when measuring noise; historical runs without those settings remain explicitly unknown.
17
17
  - `cassis eval cases list`, `cassis eval cases show` and `cassis eval cases delete` maintain the suite. `cases list` prints one line per case, the cases asking for attention first: its id, its health over the latest results (noisy, failing, passing, or changed across configurations) with how many passed, and its question, then what to do about a case that needs it, whether it waits for the change it guards, an unstable check after creation, and gold SQL references the context lacks. `cases show <id>` prints one case in full: question, gold SQL, expected answer, comparison rules, linked issues, and how it has behaved across runs (pass rate, whether repeated runs under one configuration disagree, divergences and timings, a repeat run counted as one run with its attempts, each result's error and the comparison rule that decided it). `cases delete` prunes one that is stale or wrong (e.g. its gold SQL encodes a definition the context has since changed).
@@ -22,7 +22,7 @@ Validate, test and evaluate your context from your terminal, then publish it. Th
22
22
  - DDL imports describe one schema snapshot/export file, including ordinary and materialized views; they do not replay incremental migrations. Extraction diagnostics include object names and statement locations. If extraction is incomplete, `schema plan` and `--dry-run` show the extracted inventory and exit 1; `apply`, `push`, and `--write-checkout` cannot save that result. Unknown column types are warnings when all output names are known. Plans also show object-kind, view-definition, comment, and constraint changes. `--json` preserves structured diagnostics and the server-capped inventory.
23
23
 
24
24
  - `cassis status` shows the project's published version (number, label, git commit), whether unpublished changes await publication, the git-sync binding, a schema plan waiting to be applied, and how your local git HEAD relates to the published commit (in sync / N commits ahead / diverged). `cassis status --watch` polls until the published commit matches your local HEAD (e.g. right after merging a PR whose CI publishes the context) instead of watching the GitHub Actions tab.
25
- - `cassis issues` triages the issues Cassis raised on the project (what it found wrong while answering questions: a context gap, missing data) without leaving the checkout: `issues list` (filterable by status, impact, cause and context domain, and showing each issue's domain so you can work through one domain at a time; and each issue's reach, the chat answers that used its context tables in the last 30 days), `issues show <id>` for the diagnosis, suggested action, the fix proposal and its changes, the questions to guard with an eval case (with candidate SQL), its five newest occurrences (`--occurrences N` for more), its reach and evidence (removed from dbt, an AI review suggestion, user feedback, a failed eval, or the chat analysis) and the next step, `issues evidence <id> <occurrence-id>` for what the agent actually saw, and `issues resolve` / `dismiss` / `reopen` once you've acted on it (answering no at the `resolve` prompt says what to do instead). Resolving by hand starts the checks of the eval cases waiting for the issue. When the fix ships through a pull request, write the `Resolves <id>` line that `issues show` prints under `Next step` in the PR description instead: Cassis resolves the issue when the PR merges, and `issues show` then reports how it was closed and through which PR. Tables users asked for are not issues: see `cassis tables`.
25
+ - `cassis issues` triages the issues Cassis raised on the project (what it found wrong while answering questions: a context gap, missing data) without leaving the checkout: `issues list` (filterable by status, impact, cause and context domain, and showing each issue's domain so you can work through one domain at a time; and each issue's reach, the chat answers that used its context tables in the last 30 days), `issues show <id>` for the diagnosis, suggested action, the fix proposal and its changes, the questions users were failing on, candidates for an eval case (with candidate SQL), its five newest occurrences (`--occurrences N` for more), its reach and evidence (removed from dbt, an AI review suggestion, user feedback, a failed eval, or the chat analysis) and the next step, `issues evidence <id> <occurrence-id>` for what the agent actually saw, and `issues resolve` / `dismiss` / `reopen` once you've acted on it (answering no at the `resolve` prompt says what to do instead). Resolving by hand starts the checks of the eval cases waiting for the issue. When the fix ships through a pull request, write the `Resolves <id>` line that `issues show` prints under `Next step` in the PR description instead: Cassis resolves the issue when the PR merges, and `issues show` then reports how it was closed and through which PR. Tables users asked for are not issues: see `cassis tables`.
26
26
  - `cassis tables list` lists the warehouse tables users asked for that the context does not describe: one line per table, the most asked first, with a suggested domain (`--layer`, `--domain`, `--search`, `--offset` and `--limit` narrow and page it). `cassis tables dismiss <TABLE>...` records the tables the team will not add (`--undo` takes them back); a table you add leaves the list on its own once published.
27
27
  - `cassis dbt push` sends your dbt project's artifacts (`target/manifest.json`, and `catalog.json` when present) to Cassis from the dbt project's CI, with the commit they were built from. Cassis checks the files, matches each dbt model, seed, snapshot and source to a table of the project's data source, and keeps the upload as the project's dbt baseline unless a newer one is already there. The command prints how many relations matched and how many tests they declare. Cassis compares the upload with the previous baseline and saves findings about the context the merged change puts in doubt for grouping and issue curation. The command distinguishes findings awaiting curation from published issues, printing the source observation for pending findings and links for published issues. Nothing the agent answers with changes.
28
28
  - `cassis dbt check` runs the same comparison on a pull request, before the change merges: it uploads the PR's artifacts (after `dbt compile` on the production target), compares them with the baseline, and prints the context tables, columns, joins and metrics the change puts in doubt, with why it matters and the context change to make. Each finding also says its **reach**, how many chat answers used its context tables in the last 30 days, and within each section the most-reached objects print first, the order the Review page will show them in. Findings are advisory: nothing is filed, the baseline doesn't move, and the check exits 0 with or without findings.
@@ -185,7 +185,7 @@ carrying the same sensitivity as the queries themselves when you decide who can
185
185
  # (one full agent run per question, expect ~30-90s each; repeat -q for several):
186
186
  cassis context test --project ... -q "How much was refunded last month?" -q "Net revenue in Q1?"
187
187
 
188
- # Happy with a probe's SQL? Keep it as an eval case in the same command
188
+ # An answer the project relies on? Keep the probe as an eval case in the same command
189
189
  # (question + the SQL it produced; a probe that failed or asked is skipped):
190
190
  cassis context test --project ... -q "Net revenue in Q1?" --save-case
191
191
 
@@ -772,10 +772,12 @@ def add_case(
772
772
  ) -> None:
773
773
  """Add a gold test case to the project's eval suite.
774
774
 
775
- Closes the loop after fixing a context issue: the question users were
776
- failing on becomes a gold case, so `cassis eval run` guards it from
777
- regressing. On an executable data source the gold SQL is run before the
778
- case is stored, so a case that cannot execute never enters the suite.
775
+ For an answer the project relies on: the question and its correct SQL
776
+ become a gold case, so `cassis eval run` tells you when a change breaks
777
+ it. A fix does not need a case; the context design guide
778
+ (`cassis/AGENTS.md`, "Eval cases") says what earns one. On an executable
779
+ data source the gold SQL is run before the case is stored, so a case
780
+ that cannot execute never enters the suite.
779
781
  The SQL comes from --gold-sql (inline) or --gold-sql-file (a file path;
780
782
  prefer it for multi-line SQL, which shell quoting mangles inline).
781
783
  --expect says what a correct response does: answer (the default, so
@@ -2445,11 +2447,10 @@ def _print_selection(selection: dict, *, verbose: bool = False) -> None:
2445
2447
 
2446
2448
  # How many uncovered tables the selection names before counting the rest.
2447
2449
  _UNCOVERED_SHOWN = 10
2448
- _KEEP_A_GUARD_HINT = (
2449
- "Keep a guard: add an eval case for the question before you open the pull request "
2450
- '(`cassis context test -q "..." --save-case`, or `cassis eval cases add --pending-change`). '
2451
- "It is part of the pull request, safe to save without asking: it stays pending, counting no verdict, "
2452
- "until the change is published."
2450
+ _UNCOVERED_HINT = (
2451
+ "No case reads this change, so the run says nothing about it: probe it with "
2452
+ '`cassis context test -q "..."`. A change does not need an eval case of its own; add one only for an '
2453
+ "answer the project relies on, when the maintainer agrees (`cassis eval cases add --pending-change`)."
2453
2454
  )
2454
2455
 
2455
2456
 
@@ -2472,7 +2473,7 @@ def _print_uncovered(selection: dict, *, selected: int) -> None:
2472
2473
  for domain in domains:
2473
2474
  typer.secho(f" New domain with no case: {domain}", fg=typer.colors.YELLOW)
2474
2475
  if tables or domains or (nothing_selected and not unchanged):
2475
- typer.echo(" " + _KEEP_A_GUARD_HINT)
2476
+ typer.echo(" " + _UNCOVERED_HINT)
2476
2477
 
2477
2478
 
2478
2479
  def _wait_for_run(
@@ -31,7 +31,7 @@ GUIDE_FILENAME = "AGENTS.md"
31
31
  # Monotonic version of the doctrine text below. Bump it whenever
32
32
  # ontology_design_guide.md changes (a backend test enforces the pairing) — it
33
33
  # is what lets an older writer recognize a newer guide and leave it alone.
34
- DOCTRINE_VERSION = 15
34
+ DOCTRINE_VERSION = 16
35
35
 
36
36
  # Must stay byte-identical to backend/app/services/ontology_guide.py::_BANNER —
37
37
  # the server-side git export writes the same file, and differing banners would
@@ -224,15 +224,16 @@ def show(
224
224
  help="How many of each issue's newest occurrences to print.",
225
225
  ),
226
226
  ) -> None:
227
- """Show issues: each one's diagnosis, fix proposal, the questions to guard, and its evidence.
227
+ """Show issues: each one's diagnosis, fix proposal, failing questions, and its evidence.
228
228
 
229
229
  `Next step` says how the issue closes: on a project synced with its git
230
230
  repository, a pull request whose description contains `Resolves <id>`,
231
231
  which Cassis resolves when it merges; on a project published by `cassis
232
232
  context upload`, `cassis issues resolve` once the fix is published. On an open
233
- issue, `Guard questions` are the failing questions to turn into eval cases
234
- before that pull request (`cassis context test -q ... --save-case --issue
235
- <id>`). Each occurrence's id feeds `cassis issues evidence`, which prints
233
+ issue, `Guard questions` are the questions users were failing on:
234
+ candidates for an eval case, not a list to add (`cassis context test -q
235
+ ... --save-case --issue <id>` keeps one). Each occurrence's id feeds
236
+ `cassis issues evidence`, which prints
236
237
  everything the agent saw. An issue prints its newest occurrences, five
237
238
  unless `--occurrences` asks for more; `occurrence_count` is how many it
238
239
  has. `--json` prints the same facts, an unset field left out. Several ids
@@ -348,7 +349,7 @@ def _print_fix_proposal(proposal: "Optional[dict[str, Any]]") -> None:
348
349
 
349
350
 
350
351
  def _print_guard(guard: "Optional[dict[str, Any]]") -> None:
351
- """The open issue's failing questions to guard with eval cases, and how."""
352
+ """The open issue's failing questions, candidates for eval cases, and how to add one."""
352
353
  if not guard or not guard.get("questions"):
353
354
  return
354
355
  typer.echo("")
@@ -129,10 +129,12 @@ def check(
129
129
 
130
130
  warnings = result.get("warnings") or []
131
131
  ref_warnings = [w for w in warnings if w.get("stage") == "references"]
132
- eval_warnings = [w for w in warnings if w.get("stage") == "evals"]
133
- # The evals stage carries two kinds: cases that do not resolve, and changes no case reads.
134
- coverage_warnings = [w for w in eval_warnings if str(w.get("message", "")).startswith("[eval_coverage]")]
135
- eval_warnings = [w for w in eval_warnings if w not in coverage_warnings]
132
+ # An older server also sends, in the evals stage, the changes no case
133
+ # reads (`[eval_coverage]`); they are not unresolved cases, so they are
134
+ # dropped here, neither printed nor counted.
135
+ eval_warnings = [
136
+ w for w in warnings if w.get("stage") == "evals" and not str(w.get("message", "")).startswith("[eval_coverage]")
137
+ ]
136
138
  # Everything else is the quality audit; bucketing by "not one of the
137
139
  # stages named here" keeps a warning stage this CLI predates visible
138
140
  # instead of silently dropped.
@@ -163,10 +165,6 @@ def check(
163
165
  if not json_output:
164
166
  # What this change does to the eval suite first, then the advisory
165
167
  # findings about the tree as a whole, then one line that sums it up.
166
- _print_warning_group(
167
- coverage_warnings,
168
- f"{len(coverage_warnings)} change(s) no eval case guards:",
169
- )
170
168
  _print_warning_group(
171
169
  eval_warnings,
172
170
  f"{len(eval_warnings)} eval case(s) whose gold SQL does not fully resolve against this context; "
@@ -182,7 +180,6 @@ def check(
182
180
  f"{len(audit_warnings)} context quality warning(s), advisory, never fail the check:",
183
181
  )
184
182
  counts = [
185
- (len(coverage_warnings), "unguarded change"),
186
183
  (len(eval_warnings), "unresolved eval case"),
187
184
  (len(ref_warnings), "schema reference warning"),
188
185
  (len(audit_warnings), "quality warning"),
@@ -647,7 +644,9 @@ def test(
647
644
  if not json_output:
648
645
  _print_test_outcome(q, outcome)
649
646
  if not save_case and _probe_succeeded(outcome):
650
- typer.echo(" Keep it as an eval case with --save-case, so `cassis eval run` guards it.")
647
+ typer.echo(
648
+ " --save-case keeps this probe as an eval case; add one only for an answer the project relies on."
649
+ )
651
650
  if outcome.get("status") != "completed":
652
651
  failed = True
653
652
  if save_case:
@@ -583,9 +583,11 @@ move. Same human opt-in, front-loaded:
583
583
  its owning layer immediately (§11). If filling shows the approved tree is wrong
584
584
  — a domain overloads, or wants to split — stop and return to 2 rather than keep
585
585
  filling into it.
586
- 4. **Guard.** Each new domain gets at least one eval case, added before you open
587
- the pull request: a question it answers, probed and kept as in §13. `cassis
588
- context check` names the new domains and changed tables no case reads yet.
586
+ 4. **Probe.** Ask the questions the new domain's users will ask (`cassis
587
+ context test -q "…"`, §13) and read the SQL. A new domain does not need an
588
+ eval case of its own: `cassis eval run --changed` names the new domains and
589
+ changed tables no case reads, so you know what a run did not test. An answer
590
+ the business will rely on is a candidate for a case (§14).
589
591
 
590
592
  ---
591
593
 
@@ -621,25 +623,28 @@ context. The MCP tools named below are for an agent that has no shell.
621
623
  cases the change affects, and names what no case covers. A case already
622
624
  failing on the base, or already noisy (its verdicts differ on identical
623
625
  inputs), is listed apart and is not a regression.
624
- - Keep a guard: add an eval case for the question before you open the pull
625
- request; Cassis checks it once the change is published. Every fix and every
626
- new coverage gets one. Saving it is part of preparing the pull request, not
627
- a change to production: until the change is published the case is pending,
628
- other runs list it but count no verdict on it, so save it without asking.
629
- `cassis context test -q "…" --save-case` keeps a successful probe as a case
630
- (probing again updates it while it is pending; a case already checked is
631
- kept as it is); `cassis eval cases add --pending-change` adds one by hand. A question the agent has to ask a clarification about is no guard:
632
- write it with the detail it lacks and probe it again.
626
+ - An eval case is not a step of every change. The probe shows the fix works
627
+ and `cassis eval run` checks the answers already protected; most changes
628
+ need nothing more. When the change restores or adds an answer that earns a
629
+ case (§14), propose it (the question, the expected SQL, who relies on the
630
+ answer) and add it when the maintainer agrees: `cassis eval cases add
631
+ --pending-change`, or `cassis context test -q "…" --save-case` to keep a
632
+ successful probe (probing again updates it while it is pending; a case
633
+ already checked is kept as it is). The case stays pending until the change
634
+ is published: other runs list it but count no verdict on it, then Cassis
635
+ checks it. A question the agent has to ask a clarification about is no
636
+ case: write it with the detail it lacks and probe it again.
633
637
 
634
638
  Merging the pull request syncs and publishes the context; nothing reaches
635
639
  production answers until then. `cassis status` says whether the published
636
640
  version contains your merge (`--watch` waits until it does).
637
641
 
638
642
  To find what to fix, `cassis issues list` ranks the open issues and `cassis
639
- issues show <id>...` gives each one's diagnosis, fix proposal and questions to
640
- guard; `cassis eval cases list` is the suite's triage view (each case's health,
641
- newest verdicts, why it failed, its open issues), and `cassis eval cases show
642
- <id>...` the detail of the few cases worth investigating.
643
+ issues show <id>...` gives each one's diagnosis, fix proposal and the questions
644
+ users were failing on; `cassis eval cases list` is the suite's triage view
645
+ (each case's health, newest verdicts, why it failed, its open issues), and
646
+ `cassis eval cases show <id>...` the detail of the few cases worth
647
+ investigating.
643
648
 
644
649
  When the change fixes Cassis issues, say so in the pull request instead of
645
650
  closing them by hand. Write one mention per issue in the PR description:
@@ -647,11 +652,11 @@ closing them by hand. Write one mention per issue in the PR description:
647
652
  `Fixes` are accepted too). `cassis issues show <id>` prints the line to copy
648
653
  under `Next step`. Cassis resolves each mentioned issue when the pull
649
654
  request merges and the context is published, and records the pull request on
650
- the issue, so the resolution carries the change that earned it. Guard each
651
- fixed issue with a case for the question users were failing on: `cassis issues
652
- show <id>` (or `get_issue` over MCP) names those questions, and passing the
653
- issue (`--issue <id>`, or `issue_id` over MCP) makes the case wait for that
654
- issue's resolution, the publication that carries the fix.
655
+ the issue, so the resolution carries the change that earned it. The questions
656
+ `cassis issues show <id>` (or `get_issue` over MCP) lists for an issue are
657
+ candidates for a case, not a list to add. When one earns a case (§14), passing
658
+ the issue (`--issue <id>`, or `issue_id` over MCP) makes the case wait for
659
+ that issue's resolution, the publication that carries the fix.
655
660
 
656
661
  Resolving by hand is for outcomes that never go through a pull request:
657
662
  `cassis issues resolve <id>`, or `update_issue_status` over MCP. It needs the
@@ -663,5 +668,73 @@ reads as a gap that was never fixed.
663
668
 
664
669
  ---
665
670
 
671
+ ## 14. Eval cases: what earns a place
672
+
673
+ An eval case is a question with the SQL a correct answer runs (the expected
674
+ SQL, `--gold-sql`), or a question a correct response declines (`--expect
675
+ cannot-answer`). The suite is a regression check: it tells whoever changes the
676
+ context that an answer someone relies on just broke. It does not measure how
677
+ often users get a right answer, and a pass says the answer matches the expected
678
+ SQL, not that the expected SQL is right.
679
+
680
+ Adding a case is a decision, not a step of every change. A fix does not need
681
+ one, nor does a new domain, and a longer suite is not a better one: each case
682
+ costs a run, a reading when it fails and an update when the business changes.
683
+ Propose a case when an answer earns it; the maintainer decides.
684
+
685
+ - **A case protects an answer someone would act on.** It comes from a wrong
686
+ answer a user got, a figure the team reports, or a rule that must not break
687
+ (never extract a contact list). Name that source when you propose the case: a
688
+ conversation, an issue, a dashboard or a report, a page of the context. If
689
+ nobody would do anything when it fails, it is not a case.
690
+ - **Two people who know the business would give the same answer from the
691
+ question as written.** Keep the user's words and language, and add what
692
+ decides the result: period, population, grain, ranking, the tie-break of a
693
+ top N. When the context leaves the choice open, that is a question for the
694
+ business and a gap to close in the context, not a case.
695
+ - **The question never states the rule it tests.** A case that protects the
696
+ definition of an active customer asks about "active customers"; it does not
697
+ spell out the 90 days.
698
+ - **A person vouches for the expected SQL.** SQL kept from your own probe shows
699
+ only that the agent agrees with itself. The best start is SQL the team
700
+ already runs, the query behind a dashboard or a report people read: ask the
701
+ maintainer for it, keep it as close as the context allows and say what you
702
+ changed. Show the expected SQL to the person who relies on the answer, or to
703
+ the maintainer, and say whether it was ever executed: on a data source
704
+ Cassis cannot query, nothing runs it for you. Add a case nobody has confirmed
705
+ only when the maintainer asks for it, and say so in the pull request.
706
+ - **The expected SQL returns what the question asks for and nothing else.**
707
+ What it returns is what an answer is compared with, and text values are
708
+ compared as written: return stored values, never a label of your own. Use
709
+ only tables, columns and values the context states.
710
+ - **Dates are computed from the current date in the SQL**, never written as
711
+ literals, unless the question names the date. A case must still be right next
712
+ month.
713
+ - **A question the agent must decline comes with its neighbour.** Take it from
714
+ a real conversation where declining was right, and pair it with the closest
715
+ question the context can answer, kept as an ordinary case: without the pair,
716
+ a context that refuses everything passes. A pass says the agent declined, not
717
+ that it gave the right reason, so read the reply once.
718
+ - **A question that needs a clarification is written with the user's reply.**
719
+ Fold in what the user actually answered, in their words. A reply nobody gave
720
+ is a business decision: ask for it, do not guess it.
721
+ - **Start small, and keep the suite alive.** Ten to twenty cases a person has
722
+ confirmed protect a project better than a hundred nobody reads, and one case
723
+ that exercises three rules is worth more than three cases with one each. A
724
+ case enters when an answer earns it, not with every fix, and cases leave
725
+ too: propose retiring a case that can no longer fail, that repeats another,
726
+ or whose answer nobody would defend. Deleting or replacing a case is the
727
+ maintainer's decision, and an expected SQL never changes to make a run pass.
728
+ - **A case added with a fix has to be able to fail.** Say whether it fails on
729
+ the published context. One that passes before and after the fix protects the
730
+ answer and proves nothing about the fix.
731
+ - **Read a failure before believing it.** The fault is in the context, the
732
+ case, the scoring or the agent, and only reading the result tells which. On a
733
+ data source Cassis cannot query, a model compares the two SQL statements and
734
+ can fail an answer a person would accept: run `cassis eval run --case <id>
735
+ --repeat 3` before concluding.
736
+
737
+ ---
738
+
666
739
  *This guide is the single canonical home for Cassis context modeling doctrine.
667
740
  When a new pattern generalizes beyond one project, it belongs here.*
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "cassis-cli"
3
- version = "4.0.1"
3
+ version = "4.0.2"
4
4
  description = "Validate, test and evaluate your Cassis context from your terminal, then publish it"
5
5
  readme = "README.md"
6
6
  license = { text = "Apache-2.0" }
File without changes
File without changes
File without changes
File without changes