@smartkomm/plexus-cli 0.1.109 → 0.1.111

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
- a05705defb254d48160e1b2b50e7f8f892ce0e398459c706497ef23eb99ccd2b
1
+ 2eeecd70b97df9e7875a857a9360102e7881382fd4d7745efb5ce68f38ddc480
@@ -163,6 +163,7 @@ whole is the operator's (ask them; do not try).
163
163
  | [accounts/email-changes.md](references/accounts/email-changes.md) | Mandant + Plattform | See who changed an account's sign-in address (the tenant-wide view needs a platform admin for --user). |
164
164
  | [applications/inspect-process-store.md](references/applications/inspect-process-store.md) | Mandant | Show what an application's process produced and what it still waits for. |
165
165
  | [applications/start-a-test-application.md](references/applications/start-a-test-application.md) | Mandant | Start a test application in the terminal, drive it and discard it. |
166
+ | [applications/expire-test-applications.md](references/applications/expire-test-applications.md) | Mandant | Keep a test application as a demo, and list or discard the test applications without activity for 14 days. |
166
167
  | [applications/correct-staff-input.md](references/applications/correct-staff-input.md) | Mandant | Correct an internal input staff set at the start, while no step has read it. |
167
168
  | [audit/answer-access-request.md](references/audit/answer-access-request.md) | Plattform | Answer an Art. 15 request: who looked at this application? |
168
169
  | [config/add-legal-entity.md](references/config/add-legal-entity.md) | Mandant | Add a Träger with its address or a unit to an exported config offline, then apply it. |
@@ -225,6 +226,7 @@ whole is the operator's (ask them; do not try).
225
226
  | [offer/workflow-default-channels.md](references/offer/workflow-default-channels.md) | Mandant | Fixed team chat channels for every application of an offer. |
226
227
  | [persons/import-persons-from-csv.md](references/persons/import-persons-from-csv.md) | Mandant | Import pupils, their guardians and class enrollments from a person list (CSV + mapping file). |
227
228
  | [persons/purge-deleted-person.md](references/persons/purge-deleted-person.md) | Plattform | Delete a soft-deleted person for good. |
229
+ | [platform/clear-test-residue.md](references/platform/clear-test-residue.md) | Plattform | Find and delete what deleted test applications left in a real tenant, after review. |
228
230
  | [platform/rename-tenant.md](references/platform/rename-tenant.md) | Plattform | Change a tenant's slug and display name in place, then its accounts' addresses. |
229
231
  | [platform/inventory.md](references/platform/inventory.md) | Plattform | Count test data per real tenant and stored files (referenced, orphaned) — counts and ids only. |
230
232
  | [platform/sweep-storage-orphans.md](references/platform/sweep-storage-orphans.md) | Plattform | List the stored files no record names, then delete exactly the reviewed ones. |
