@cratis/pi 7.193.2 → 7.194.1

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.
@@ -87,13 +87,17 @@ anti-pattern fixes must not scatter a vertical slice across folders.
87
87
  Read the **cratis-arc-elixir** and **cratis-chronicle-client-elixir** skills before touching a slice.
88
88
 
89
89
  - **Folders are Module, Feature, Slice, and sub-features nest.** One folder per behavior, named for what
90
- it does as a gerund (`RotatingSecrets`); the command inside is the verb. Group slices that act on one
90
+ it does as a gerund, without repeating what its sub-feature already names (`Secrets.Rotating`, not
91
+ `Secrets.RotatingSecrets`; see [vertical-slices.md](./vertical-slices.instructions.md)); the command inside is the verb and keeps
92
+ its noun (`RotateSecret`). Group slices that act on one
91
93
  thing into a sub-feature (`Secrets`, `Credentials`, `Viewing`), and put a reactor with the facts it
92
94
  reacts to, not in a folder named for the third party it calls. No folders named for a kind of file.
93
95
  - **Names are ids.** `use Cratis.Arc.Command, id: "rotate-secret"`, an event type's `id:`, a reactor's
94
96
  `id:`; the model shows the id in PascalCase, so a module can be renamed without renaming the model.
95
97
  - **A command and its events live in one file**, events first. An event is past tense, one fact, and
96
- never carries a secret.
98
+ never carries a secret or anything derived from one (no hint, hash or last characters): the system that
99
+ owns a secret, such as an identity provider, is the only one that holds it, and a secret is shown once to
100
+ the person who asked for it.
97
101
  - **Every slice tells a whole story**: a state change has a command and the events it appends; a view
98
102
  has a read model and consumes events (`consumes:` when it reads the event log); an automation reacts to
99
103
  an event, runs a command and records the fact that command appends, so the event model shows what it
@@ -64,8 +64,8 @@ Folder names are `snake_case`. A spec's **module name mirrors its path** below t
64
64
  `PascalCase`, so it can never clash with the module it specifies and is never named `...Test`:
65
65
 
66
66
  ```elixir
67
- # lib/access/credentials/adding_credentials/for_add_credential/when_adding/with_selected_vessels.exs
68
- defmodule Prism.Access.Credentials.AddingCredentials.ForAddCredential.WhenAdding.WithSelectedVessels do
67
+ # lib/access/credentials/adding/for_add_credential/when_adding/with_selected_vessels.exs
68
+ defmodule Prism.Access.Credentials.Adding.ForAddCredential.WhenAdding.WithSelectedVessels do
69
69
  use ExUnit.Case, async: true
70
70
  ```
71
71
 
@@ -124,26 +124,50 @@ fine for a pure function; there is no scenario to set up.
124
124
  assert on internals, and do not spec logging or trivial delegation.
125
125
  - `doctest Module` belongs in its own spec (`when_building/with_the_documented_examples.exs`).
126
126
 
127
- ## Shared context: `given/`
127
+ ## Shared context: `given/` contexts
128
128
 
129
- Contexts that several specs share (a table of people, a started kernel) go in `for_<unit>/given/<name>.exs`
130
- as a module, and a spec loads it by relative path. The filter above keeps `given/` out of the specs ExUnit
131
- runs, so it is loaded once, by the spec that needs it:
129
+ Facts that several specs start from are a **given context**, named for the situation (`a_credential`,
130
+ `a_rotated_credential`), the counterpart of the `given` classes of the C# specs. A context is a module in a
131
+ script under a `given/` folder beside the specs that use it, with `given/1` that returns the next scenario
132
+ (`given/2` takes an argument, `{Context, argument}` passes it):
132
133
 
133
134
  ```elixir
134
- Code.require_file("../given/people.exs", __DIR__)
135
+ # lib/access/api/given/a_credential.exs
136
+ defmodule Prism.Access.Api.Given.ACredential do
137
+ use Cratis.Arc.Test.Given
135
138
 
136
- defmodule Prism.Access.Components.DataTable.ForDataTable.WhenFiltering.WithASingleFilter do
137
- use ExUnit.Case, async: true
139
+ @impl true
140
+ def given(scenario), do: __MODULE__.given(scenario, %{})
141
+
142
+ @impl true
143
+ def given(scenario, attrs), do: given_command(scenario, AddCredential, Map.merge(@defaults, attrs))
144
+ end
145
+ ```
146
+
147
+ A spec applies contexts with the `given:` option of its scenario, which runs them in order before its own
148
+ `setup_all`; contexts compose with `given_context/2` (`a_rotated_credential` is `a_credential` and a
149
+ rotation). Put a context where its users are: next to the one spec folder that needs it
150
+ (`for_rotate_secret/given/`), or in the feature's `given/` folder when several slices share it
151
+ (`secrets/given/`, `api/given/`). A fact that is only reachable through the real pipeline (a client created in
152
+ Ory) is given with a command that must succeed; the scenario goes on from before it, so only what the spec's
153
+ own behavior appended counts.
138
154
 
139
- alias Prism.Access.Components.DataTable.ForDataTable.Given.People
140
- import People, only: [names: 1, table: 1]
141
- ...
155
+ Load the scripts once, in `lib/test_helper.exs` (the helper sits in the first of `test_paths`), and keep
156
+ `mix test` from running them:
157
+
158
+ ```elixir
159
+ for file <- Path.wildcard("lib/**/given/*.exs") |> Enum.sort(), do: Code.require_file(file)
160
+ ```
161
+
162
+ ```elixir
163
+ test_ignore_filters: [&String.contains?(&1, "/given/")]
142
164
  ```
143
165
 
144
- A context that needs a compiled module (a `Case` with `setup`, an in-memory stand-in) is a `test/support/*.ex`
145
- module that the spec `use`s, like `Prism.Access.Case` in a Cratis application: it starts the in-memory
146
- Chronicle kernel and gives `exec/3`, `facts/2` and the stand-ins.
166
+ A thing the scenarios cannot express (fakes that need `start_supervised!`, application environment, a fixed
167
+ clock) is prepared by `setup: {Module, :function}`, run before the contexts in the setup's own process. An
168
+ application wraps that in its own `use` (`use Prism.Access.Scenario, given: [...]`) so a spec states only the
169
+ contexts and the behavior. Pure ExUnit specs of a function or a component keep a plain `given/` module that
170
+ they load with `Code.require_file("../given/people.exs", __DIR__)`.
147
171
 
148
172
  ## What to specify, by kind
149
173
 
@@ -49,6 +49,8 @@ A single `<Slice>.cs` therefore contains ALL of: `[Command]` records with `Handl
49
49
 
50
50
  **❌ Never split by artifact type** (`Commands/`, `Handlers/`, `Events/` folders) — that is the layered structure the slice replaces.
51
51
 
52
+ **[convention] A name does not repeat what its path already says.** A slice is named for what it does *within its feature*, so the feature's noun is not repeated: `Credentials/Adding`, `Credentials/Renaming`, `Secrets/Rotating`, not `Credentials/AddingCredentials` or `Secrets/RotatingSecrets`. Keep the noun when the feature does not name it (`Credentials/AddingLabels`, `Credentials/SyncingClients`, `Credentials/TransferringOwnership`), and never drop it into ambiguity: if two slices of a feature would end up with the same name, the nouns stay. The same holds up the tree: a module's root feature is named for what it is (`Prism.Access.Api`, not `Prism.Access.ApiCredentials` beside `Api.Credentials`), a view's query module is `Queries` inside its slice folder, and a spec is named for the unit and the behavior, not for the folders above it. The command, event and read model keep their full names (`AddCredential`, `CredentialAdded`): they are read away from the path, in the event model, the log and the proxies, where the path is gone.
53
+
52
54
  ## Concepts
53
55
 
54
56
  Every domain identifier or named value is a typed record — raw `string`/`Guid`/`int` should not appear on commands, events, or read models for domain values. Primitives stay primitive only when the meaning *is* the base type (`bool`, a plain count, `DateOnly`).
@@ -568,9 +568,9 @@
568
568
  "repository": "Cratis/release-action",
569
569
  "packages": [],
570
570
  "synced": {
571
- "version": "1.5.1",
572
- "date": "2026-10-25",
573
- "by": "Cratis/AI#820"
571
+ "version": "1.5.2",
572
+ "date": "2026-11-27",
573
+ "by": "Cratis/AI#1368"
574
574
  },
575
575
  "covers": {
576
576
  "skills": [
@@ -581,7 +581,7 @@
581
581
  ]
582
582
  },
583
583
  "coverage": "tracked",
584
- "notes": "Cratis/AI#820: reviewed v1.4.3, v1.5.0 and v1.5.1. Skill and PR policy now distinguish workflow-drift 403 recovery from stale-tag retry, opt-in batching/defaults/outputs, combined summaries and corrected pending-major hotfix behavior. No workflow activation or release execution claimed."
584
+ "notes": "Cratis/AI#1368: reviewed v1.5.2. Release notes skill now uses skipped-batch explanations to decide whether to wait or request an authorized manual release; PR policy is unchanged because the label and note contracts did not change. No workflow activation or release execution claimed. Prior: Cratis/AI#820: reviewed v1.4.3, v1.5.0 and v1.5.1. Skill and PR policy now distinguish workflow-drift 403 recovery from stale-tag retry, opt-in batching/defaults/outputs, combined summaries and corrected pending-major hotfix behavior. No workflow activation or release execution claimed."
585
585
  },
586
586
  {
587
587
  "id": "screenplay-generation",
@@ -86,13 +86,17 @@ anti-pattern fixes must not scatter a vertical slice across folders.
86
86
  Read the **cratis-arc-elixir** and **cratis-chronicle-client-elixir** skills before touching a slice.
87
87
 
88
88
  - **Folders are Module, Feature, Slice, and sub-features nest.** One folder per behavior, named for what
89
- it does as a gerund (`RotatingSecrets`); the command inside is the verb. Group slices that act on one
89
+ it does as a gerund, without repeating what its sub-feature already names (`Secrets.Rotating`, not
90
+ `Secrets.RotatingSecrets`; see [vertical-slices.md](./vertical-slices.md)); the command inside is the verb and keeps
91
+ its noun (`RotateSecret`). Group slices that act on one
90
92
  thing into a sub-feature (`Secrets`, `Credentials`, `Viewing`), and put a reactor with the facts it
91
93
  reacts to, not in a folder named for the third party it calls. No folders named for a kind of file.
92
94
  - **Names are ids.** `use Cratis.Arc.Command, id: "rotate-secret"`, an event type's `id:`, a reactor's
93
95
  `id:`; the model shows the id in PascalCase, so a module can be renamed without renaming the model.
94
96
  - **A command and its events live in one file**, events first. An event is past tense, one fact, and
95
- never carries a secret.
97
+ never carries a secret or anything derived from one (no hint, hash or last characters): the system that
98
+ owns a secret, such as an identity provider, is the only one that holds it, and a secret is shown once to
99
+ the person who asked for it.
96
100
  - **Every slice tells a whole story**: a state change has a command and the events it appends; a view
97
101
  has a read model and consumes events (`consumes:` when it reads the event log); an automation reacts to
98
102
  an event, runs a command and records the fact that command appends, so the event model shows what it
@@ -63,8 +63,8 @@ Folder names are `snake_case`. A spec's **module name mirrors its path** below t
63
63
  `PascalCase`, so it can never clash with the module it specifies and is never named `...Test`:
64
64
 
65
65
  ```elixir
66
- # lib/access/credentials/adding_credentials/for_add_credential/when_adding/with_selected_vessels.exs
67
- defmodule Prism.Access.Credentials.AddingCredentials.ForAddCredential.WhenAdding.WithSelectedVessels do
66
+ # lib/access/credentials/adding/for_add_credential/when_adding/with_selected_vessels.exs
67
+ defmodule Prism.Access.Credentials.Adding.ForAddCredential.WhenAdding.WithSelectedVessels do
68
68
  use ExUnit.Case, async: true
69
69
  ```
70
70
 
@@ -123,26 +123,50 @@ fine for a pure function; there is no scenario to set up.
123
123
  assert on internals, and do not spec logging or trivial delegation.
124
124
  - `doctest Module` belongs in its own spec (`when_building/with_the_documented_examples.exs`).
125
125
 
126
- ## Shared context: `given/`
126
+ ## Shared context: `given/` contexts
127
127
 
128
- Contexts that several specs share (a table of people, a started kernel) go in `for_<unit>/given/<name>.exs`
129
- as a module, and a spec loads it by relative path. The filter above keeps `given/` out of the specs ExUnit
130
- runs, so it is loaded once, by the spec that needs it:
128
+ Facts that several specs start from are a **given context**, named for the situation (`a_credential`,
129
+ `a_rotated_credential`), the counterpart of the `given` classes of the C# specs. A context is a module in a
130
+ script under a `given/` folder beside the specs that use it, with `given/1` that returns the next scenario
131
+ (`given/2` takes an argument, `{Context, argument}` passes it):
131
132
 
132
133
  ```elixir
133
- Code.require_file("../given/people.exs", __DIR__)
134
+ # lib/access/api/given/a_credential.exs
135
+ defmodule Prism.Access.Api.Given.ACredential do
136
+ use Cratis.Arc.Test.Given
134
137
 
135
- defmodule Prism.Access.Components.DataTable.ForDataTable.WhenFiltering.WithASingleFilter do
136
- use ExUnit.Case, async: true
138
+ @impl true
139
+ def given(scenario), do: __MODULE__.given(scenario, %{})
140
+
141
+ @impl true
142
+ def given(scenario, attrs), do: given_command(scenario, AddCredential, Map.merge(@defaults, attrs))
143
+ end
144
+ ```
145
+
146
+ A spec applies contexts with the `given:` option of its scenario, which runs them in order before its own
147
+ `setup_all`; contexts compose with `given_context/2` (`a_rotated_credential` is `a_credential` and a
148
+ rotation). Put a context where its users are: next to the one spec folder that needs it
149
+ (`for_rotate_secret/given/`), or in the feature's `given/` folder when several slices share it
150
+ (`secrets/given/`, `api/given/`). A fact that is only reachable through the real pipeline (a client created in
151
+ Ory) is given with a command that must succeed; the scenario goes on from before it, so only what the spec's
152
+ own behavior appended counts.
137
153
 
138
- alias Prism.Access.Components.DataTable.ForDataTable.Given.People
139
- import People, only: [names: 1, table: 1]
140
- ...
154
+ Load the scripts once, in `lib/test_helper.exs` (the helper sits in the first of `test_paths`), and keep
155
+ `mix test` from running them:
156
+
157
+ ```elixir
158
+ for file <- Path.wildcard("lib/**/given/*.exs") |> Enum.sort(), do: Code.require_file(file)
159
+ ```
160
+
161
+ ```elixir
162
+ test_ignore_filters: [&String.contains?(&1, "/given/")]
141
163
  ```
142
164
 
143
- A context that needs a compiled module (a `Case` with `setup`, an in-memory stand-in) is a `test/support/*.ex`
144
- module that the spec `use`s, like `Prism.Access.Case` in a Cratis application: it starts the in-memory
145
- Chronicle kernel and gives `exec/3`, `facts/2` and the stand-ins.
165
+ A thing the scenarios cannot express (fakes that need `start_supervised!`, application environment, a fixed
166
+ clock) is prepared by `setup: {Module, :function}`, run before the contexts in the setup's own process. An
167
+ application wraps that in its own `use` (`use Prism.Access.Scenario, given: [...]`) so a spec states only the
168
+ contexts and the behavior. Pure ExUnit specs of a function or a component keep a plain `given/` module that
169
+ they load with `Code.require_file("../given/people.exs", __DIR__)`.
146
170
 
147
171
  ## What to specify, by kind
148
172
 
@@ -48,6 +48,8 @@ A single `<Slice>.cs` therefore contains ALL of: `[Command]` records with `Handl
48
48
 
49
49
  **❌ Never split by artifact type** (`Commands/`, `Handlers/`, `Events/` folders) — that is the layered structure the slice replaces.
50
50
 
51
+ **[convention] A name does not repeat what its path already says.** A slice is named for what it does *within its feature*, so the feature's noun is not repeated: `Credentials/Adding`, `Credentials/Renaming`, `Secrets/Rotating`, not `Credentials/AddingCredentials` or `Secrets/RotatingSecrets`. Keep the noun when the feature does not name it (`Credentials/AddingLabels`, `Credentials/SyncingClients`, `Credentials/TransferringOwnership`), and never drop it into ambiguity: if two slices of a feature would end up with the same name, the nouns stay. The same holds up the tree: a module's root feature is named for what it is (`Prism.Access.Api`, not `Prism.Access.ApiCredentials` beside `Api.Credentials`), a view's query module is `Queries` inside its slice folder, and a spec is named for the unit and the behavior, not for the folders above it. The command, event and read model keep their full names (`AddCredential`, `CredentialAdded`): they are read away from the path, in the event model, the log and the proxies, where the path is gone.
52
+
51
53
  ## Concepts
52
54
 
53
55
  Every domain identifier or named value is a typed record — raw `string`/`Guid`/`int` should not appear on commands, events, or read models for domain values. Primitives stay primitive only when the meaning *is* the base type (`bool`, a plain count, `DateOnly`).
@@ -32,8 +32,8 @@ arc: [application: MyApp.Arc, event_model_strict: true]
32
32
 
33
33
  - A slice is the module namespace after `segments_to_skip` as `[module, feature..., slice]`: the first
34
34
  segment is the module, the last the slice, **everything between is a feature path**, so
35
- `Prism.Access.ApiCredentials.Secrets.RotatingSecrets.RotateSecret` with `segments_to_skip: 1` is the
36
- slice `RotatingSecrets` of the sub-feature `Secrets` of the feature `ApiCredentials` of the module
35
+ `Prism.Access.Api.Secrets.Rotating.RotateSecret` with `segments_to_skip: 1` is the
36
+ slice `Rotating` of the sub-feature `Secrets` of the feature `Api` of the module
37
37
  `Access`. The board nests sub-features as `subFeatures`, the Screenplay source nests `feature` inside
38
38
  `feature`, and each depth has its own document. Fewer than three segments fill the deepest parts first.
39
39
  - A slice with a command is a state change; with a read model, reducer or projection a state view; with
@@ -41,7 +41,9 @@ scenario as `:scenario`, and you chain `given_events/3`, `execute/3` (`as:` a `p
41
41
  `should_have_constraint_violation/1,2`, `should_respond_with/2`, `should_have_appended/2,3`,
42
42
  `should_have_appended_exactly/2`, `should_not_have_appended_any_events/1`, `should_return_items/2`. The
43
43
  `Cratis.Arc.Test.Should` module is the counterpart of the C# `Should` extensions (`should_equal/2`,
44
- `should_contain_only/2`, `should_match/2`, ...). Read `rules/specs.elixir.md` for the layout of the files.
44
+ `should_contain_only/2`, `should_match/2`, ...). Reusable facts are given contexts (`use Cratis.Arc.Test.Given`, a `given/1` that returns the scenario) applied with
45
+ `given: [Context]` or `given/2`, and `setup: {Module, :function}` prepares fakes before they run. Read
46
+ `rules/specs.elixir.md` for the layout of the files and the contexts.
45
47
 
46
48
  Also `Cratis.Arc.Test.query/5`, `principal/2`, `assert_success/1`, `assert_forbidden/1`,
47
49
  `assert_appended/3` and `wait_for_observers/1`. For a plain Plug application without
@@ -28,7 +28,7 @@
28
28
 
29
29
  | Mistake | What happens | Do this |
30
30
  | --- | --- | --- |
31
- | A read model module in the parent namespace (`ApiCredentials.Listing` beside `ApiCredentials.Listing.Reducer`) | The view is grouped with the parent feature, not its slice | Put the query module inside the slice folder (`Listing.Queries`) |
31
+ | A read model module in the parent namespace (`Api.Listing` beside `Api.Listing.Reducer`) | The view is grouped with the parent feature, not its slice | Put the query module inside the slice folder (`Listing.Queries`) |
32
32
  | A reactor that appends events itself or returns nothing | The automation slice shows no command or no events | Have the reactor run a command in its slice folder that appends the fact; Arc shows reaction, command and event |
33
33
  | A view over a model another slice builds | Old Arc showed no events | Arc 1.4 reads them from the reducer; use `consumes:` for a model read from the event log |
34
34
  | Reading the last module segment as the name | The model shows the `id:` | Name by `id:` and keep `display_names:` in mind |
@@ -36,8 +36,8 @@ arc: [application: MyApp.Arc, output: "assets/src/arc"]
36
36
  A feature that holds more than about six slices is usually several features. Look for these seams
37
37
  before adding the next slice, and review them whenever a feature grows:
38
38
 
39
- - **One noun, many verbs.** The slices that act on one thing (`rotating_secrets`, `revoking_previous_secrets`,
40
- `expiring_previous_secrets`, `retiring_secrets`) belong together in a sub-feature named for the
39
+ - **One noun, many verbs.** The slices that act on one thing (`rotating`, `revoking_previous`,
40
+ `expiring_previous`, `retiring`) belong together in a sub-feature named for the
41
41
  thing (`secrets/`), not spread across a flat feature.
42
42
  - **A reactor belongs with the facts it reacts to.** An automation that retires a secret after it was
43
43
  revoked lives in `secrets/`, not in a folder named for the third party it calls (`ory/`). A third
@@ -48,8 +48,8 @@ before adding the next slice, and review them whenever a feature grows:
48
48
  Have it record the fact that its effect happened (`SecretRetiredInOry`), so the automation shows
49
49
  what it produced.
50
50
 
51
- The folder is the namespace: `Prism.Access.ApiCredentials.Secrets.RotatingSecrets` is the slice
52
- `RotatingSecrets` of the sub-feature `Secrets`. Arc's structure and event model show each
51
+ The folder is the namespace: `Prism.Access.Api.Secrets.Rotating` is the slice
52
+ `Rotating` of the sub-feature `Secrets`. Arc's structure and event model show each
53
53
  sub-feature as a feature of its own, so the grouping is what readers and tools see. Keep
54
54
  `segments_to_skip` equal to the segments above the module.
55
55
 
@@ -48,7 +48,9 @@ starts the kernel once per spec module (`lifecycle: :per_test` for one per test)
48
48
  `should_have_constraint_violation/1,2`, `should_have_concurrency_violation/1`, `should_have_appended/2,3`,
49
49
  `should_have_appended_exactly/2`, `should_not_have_appended_any_events/1`, `should_have_tail_sequence_number/2`,
50
50
  `should_have_read_model/4`, `should_have_observer_failures/1,2`. Only what the `append` added counts, not the
51
- given events. The layout and naming of the files is `rules/specs.elixir.md`.
51
+ given events. Reusable facts are given contexts (`use Cratis.Chronicle.Testing.Given`) applied with
52
+ `given: [Context]`, and `setup: {Module, :function}` prepares fakes. The layout and naming of the files is
53
+ `rules/specs.elixir.md`.
52
54
 
53
55
  ## Waiting and reading
54
56
 
@@ -132,10 +132,17 @@ labels warn but are not permission to omit required PR labels.
132
132
 
133
133
  `hotfix-labels` defaults to `hotfix` and bypasses the window. With a pending major,
134
134
  only the merge run for the hotfix fails; scheduled/other merge runs warn and leave
135
- the batch pending. A manual run without a version releases everything pending;
136
- obtain the required human major confirmation first. Inspect `pull-requests` and
137
- `reason` (`batched` or `nothing-pending`) rather than assuming every successful
138
- run released. Never turn on batching just to clear a queue without authorization.
135
+ the batch pending. An authorized manual Publish run with an empty version or
136
+ `0.0.0` releases everything pending; obtain the required human major confirmation
137
+ first. Inspect `pull-requests` and `reason` (`batched` or `nothing-pending`)
138
+ rather than assuming every successful run released. Never turn on batching just
139
+ to clear a queue without authorization.
140
+
141
+ From release-action 1.5.2, check the main-step log or the step summary's
142
+ `Explanation` to see why a batch was skipped. If the window is still open, both
143
+ list the pending PRs and show the oldest merge time and when the window elapses
144
+ (in UTC). Use that time to decide whether to wait for the next scheduled Publish
145
+ run or request an authorized manual release. The post step logs the skip reason.
139
146
 
140
147
  A release-creation 403 caused by workflow drift names the recovery:
141
148
  dispatch the publish workflow from the current default branch with the PR's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "7.193.2",
3
+ "version": "7.194.1",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [