@smartkomm/plexus-cli 0.1.248 → 0.1.250

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.
@@ -1 +1 @@
1
- 66ff544405370f050546c98a54e8a563e0b3535ff30892ee3d3c7fecd3e5dbe5
1
+ ac60d59a37c4310badf469ee31e3339fcfb225ae88ced55fac2eecbe7e5f2ba4
@@ -1523,7 +1523,7 @@ Update an effect (per-kind: when/role/policy/nameFrom (org)/bucket/identity/orgK
1523
1523
 
1524
1524
  ### `offer form env set`
1525
1525
 
1526
- Declare the environment keys the form reads ($env.<key>.<field>) and sample them per scenario
1526
+ Declare the environment keys the form reads ($env.<key>.<field>)
1527
1527
 
1528
1528
  - **Right:** offline — no deployment
1529
1529
  - **Effect:** offline — edits local files only
@@ -1533,7 +1533,6 @@ Declare the environment keys the form reads ($env.<key>.<field>) and sample them
1533
1533
  | `--dir <value>` (required) | Bundle directory |
1534
1534
  | `--form <value>` | Form slug (default: the sole form) |
1535
1535
  | `--keys <value>` (required) | Environment keys (stage,run,applicant,…); "" removes the declaration |
1536
- | `--sample <value>` | <scenarioId>=<JSON object> — merged into that scenario's environment sample (repeatable) |
1537
1536
 
1538
1537
  ### `offer form field add`
1539
1538
 
@@ -1827,14 +1826,13 @@ Add a test scenario (one-click test-mode prefill; the publish gate submits it)
1827
1826
  | `--dir <value>` (required) | Bundle directory |
1828
1827
  | `--form <value>` | Form slug (default: the sole form) |
1829
1828
  | `--id <value>` (required) | Scenario id (kebab-case, e.g. standard) |
1830
- | `--from <value>` | Derive from this scenario: copy its prefill + environment sample, --prefill overrides single keys |
1829
+ | `--from <value>` | Derive from this scenario: copy its prefill, --prefill overrides single keys |
1831
1830
  | `--label <value>` (required) | Scenario label (German) |
1832
1831
  | `--label-en <value>` | English label — required with --label |
1833
1832
  | `--description <value>` | Description (German) |
1834
1833
  | `--description-en <value>` | English description — required with --description |
1835
1834
  | `--prefill <value>` | Prefill key=value (repeatable), typed by the field: boolean true\|false, consent true, multi-enum a,b; addresses and repeated rows via --prefill-json |
1836
1835
  | `--prefill-json <value>` | Whole prefill as a JSON object (instead of --prefill) |
1837
- | `--env-json <value>` | Environment sample as JSON, e.g. {"stage":{"key":"…","name":"…","gradeLevel":1}} |
1838
1836
 
1839
1837
  ### `offer form scenario delete`
1840
1838
 
@@ -1868,7 +1866,6 @@ Edit a test scenario (--prefill merges, --prefill-json replaces, --unset removes
1868
1866
  | `--prefill <value>` | Prefill key=value (repeatable), typed by the field: boolean true\|false, consent true, multi-enum a,b; addresses and repeated rows via --prefill-json; merged into the stored prefill |
1869
1867
  | `--prefill-json <value>` | Replace the whole prefill with this JSON object |
1870
1868
  | `--unset <value>` | Remove these prefill keys (a,b) |
1871
- | `--env-json <value>` | Replace the environment sample (JSON object; "" removes it) |
1872
1869
 
1873
1870
  ### `offer form section add`
1874
1871
 
@@ -5,6 +5,13 @@ its expressions read where the form is filled in (`env`: `$env.stage.key`, …)
5
5
  without hand-editing the form JSON. `$env` is the ONE root for a fact about the
6
6
  application; the graph and the assignment rules read the same variables.
7
7
 
8
+ **A scenario fits every grade and school year.** It is a name and values, nothing
9
+ else: the test application supplies its own environment (grade, school year, offer,
10
+ applicant), exactly like a real application. Two or three scenarios per offer are
11
+ enough — „Regulär", „Mit Ermäßigung" — never one per grade. Validation submits every
12
+ scenario under every grade × school year of the offer and names the grade where one
13
+ fails.
14
+
8
15
  ## Prerequisites
9
16
  - An offer bundle on disk carrying the form (`offer export …` / `offer init …`).
10
17
  - Fully offline; every command runs the publish gate on the result and writes nothing
@@ -22,35 +29,33 @@ plexus-cli offer form scenario add --dir <bundle> --id standard --label "Standar
22
29
  plexus-cli offer form scenario add --dir <bundle> --id geschwister --label "Mit Geschwistern" --label-en "With siblings" \
23
30
  --prefill-json '{"kind.vorname":"Anna","geschwister":[{"name":"Ben"}]}'
24
31
 
25
- # A variant of an existing scenario: --from copies its prefill and environment sample,
26
- # --prefill overrides single keys (e.g. „Gemeinsames Sorgerecht“ + reduced-fee request).
27
- plexus-cli offer form scenario add --dir <bundle> --id joint-reduced-fee --from joint \
28
- --label "Gemeinsames Sorgerecht mit Gebührenreduzierung" --label-en "Joint custody with reduced fee" \
29
- --prefill elternteil_1.financialAid=true
32
+ # A variant of an existing scenario: --from copies its prefill, --prefill overrides
33
+ # single keys (e.g. the regular case + a reduced-fee request).
34
+ plexus-cli offer form scenario add --dir <bundle> --id mit-ermaessigung --from standard \
35
+ --label "Mit Ermäßigung" --label-en "Reduced fees" \
36
+ --prefill gebuehren.ermaessigung=true
30
37
 
31
38
  # Edit: --prefill MERGES, --prefill-json REPLACES, --unset removes keys.
32
39
  plexus-cli offer form scenario set --dir <bundle> --id standard --prefill kind.vorname=Lea --unset agb
33
40
  plexus-cli offer form scenario delete --dir <bundle> --id geschwister
34
41
 
35
- # Environment: declare the keys the form reads AND sample them for every scenario in ONE
36
- # step (the gate refuses a declared key a scenario does not sample, and a sample of an
37
- # undeclared key — so the two cannot be done one after the other).
38
- plexus-cli offer form env set --dir <bundle> --keys stage \
39
- --sample 'standard={"stage":{"key":"klasse-1","name":"Klasse 1","gradeLevel":1}}'
40
-
41
- # The applicant's language and the intake channel are ONE key, `applicant`:
42
- plexus-cli offer form env set --dir <bundle> --keys stage,applicant \
43
- --sample 'standard={"stage":{"key":"klasse-1","name":"Klasse 1","gradeLevel":1},"applicant":{"language":"de","channel":"self-service"}}'
42
+ # Environment: declare the keys the form reads. Scenarios sample nothing.
43
+ plexus-cli offer form env set --dir <bundle> --keys stage,run
44
44
 
45
- # Remove the declaration (the scenarios' samples of dropped keys go with it):
45
+ # Remove the declaration:
46
46
  plexus-cli offer form env set --dir <bundle> --keys ""
47
47
  ```
48
48
 
49
49
  Environment keys: `offer`, `unit`, `stage`, `run`, `applicant` — the one vocabulary,
50
50
  listed with labels in the IDE tab „Umgebungsvariablen".
51
- A sample carries every field of its key (`stage` = `key`, `name`, `gradeLevel`;
52
- `applicant` = `language`, `channel`), an empty one as `null`. `stage.key` is the
53
- BUNDLE key (`program.stages[].key`).
51
+ `stage.key` is the BUNDLE key (`program.stages[].key`).
52
+
53
+ **A value that depends on the grade or school year** is not a scenario's business:
54
+ give the field a `defaultValue` over `$env` (an enrolment date = `$env.run.startDate`)
55
+ and leave it out of every scenario — an entered value always wins over the default,
56
+ and each test application gets the value of its own cohort. A value for a question
57
+ that only one grade asks is harmless in the others: the question is hidden there and
58
+ the value is put aside at submit.
54
59
 
55
60
  **No fallback.** `$env.applicant.language` is EMPTY (`null`) for an application
56
61
  without an applicant account (started by staff); `$env.stage.gradeLevel` and
@@ -73,12 +78,22 @@ After publishing, run a scenario on a test application from the terminal:
73
78
 
74
79
  ## Idempotency / gotchas
75
80
  - A scenario that leaves a visible required field empty, or reaches no outcome, is
76
- refused (`scenario.required-field-unfilled` / `scenario.no-outcome`). docRef fields are
77
- never prefilled — test mode stubs files itself.
81
+ refused (`scenario.required-field-unfilled` / `scenario.no-outcome`) — the message ends
82
+ with the grades and school years where it fails („— in: Year 1 · School year 2026/27").
83
+ docRef fields are never prefilled — test mode stubs files itself.
84
+ - Offline, validation knows the grades and school years only from `bundle.yaml`
85
+ (`program.stages`, `program.runs`). A bundle without them, or a form that reads
86
+ `offer` / `unit`, gets the warning `scenario.unjudged`: publishing judges the
87
+ scenarios against the offer's real cohorts. An offer without any cohort gets
88
+ `scenario.no-environment` — publish again once one exists.
89
+ - A bundle whose scenarios still carry an environment sample (`testScenarios[].env`,
90
+ one scenario per grade) is refused until `plexus-cli offer upgrade --dir <bundle> --write`
91
+ removes the samples. The upgrade keeps every scenario; the ones that only differed by
92
+ grade are duplicates afterwards — delete them with `offer form scenario delete`.
78
93
  - A bundle exported before `$env` replaced `context` carries `context` (declaration and samples) and
79
94
  `$ctx.*` expressions: refused (`[env/retiredField]`, unknown identifier). Export
80
95
  again — the stored definitions on the server already use `$env`.
81
- - `--from` copies prefill and environment sample, not the base's description (it describes the base);
96
+ - `--from` copies the prefill, not the base's description (it describes the base);
82
97
  `--from` with `--prefill-json` is refused — that would discard the copy. The copy is a
83
98
  snapshot: a later change to the base does not reach the variant.
84
99
  - File fields need no prefill: with „Automatisch absenden“ (default on) loading a scenario