@@ -0,0 +1,55 @@
1
+ # Expire old test applications („Demo behalten“)
2
+
3
+ **When to use:** test applications pile up in a school after an acceptance run or a
4
+ demo. A test application **expires** when all four hold: it is a test application, its
5
+ last activity is older than 14 days, it is not marked „Demo behalten“, and the school is
6
+ a real school (never the seed tenant `test`, never the platform). Age alone never
7
+ expires anything. A daily job reports the count per school; this recipe lists and
8
+ discards them by hand, and marks the ones to keep.
9
+
10
+ „Last activity“ is the application card's „Letzte Aktivität“: the newest step,
11
+ submission, completed task or signature, decision, and chat message every staff
12
+ member can read, never earlier than the start. Draft saves and team-only chat do not
13
+ count.
14
+
15
+ ## Prerequisites
16
+ - The permission to run test actions on the tenant (the one „Testbewerbung verwerfen“ needs).
17
+ - Writes name `--env`; prod writes also need `--allow-prod`.
18
+
19
+ ## Steps
20
+ ```bash
21
+ E="--env <env> --tenant <t>" # prod writes also need --allow-prod
22
+
23
+ # 1. Keep a demo: it never expires and no discard takes it.
24
+ plexus-cli $E applications set-keep-demo <application-id>
25
+ # …and to let it expire again:
26
+ plexus-cli $E applications set-keep-demo <application-id> --off
27
+
28
+ # 2. Dry run: every test application with its verdict.
29
+ plexus-cli $E applications discard-test --all-test --older-than 14d --dry-run
30
+ # id lastActivity verdict block result
31
+ # … 2026-10-01 expired would discard
32
+ # … 2026-10-02 expired invoice blocked
33
+ # … 2026-10-30 recent kept
34
+
35
+ # 3. Discard the expired ones (the server re-checks each one before it discards).
36
+ plexus-cli $E applications discard-test --all-test --older-than 14d --confirm
37
+ ```
38
+
39
+ ## Verify
40
+ Run the dry run again: no row is left with `would discard`. Blocked rows stay until their
41
+ reason is gone.
42
+
43
+ ## Idempotency / gotchas
44
+ - **`--older-than` is at least 14 days** — a shorter period is refused; one fresh test
45
+ application goes with `applications discard-test <id>`.
46
+ - **Blocked, never attempted:** `openProviderProcess` (cancel the signing process at the
47
+ provider first), `invoice` (an invoice was written on its contract), `settled` (the
48
+ process already ended), `discarding` / `discarded` (a discard runs or ran).
49
+ - **`activityUnknown`:** the activity could not be read completely; the application is
50
+ kept rather than discarded on a guess.
51
+ - A marked demo is refused by every discard, the single one too: clear the mark first.
52
+ - Re-running is safe: discarded applications are gone, the rest are re-checked.
53
+
54
+ ## Related
55
+ - [Start a test application and drive it end to end](./start-a-test-application.md)
@@ -1,12 +1,12 @@
1
1
  # plexus-cli command reference
2
2
 
3
3
  Generated from the commands the CLI registers — do not edit; `plexus-cli <command> --help` prints the same.
4
- 293 commands. Every network command also takes `--env <local|staging|prod>`, `--tenant <slug>`,
4
+ 296 commands. Every network command also takes `--env <local|staging|prod>`, `--tenant <slug>`,
5
5
  `--json` (raw JSON instead of a table) and `--allow-prod` (required for a writing run against production).
6
6
 
7
7
  - [Admission (offline)](#admission-offline) (1)
8
8
  - [Admission (platform operator)](#admission-platform-operator) (2)
9
- - [Admission (school token)](#admission-school-token) (12)
9
+ - [Admission (school token)](#admission-school-token) (13)
10
10
  - [Agents (offline)](#agents-offline) (2)
11
11
  - [Branding (school token)](#branding-school-token) (6)
12
12
  - [Config (offline)](#config-offline) (4)
@@ -31,7 +31,7 @@ Generated from the commands the CLI registers — do not edit; `plexus-cli <comm
31
31
  - [Organisation (school token)](#organisation-school-token) (8)
32
32
  - [Persons (platform operator)](#persons-platform-operator) (1)
33
33
  - [Persons (school token)](#persons-school-token) (2)
34
- - [Platform (platform operator)](#platform-platform-operator) (11)
34
+ - [Platform (platform operator)](#platform-platform-operator) (13)
35
35
  - [Setup (platform operator)](#setup-platform-operator) (5)
36
36
  - [Signing (platform operator)](#signing-platform-operator) (5)
37
37
  - [Signing (school token)](#signing-school-token) (8)
@@ -102,13 +102,20 @@ Count an offer's applications per list
102
102
  |---|---|
103
103
  | `--offer <value>` (required) | Offer slug (its offerKey) |
104
104
 
105
- ### `applications discard-test <application>`
105
+ ### `applications discard-test [application]`
106
106
 
107
- Discard a TEST application (the server refuses a real one)
107
+ Discard a TEST application (the server refuses a real one), or with --all-test every expired one of the school
108
108
 
109
109
  - **Right:** school token — a module permission inside one school (the school's own administrator runs it)
110
110
  - **Effect:** write — needs `--env`; on production also `--allow-prod`
111
111
 
112
+ | Option | Description |
113
+ |---|---|
114
+ | `--all-test` | Every expired test application of the school instead of one id |
115
+ | `--older-than <value>` | With --all-test: days without activity, as <N>d (N ≥ 14) |
116
+ | `--dry-run` | With --all-test: list only (the default) |
117
+ | `--confirm` | With --all-test: discard (else the dry run) |
118
+
112
119
  ### `applications list`
113
120
 
114
121
  List an offer's applications (id, status, board state, applicant, test)
@@ -121,6 +128,17 @@ List an offer's applications (id, status, board state, applicant, test)
121
128
  | `--offer <value>` (required) | Offer slug (its offerKey) |
122
129
  | `--test-only` | Only test applications |
123
130
 
131
+ ### `applications set-keep-demo <application>`
132
+
133
+ Mark a TEST application „Demo behalten“ (never expires, never discarded), or clear the mark with --off
134
+
135
+ - **Right:** school token — a module permission inside one school (the school's own administrator runs it)
136
+ - **Effect:** write — needs `--env`; on production also `--allow-prod`
137
+
138
+ | Option | Description |
139
+ |---|---|
140
+ | `--off` | Clear the mark |
141
+
124
142
  ### `applications show <application>`
125
143
 
126
144
  One application: status, test flag, offer, current workflow nodes
@@ -3172,6 +3190,32 @@ Change a tenant's slug and name in place (plan unless --confirm)
3172
3190
  | `--name <value>` (required) | The new display name. |
3173
3191
  | `--confirm` | Write the change (without it, only the plan is printed). |
3174
3192
 
3193
+ ### `platform test-residue apply`
3194
+
3195
+ Delete the residue of deleted test applications that BOTH a fresh plan and --list name (dry run unless --confirm). What only one side names is reported and stays.
3196
+
3197
+ - **Right:** platform operator — needs a `_platform.*` right; a school's token is refused
3198
+ - **Effect:** plan by default — writes only with `--confirm` (and `--env`; on production also `--allow-prod`)
3199
+
3200
+ | Option | Description |
3201
+ |---|---|
3202
+ | `--list <value>` (required) | The plan file `platform test-residue plan --out` wrote, reviewed. |
3203
+ | `--protect <value>` (required) | JSON file with the application ids that must never be touched (the demo applications a school keeps); required, non-empty — a planned row naming one aborts the run. |
3204
+ | `--confirm` | Delete (without it, only the comparison is printed). |
3205
+
3206
+ ### `platform test-residue plan`
3207
+
3208
+ Read-only: the residue of deleted test applications in one tenant — ids and counts per table, never names.
3209
+
3210
+ - **Right:** platform operator — needs a `_platform.*` right; a school's token is refused
3211
+ - **Effect:** read — changes nothing on the deployment
3212
+
3213
+ | Option | Description |
3214
+ |---|---|
3215
+ | `--protect <value>` (required) | JSON file with the application ids that must never be touched (the demo applications a school keeps); required, non-empty — a planned row naming one aborts the run. |
3216
+ | `--out <value>` | Write the plan as JSON here (refused when it exists, unless --force) — the list `apply` takes. |
3217
+ | `--force` | Overwrite an existing --out file. |
3218
+
3175
3219
  ### `platform workers list`
3176
3220
 
3177
3221
  List live job workers (platform-admin)
@@ -0,0 +1,68 @@
1
+ # Clear the residue of deleted test applications
2
+
3
+ **When to use:** test applications in a real tenant were deleted, but what they
4
+ produced stayed — contracts (often signed), generation runs, signing requests,
5
+ the persons they created and the stored PDFs. This verb finds that residue by
6
+ one rule and deletes it after review. Never in the `test` tenant (the deploy
7
+ resets it) or `_platform`.
8
+
9
+ ## What counts (the plan's categories)
10
+
11
+ | | Deleted because | Never because |
12
+ |---|---|---|
13
+ | **L1** contracts, generation runs, signing requests | the application they name was deleted (a contract: every one of its runs names a deleted application) — with their snapshots, signatures, parties, lines, allocations, events and signing documents | a name, the tenant or an age; a row that never named an application stays (unclear) |
14
+ | **L2** persons | they are a party or signer of an L1 contract | — |
15
+ | **L3** persons | their first and last name occur at least twice in the tenant | the name alone: see the exclusion |
16
+ | **L4** files | only L1 rows name them — reported; the release follows the deleted rows, not the list | a file another row names too stays (`shared`) |
17
+
18
+ **Excluded** (L2 and L3): an import record, a user account, a lead, a live
19
+ application that wrote the person, a contract outside L1, a party shared by two
20
+ persons. **Unclear:** a person whose deletion would reach a row outside its own
21
+ data (another table still names it), or an L1 root another row holds — listed,
22
+ never deleted.
23
+
24
+ **Abort:** plan and apply stop before any write when a planned row names an id
25
+ from `--protect` (the demo applications a school keeps) or a live application.
26
+
27
+ ## Prerequisites
28
+ - A platform token with `_platform.config.manage` (`_platform.config.read` is enough for `plan`).
29
+ - `protect.json`: a JSON array of the application ids that must stay, non-empty.
30
+
31
+ ## Steps
32
+ ```bash
33
+ # 1. Plan — ids and counts only, no names; the file is the list apply takes
34
+ plexus-cli --env <env> --tenant <slug> platform test-residue plan --protect protect.json --out plan.json
35
+
36
+ # 2. Review plan.json; remove every id that must stay (persons under persons.l2 / persons.l3,
37
+ # contracts under l1.contracts). Removing is the only edit; `files` is a report, not a list.
38
+
39
+ # 3. Dry run — re-plans and prints, per category, what both sides name and what only one does
40
+ plexus-cli --env <env> --tenant <slug> platform test-residue apply --list plan.json --protect protect.json
41
+
42
+ # 4. Delete the intersection (--allow-prod only on prod)
43
+ plexus-cli --env <env> --tenant <slug> platform test-residue apply --list plan.json --protect protect.json --confirm --allow-prod
44
+ ```
45
+
46
+ ## Verify
47
+ ```bash
48
+ plexus-cli --env <env> --tenant <slug> platform test-residue plan --protect protect.json
49
+ # every L1 and L4 count is 0; L2/L3 hold only what step 2 removed from the list
50
+ ```
51
+
52
+ ## Idempotency / gotchas
53
+ - The apply never trusts the file: it computes the plan again and deletes only
54
+ what both name. An id only the file names (gone meanwhile, or now held) and an
55
+ id only the fresh plan names (new residue) are both reported under `diff` and
56
+ stay — plan again and review to take them.
57
+ - The unit of the list is the root: a contract in the list goes with its whole
58
+ closure (snapshots, signatures, …). Its files are not released by this verb:
59
+ each deleted row's holder trigger schedules the release, so a file
60
+ goes once its last holder is gone — removing it from `files` keeps nothing.
61
+ - A person is asked again right before its delete; one that is excluded by then
62
+ is reported under `skippedPersons`.
63
+ - A file another row still names (a retained setup export's pin included) is
64
+ kept by the release (`held`); the plan counts it under `sharedFiles`.
65
+ - Running it twice is harmless: the second plan is empty.
66
+
67
+ ## Related
68
+ - [Rename a tenant](./rename-tenant.md)