@cratis/pi 7.164.2 → 7.164.3

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.
@@ -46,7 +46,7 @@ Select from these canonical rules in `.cratis/ai/rules/` only after applying the
46
46
 
47
47
  ## C# specs — start with the plain call
48
48
 
49
- Specify pure `Handle()`, validator, reducer and reactor decisions with plain calls and supplied read-model state. Follow `.cratis/ai/rules/specs.scenarios.csharp.md`: add exactly the scenarios its per-artifact decision table obligates (pipeline and authorization, constraints, projection and reducer dispatch, reactor dispatch and routing) plus application-owned race-policy proof, not a platform guard matrix. Keep the single cheap assembly-level admission spec for the application's own decision-model shapes. Prefer in-process helpers over out-of-process Chronicle hosts for the applicable behaviors:
49
+ Specify pure `Handle()`, validator, reducer and reactor decisions with plain calls and supplied read-model state. Follow `.cratis/ai/rules/specs.scenarios.csharp.md`: add exactly the scenarios its per-artifact decision table obligates (pipeline and authorization, constraints, projection and reducer dispatch, reactor dispatch and routing), not a platform guard matrix. Prove a rule that must hold under concurrent writers, such as the last seat, from supplied read-model state, never with a race scenario. Keep the single cheap assembly-level admission spec for the application's own decision-model shapes. Prefer in-process helpers over out-of-process Chronicle hosts for the applicable behaviors:
50
50
 
51
51
  | Tool | Use for |
52
52
  |---|---|
@@ -46,7 +46,7 @@ Stop-and-fix signals during implementation and review:
46
46
  - [ ] Reused existing primitives/wrappers instead of duplicating.
47
47
  - [ ] No smell guard above is triggered without a short, intentional reason.
48
48
  - [ ] File read past its final `};` — no orphaned code.
49
- - [ ] New/changed reusable or stateful components have Storybook stories.
49
+ - [ ] New/changed reusable or stateful components have Storybook stories, except live slice pages wired directly to Arc hooks or a backend ([storybook.md](./storybook.instructions.md)); verify those through behavior specs and the running app.
50
50
  - [ ] New/changed view-model/helper behavior has BDD specs (see [frontend-testing.md](./frontend-testing.instructions.md)).
51
51
  - [ ] Lint, conditional test, and build pass (the project's frontend gates).
52
52
 
@@ -101,7 +101,7 @@ async Task Because() => _error = await Catch.Exception(_sut.DoSomething);
101
101
 
102
102
  Since 5.0 assertions live in `Cratis.Specifications`, with types forwarded by each framework package (namespace `Cratis.Specifications`); recompile and keep core/framework packages on the same version: `.ShouldEqual(expected)`, `.ShouldBeTrue()`, `.ShouldBeFalse()`, `.ShouldBeNull()`, `.ShouldNotBeNull()`, `.ShouldBeEmpty()`, `.ShouldNotBeEmpty()`, `.ShouldContain(item)`, `.ShouldNotContain(item)`, `.ShouldContainOnly(items)`, `.ShouldBeOfExactType<T>()`, `.ShouldBeGreaterThan(n)`, `.ShouldBeLessThan(n)`.
103
103
 
104
- Additional helpers include `ShouldNotEqual`, `ShouldBeSame`/`ShouldNotBeSame`, `ShouldMatch(Func<T, bool>)`, `ShouldBeInRange`, inclusive comparisons `ShouldBeGreaterThanOrEqual`/`ShouldBeLessThanOrEqual`, `ShouldContainSingleItem`, `ShouldEachConformTo`, ordered collection `ShouldEqual(IEnumerable<T>)`, collection `ShouldContain(Predicate<T>)`, `ShouldBeAssignableFrom<T>`, and string `ShouldContain(substring, StringComparison)`. `Catch.Exception` accepts `Action` or `Func<Task>`; `Catch.Exception<T>(Action)` catches only T.
104
+ Additional helpers include `ShouldNotEqual`, `ShouldBeSame`/`ShouldNotBeSame`, `ShouldMatch(Func<T, bool>)`, `ShouldBeInRange`, inclusive comparisons `ShouldBeGreaterThanOrEqual`/`ShouldBeLessThanOrEqual`, `ShouldContainSingleItem`, `ShouldEachConformTo`, ordered collection `ShouldEqual(IEnumerable<T>)`, collection `ShouldContain(Func<T, bool>)` (adapt a typed `Predicate<T>` with `x => predicate(x)`), `ShouldBeAssignableFrom<T>`, and string `ShouldContain(substring, StringComparison)`. `Catch.Exception` accepts `Action` or `Func<Task>`; `Catch.Exception<T>(Action)` catches only T.
105
105
 
106
106
  ## Conventions
107
107
 
@@ -88,9 +88,13 @@ const [result, perform] = AllProjects.use();
88
88
  // result.isSuccess — true when query completed without errors
89
89
  ```
90
90
 
91
- Paginated queries:
91
+ Paginated queries — the tuples differ, so skip the right number of slots:
92
92
  ```tsx
93
- const [result, , setPage] = AllProjects.useWithPaging(10);
93
+ // Plain query: [result, perform, setSorting, setPage, setPageSize]
94
+ const [result, , , setPage] = AllProjects.useWithPaging(10);
95
+
96
+ // Observable query has no perform: [result, setSorting, setPage, setPageSize]
97
+ const [liveResult, , setLivePage] = ObservedProjects.useWithPaging(10);
94
98
  ```
95
99
 
96
100
  ### CommandScope
@@ -41,7 +41,7 @@ Select from these canonical rules in `.cratis/ai/rules/` only after applying the
41
41
 
42
42
  ## C# specs — start with the plain call
43
43
 
44
- Specify pure `Handle()`, validator, reducer and reactor decisions with plain calls and supplied read-model state. Follow `.cratis/ai/rules/specs.scenarios.csharp.md`: add exactly the scenarios its per-artifact decision table obligates (pipeline and authorization, constraints, projection and reducer dispatch, reactor dispatch and routing) plus application-owned race-policy proof, not a platform guard matrix. Keep the single cheap assembly-level admission spec for the application's own decision-model shapes. Prefer in-process helpers over out-of-process Chronicle hosts for the applicable behaviors:
44
+ Specify pure `Handle()`, validator, reducer and reactor decisions with plain calls and supplied read-model state. Follow `.cratis/ai/rules/specs.scenarios.csharp.md`: add exactly the scenarios its per-artifact decision table obligates (pipeline and authorization, constraints, projection and reducer dispatch, reactor dispatch and routing), not a platform guard matrix. Prove a rule that must hold under concurrent writers, such as the last seat, from supplied read-model state, never with a race scenario. Keep the single cheap assembly-level admission spec for the application's own decision-model shapes. Prefer in-process helpers over out-of-process Chronicle hosts for the applicable behaviors:
45
45
 
46
46
  | Tool | Use for |
47
47
  |---|---|
@@ -45,7 +45,7 @@ Stop-and-fix signals during implementation and review:
45
45
  - [ ] Reused existing primitives/wrappers instead of duplicating.
46
46
  - [ ] No smell guard above is triggered without a short, intentional reason.
47
47
  - [ ] File read past its final `};` — no orphaned code.
48
- - [ ] New/changed reusable or stateful components have Storybook stories.
48
+ - [ ] New/changed reusable or stateful components have Storybook stories, except live slice pages wired directly to Arc hooks or a backend ([storybook.md](./storybook.md)); verify those through behavior specs and the running app.
49
49
  - [ ] New/changed view-model/helper behavior has BDD specs (see [frontend-testing.md](./frontend-testing.md)).
50
50
  - [ ] Lint, conditional test, and build pass (the project's frontend gates).
51
51
 
@@ -100,7 +100,7 @@ async Task Because() => _error = await Catch.Exception(_sut.DoSomething);
100
100
 
101
101
  Since 5.0 assertions live in `Cratis.Specifications`, with types forwarded by each framework package (namespace `Cratis.Specifications`); recompile and keep core/framework packages on the same version: `.ShouldEqual(expected)`, `.ShouldBeTrue()`, `.ShouldBeFalse()`, `.ShouldBeNull()`, `.ShouldNotBeNull()`, `.ShouldBeEmpty()`, `.ShouldNotBeEmpty()`, `.ShouldContain(item)`, `.ShouldNotContain(item)`, `.ShouldContainOnly(items)`, `.ShouldBeOfExactType<T>()`, `.ShouldBeGreaterThan(n)`, `.ShouldBeLessThan(n)`.
102
102
 
103
- Additional helpers include `ShouldNotEqual`, `ShouldBeSame`/`ShouldNotBeSame`, `ShouldMatch(Func<T, bool>)`, `ShouldBeInRange`, inclusive comparisons `ShouldBeGreaterThanOrEqual`/`ShouldBeLessThanOrEqual`, `ShouldContainSingleItem`, `ShouldEachConformTo`, ordered collection `ShouldEqual(IEnumerable<T>)`, collection `ShouldContain(Predicate<T>)`, `ShouldBeAssignableFrom<T>`, and string `ShouldContain(substring, StringComparison)`. `Catch.Exception` accepts `Action` or `Func<Task>`; `Catch.Exception<T>(Action)` catches only T.
103
+ Additional helpers include `ShouldNotEqual`, `ShouldBeSame`/`ShouldNotBeSame`, `ShouldMatch(Func<T, bool>)`, `ShouldBeInRange`, inclusive comparisons `ShouldBeGreaterThanOrEqual`/`ShouldBeLessThanOrEqual`, `ShouldContainSingleItem`, `ShouldEachConformTo`, ordered collection `ShouldEqual(IEnumerable<T>)`, collection `ShouldContain(Func<T, bool>)` (adapt a typed `Predicate<T>` with `x => predicate(x)`), `ShouldBeAssignableFrom<T>`, and string `ShouldContain(substring, StringComparison)`. `Catch.Exception` accepts `Action` or `Func<Task>`; `Catch.Exception<T>(Action)` catches only T.
104
104
 
105
105
  ## Conventions
106
106
 
@@ -87,9 +87,13 @@ const [result, perform] = AllProjects.use();
87
87
  // result.isSuccess — true when query completed without errors
88
88
  ```
89
89
 
90
- Paginated queries:
90
+ Paginated queries — the tuples differ, so skip the right number of slots:
91
91
  ```tsx
92
- const [result, , setPage] = AllProjects.useWithPaging(10);
92
+ // Plain query: [result, perform, setSorting, setPage, setPageSize]
93
+ const [result, , , setPage] = AllProjects.useWithPaging(10);
94
+
95
+ // Observable query has no perform: [result, setSorting, setPage, setPageSize]
96
+ const [liveResult, , setLivePage] = ObservedProjects.useWithPaging(10);
93
97
  ```
94
98
 
95
99
  ### CommandScope
@@ -158,7 +158,8 @@ degradations a reviewer can see without measuring:
158
158
  with supplied read-model state; scenarios cover exactly the obligations in the
159
159
  per-artifact decision table of `specs.scenarios.csharp.md` (pipeline and
160
160
  authorization, constraints, projection and reducer dispatch, reactor dispatch
161
- and routing) plus application-owned race-policy proof.
161
+ and routing) and none beyond it. A rule that must hold under concurrent
162
+ writers is proven from supplied read-model state, not a race scenario.
162
163
  - Every State Change command has a happy-path specification.
163
164
  - Every validation rule has a direct-call failure spec. Pipeline validation
164
165
  specs assert **both** `ShouldNotBeSuccessful()` and `ShouldHaveValidationErrors()`.
@@ -111,10 +111,22 @@ From the `Cratis.Specifications.XUnit` package, namespace `Cratis.Specifications
111
111
  | `.ShouldBeGreaterThanOrEqual(n)` / `.ShouldBeLessThanOrEqual(n)` | Inclusive comparison |
112
112
  | `.ShouldContainSingleItem()` / `.ShouldEachConformTo(predicate)` | Collection cardinality / each-item predicate |
113
113
  | Collection `.ShouldEqual(IEnumerable<T>)` | Ordered sequence equality |
114
- | Collection `.ShouldContain(Predicate<T>)` | At least one matching item |
114
+ | Collection `.ShouldContain(Func<T, bool>)` | At least one matching item |
115
115
  | `.ShouldBeAssignableFrom<T>()` | Actual object is assignable to T |
116
116
  | String `.ShouldContain(substring, StringComparison)` | Explicit string comparison |
117
117
 
118
+ The collection filter is `Func<T, bool>`. A lambda or a `Func<T, bool>` is
119
+ accepted directly; a typed `Predicate<T>` does not convert, so adapt it:
120
+
121
+ ```csharp
122
+ Func<<ItemType>, bool> isExpected = item => item.<Property> == <expected>;
123
+ _items.ShouldContain(isExpected);
124
+ _items.ShouldContain(item => item.<Property> == <expected>);
125
+
126
+ Predicate<<ItemType>> matches = item => item.<Property> == <expected>;
127
+ _items.ShouldContain(item => matches(item));
128
+ ```
129
+
118
130
  Assert on values and types. Do not assert on presentation message strings by
119
131
  default; assert exact text only when that wording is the specified behavior,
120
132
  and name that behavior in the fact.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "7.164.2",
3
+ "version": "7.164.3",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [