@cratis/pi 2.22.0 → 2.23.0
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.
- package/package/corpus/agents/backend-developer.md +6 -5
- package/package/corpus/agents/code-reviewer.md +7 -7
- package/package/corpus/agents/coordinator.md +5 -4
- package/package/corpus/agents/frontend-developer.md +34 -40
- package/package/corpus/agents/orchestrator.md +5 -4
- package/package/corpus/agents/performance-reviewer.md +5 -4
- package/package/corpus/agents/planner.md +5 -4
- package/package/corpus/agents/repository-investigation-reviewer.md +2 -1
- package/package/corpus/agents/repository-investigator.md +2 -1
- package/package/corpus/agents/security-reviewer.md +5 -4
- package/package/corpus/agents/slice-implementer.md +8 -2
- package/package/corpus/agents/spec-writer.md +6 -4
- package/package/corpus/harnesses/pi/extensions/subagent/agents.ts +52 -7
- package/package/corpus/harnesses/pi/extensions/subagent/index.ts +14 -0
- package/package/corpus/hooks/README.md +29 -27
- package/package/corpus/hooks/agent-stop.md +1 -5
- package/package/corpus/hooks/scripts/cratis-patterns.json +1 -1
- package/package/corpus/hooks/scripts/validate-package-subpaths.sh +1 -2
- package/package/corpus/prompts/verify-ai-setup.prompt.md +17 -7
- package/package/corpus/rules/ai-distribution.md +58 -0
- package/package/corpus/rules/components.md +77 -44
- package/package/corpus/rules/dialogs.md +24 -20
- package/package/corpus/rules/efcore.md +35 -187
- package/package/corpus/rules/framework.md +1 -1
- package/package/corpus/rules/frontend-quality.md +1 -1
- package/package/corpus/rules/frontend-testing.md +4 -4
- package/package/corpus/rules/general.md +29 -105
- package/package/corpus/rules/new-repository-intake.md +34 -0
- package/package/corpus/rules/orleans.md +13 -27
- package/package/corpus/rules/react.md +12 -12
- package/package/corpus/rules/reactors.md +28 -5
- package/package/corpus/rules/specs.scenarios.csharp.md +18 -3
- package/package/corpus/rules/specs.typescript.md +1 -1
- package/package/corpus/rules/storybook.md +2 -2
- package/package/corpus/rules/typescript.md +1 -0
- package/package/corpus/rules/vertical-slices.md +20 -15
- package/package/corpus/rules/writing-correct-examples.md +1 -0
- package/package/corpus/skills/cratis-application-react-specifications/SKILL.md +4 -4
- package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +16 -8
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/SKILL.md +6 -4
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authentication.md +1 -1
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authorization.md +1 -1
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/frontend.md +1 -1
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/local-development.md +1 -1
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/tenancy.md +7 -4
- package/package/corpus/skills/cratis-arc-command/SKILL.md +9 -7
- package/package/corpus/skills/cratis-arc-command/references/command-result.md +1 -1
- package/package/corpus/skills/cratis-arc-command/references/handler-shapes.md +2 -2
- package/package/corpus/skills/cratis-arc-command/references/proxy-generation.md +6 -3
- package/package/corpus/skills/cratis-arc-command/references/read-model-injection.md +1 -1
- package/package/corpus/skills/cratis-arc-command-execution/SKILL.md +12 -2
- package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +5 -3
- package/package/corpus/skills/cratis-arc-ef-core-migration/SKILL.md +7 -4
- package/package/corpus/skills/cratis-arc-observable-query-http/SKILL.md +10 -3
- package/package/corpus/skills/cratis-arc-query-paging/SKILL.md +13 -8
- package/package/corpus/skills/cratis-arc-react-page/SKILL.md +27 -24
- package/package/corpus/skills/cratis-arc-react-page/references/data-page.md +15 -11
- package/package/corpus/skills/cratis-arc-react-page/references/data-tables.md +9 -2
- package/package/corpus/skills/cratis-arc-react-page/references/dialogs.md +11 -9
- package/package/corpus/skills/cratis-arc-react-page/references/queries-and-commands.md +26 -2
- package/package/corpus/skills/cratis-chronicle-cli-operations/SKILL.md +19 -13
- package/package/corpus/skills/cratis-chronicle-client-dotnet/SKILL.md +17 -15
- package/package/corpus/skills/cratis-chronicle-client-elixir/SKILL.md +24 -20
- package/package/corpus/skills/cratis-chronicle-client-kotlin/SKILL.md +26 -15
- package/package/corpus/skills/cratis-chronicle-client-typescript/SKILL.md +15 -11
- package/package/corpus/skills/cratis-chronicle-compliance/SKILL.md +14 -3
- package/package/corpus/skills/cratis-chronicle-event-constraints/SKILL.md +13 -6
- package/package/corpus/skills/cratis-chronicle-event-modeling/SKILL.md +2 -2
- package/package/corpus/skills/cratis-chronicle-event-specifications/SKILL.md +11 -5
- package/package/corpus/skills/cratis-chronicle-event-type-migration/SKILL.md +2 -2
- package/package/corpus/skills/cratis-chronicle-multi-tenancy/SKILL.md +2 -2
- package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +23 -4
- package/package/corpus/skills/cratis-chronicle-projection/references/fluent-builder.md +1 -1
- package/package/corpus/skills/cratis-chronicle-projection/references/model-bound-attributes.md +2 -2
- package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +22 -8
- package/package/corpus/skills/cratis-chronicle-read-model/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-read-model/references/queries.md +1 -1
- package/package/corpus/skills/cratis-chronicle-read-model-specifications/SKILL.md +3 -1
- package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-web-workbench/SKILL.md +19 -11
- package/package/corpus/skills/cratis-cli-terminal-workbench/SKILL.md +11 -6
- package/package/corpus/skills/cratis-code-review/SKILL.md +8 -6
- package/package/corpus/skills/cratis-components-accessibility/SKILL.md +112 -82
- package/package/corpus/skills/cratis-components-schema-editor/SKILL.md +12 -10
- package/package/corpus/skills/cratis-components-stepper-command-dialog/SKILL.md +11 -12
- package/package/corpus/skills/cratis-components-styling/SKILL.md +204 -170
- package/package/corpus/skills/cratis-components-toolbar/SKILL.md +32 -26
- package/package/corpus/skills/cratis-event-model-diagram/SKILL.md +1 -1
- package/package/corpus/skills/cratis-fundamentals-concept/SKILL.md +2 -2
- package/package/corpus/skills/cratis-fundamentals-type-discovery/SKILL.md +2 -2
- package/package/corpus/skills/cratis-lens-browser-extension/SKILL.md +4 -2
- package/package/corpus/skills/cratis-performance-review/SKILL.md +4 -2
- package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +15 -5
- package/package/corpus/skills/cratis-security-review/SKILL.md +20 -3
- package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +3 -3
- package/package/corpus/skills/cratis-specifications-csharp/references/application-scenarios.md +12 -8
- package/package/corpus/skills/cratis-specifications-csharp/references/csharp-patterns.md +1 -1
- package/package/corpus/skills/cratis-specifications-csharp/references/integration-specs.md +7 -3
- package/package/corpus/skills/cratis-specifications-typescript/SKILL.md +6 -3
- package/package/corpus/skills/cratis-specifications-typescript/references/typescript-patterns.md +21 -4
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +29 -17
- package/package.json +1 -1
|
@@ -19,8 +19,10 @@ the developer points it at. Nothing in it is production tooling.
|
|
|
19
19
|
|
|
20
20
|
| Source | Version | Purpose |
|
|
21
21
|
| --- | --- | --- |
|
|
22
|
-
| `Cratis/Lens` `Source/` | manifest `1.0.0`, repository
|
|
23
|
-
| `Cratis.Arc.Core` | `22.
|
|
22
|
+
| `Cratis/Lens` `Source/` | manifest `1.0.0`, repository `HEAD` `3ee4882` (the repo has no release tag beyond `v0.0.1`) | The extension itself |
|
|
23
|
+
| `Cratis.Arc.Core` | `22.16.0` | The `/.cratis/*` endpoints, the forwarded-identity contract, and the tenancy header Lens depends on |
|
|
24
|
+
|
|
25
|
+
> Re-verified at the versions above by **symbol and signature**: every type, attribute and member this skill names exists at that tag, and the public surface it describes is unchanged since the previous verification (Chronicle 16.45.x / Arc 22.10.4 — the Chronicle 16→18 client diff is converters, options and doc comments; no type was removed or renamed). Behavior claims were verified at the earlier tag unless a section says otherwise.
|
|
24
26
|
|
|
25
27
|
⚠️ **There is no published store listing.** Nothing in the Lens repository links
|
|
26
28
|
a Chrome Web Store, Edge Add-ons, AMO, or App Store entry — the only store URLs
|
|
@@ -20,10 +20,12 @@ storage and replay cost that never goes away.
|
|
|
20
20
|
|
|
21
21
|
| Package | Version | Purpose |
|
|
22
22
|
| --- | --- | --- |
|
|
23
|
-
| `Cratis.Chronicle` | `
|
|
24
|
-
| `Cratis.Arc.Core` | `22.
|
|
23
|
+
| `Cratis.Chronicle` | `18.3.0` | Observers, projections, reducers, reactors, replay |
|
|
24
|
+
| `Cratis.Arc.Core` | `22.16.0` | Query return shapes and server-side paging |
|
|
25
25
|
| `@cratis/components` | current | `DataTable` paging surface |
|
|
26
26
|
|
|
27
|
+
> Re-verified at the versions above by **symbol and signature**: every type, attribute and member this skill names exists at that tag, and the public surface it describes is unchanged since the previous verification (Chronicle 16.45.x / Arc 22.10.4 — the Chronicle 16→18 client diff is converters, options and doc comments; no type was removed or renamed). Behavior claims were verified at the earlier tag unless a section says otherwise.
|
|
28
|
+
|
|
27
29
|
Reverify against the owning product repository before asserting a framework
|
|
28
30
|
behavior this file does not already state.
|
|
29
31
|
|
|
@@ -26,7 +26,7 @@ reality, not against the ecosystem diagram.
|
|
|
26
26
|
| `Cratis.Screenplay.Tool` | `4.12.1` | The `screenplay` dotnet tool |
|
|
27
27
|
| `Cratis.Screenplay.CanonicalCorpus` | `4.12.1` | The frozen `RegisterProject` conformance vector downstream tools verify against |
|
|
28
28
|
|
|
29
|
-
Behavior below is read from the repository at
|
|
29
|
+
Behavior below is read from the repository at tag `v4.12.1`. Reverify before
|
|
30
30
|
claiming another version behaves the same.
|
|
31
31
|
|
|
32
32
|
## Verify a model
|
|
@@ -108,8 +108,8 @@ by dedicated parsers rather than passed through as text.
|
|
|
108
108
|
## A complete model
|
|
109
109
|
|
|
110
110
|
This is the canonical conformance vector — the smallest complete program the
|
|
111
|
-
whole toolchain is verified against, quoted from
|
|
112
|
-
`Screenplay.CanonicalCorpus`'s `RegisterProject
|
|
111
|
+
whole toolchain is verified against, quoted in full from
|
|
112
|
+
`Screenplay.CanonicalCorpus`'s `Corpus/RegisterProject/v1-legacy/source/single/RegisterProject.play`:
|
|
113
113
|
|
|
114
114
|
```screenplay
|
|
115
115
|
concept ProjectId : Uuid
|
|
@@ -136,6 +136,15 @@ module Projects
|
|
|
136
136
|
then ProjectRegistered
|
|
137
137
|
projectId = "3fa85f64-5717-4562-b3fc-2c963f66afa6"
|
|
138
138
|
name = "Screenplay"
|
|
139
|
+
then readmodel ProjectSummary
|
|
140
|
+
projectId = "3fa85f64-5717-4562-b3fc-2c963f66afa6"
|
|
141
|
+
name = "Screenplay"
|
|
142
|
+
then query ProjectById
|
|
143
|
+
arguments
|
|
144
|
+
projectId = "3fa85f64-5717-4562-b3fc-2c963f66afa6"
|
|
145
|
+
result
|
|
146
|
+
projectId = "3fa85f64-5717-4562-b3fc-2c963f66afa6"
|
|
147
|
+
name = "Screenplay"
|
|
139
148
|
specification RejectingAnEmptyProjectName
|
|
140
149
|
when RegisterProject
|
|
141
150
|
projectId = "3fa85f64-5717-4562-b3fc-2c963f66afa6"
|
|
@@ -168,7 +177,7 @@ The parser accepts far more than anything can execute or render. Between the
|
|
|
168
177
|
syntax tree and any runtime sits the **executable semantic model (ESM v1)**, and
|
|
169
178
|
it fails closed.
|
|
170
179
|
|
|
171
|
-
⚠️ `SemanticSliceKind` has
|
|
180
|
+
⚠️ `SemanticSliceKind` has three members — `Unknown = -1`, `StateChange` and `StateView` — and `Unknown` is load-bearing: the binder maps every other slice type to it and refuses to admit it.
|
|
172
181
|
An `Automation` or `Translate` slice is rejected outright with
|
|
173
182
|
`Slice '<name>' of type '<type>' is not admitted by ESM v1.` It parses, it
|
|
174
183
|
validates, and it binds to nothing.
|
|
@@ -199,7 +208,8 @@ The language service ships two ways: the Monaco package
|
|
|
199
208
|
file icon.
|
|
200
209
|
|
|
201
210
|
⚠️ Its keyword list has drifted from the parser. `theme`, `ui`, `form`,
|
|
202
|
-
`contribute`, `dialog` and `reducer`
|
|
211
|
+
`contribute`, `dialog` and `reducer` have no keyword, tokenizer or completion
|
|
212
|
+
entry in the Monaco package (the words occur only in prose and theme names),
|
|
203
213
|
although all six are real constructs the compiler accepts. They get no
|
|
204
214
|
highlighting and no completion. Absent highlighting is not evidence that a
|
|
205
215
|
construct is wrong — check `screenplay` instead.
|
|
@@ -16,13 +16,30 @@ first.
|
|
|
16
16
|
|
|
17
17
|
| Package | Version | Purpose |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| `Cratis.Arc.Chronicle` | `22.
|
|
20
|
-
| `Cratis.Chronicle` | `
|
|
21
|
-
| `Cratis.Arc.Core` | `22.
|
|
19
|
+
| `Cratis.Arc.Chronicle` | `22.16.0` | `[NotAudited]` in `Cratis.Arc.Chronicle.Commands`; the `ARCCHR0009` analyzer |
|
|
20
|
+
| `Cratis.Chronicle` | `18.3.0` | `[PII]`, `[Subject]`, redaction, namespace isolation |
|
|
21
|
+
| `Cratis.Arc.Core` | `22.16.0` | Authorization filters, `CommandResult.Unauthorized` |
|
|
22
|
+
|
|
23
|
+
> Re-verified at the versions above by **symbol and signature**: every type, attribute and member this skill names exists at that tag, and the public surface it describes is unchanged since the previous verification (Chronicle 16.45.x / Arc 22.10.4 — the Chronicle 16→18 client diff is converters, options and doc comments; no type was removed or renamed). Behavior claims were verified at the earlier tag unless a section says otherwise.
|
|
22
24
|
|
|
23
25
|
Reverify against the owning product repository before asserting a framework
|
|
24
26
|
guarantee this file does not already state.
|
|
25
27
|
|
|
28
|
+
## When to run this review without being asked
|
|
29
|
+
|
|
30
|
+
The orchestrating agents and the PR-review prompt run it unconditionally as the
|
|
31
|
+
last gate. When you are shipping directly — one agent, one branch — run it
|
|
32
|
+
yourself before committing whenever the diff **adds or removes** a line carrying
|
|
33
|
+
any of: `[Roles]`, `[Authorize]`, `[AllowAnonymous]`, `[ExecuteCommandsAsSystem]`;
|
|
34
|
+
`[PII]`, `[Subject]`, `[NotAudited]`; `useIdentity`; or a secret-shaped identifier
|
|
35
|
+
(`ConnectionString`, `PrivateKey`, `Bearer`, `Password`, `ApiKey`, `AccessToken`).
|
|
36
|
+
Added *or removed* matters: a deleted `[PII]` or `[Roles]` is the change most
|
|
37
|
+
worth a second pair of eyes. Match changed lines, not whole files — every slice
|
|
38
|
+
contains a `[Command]` and an `[EventType]`, and a trigger that fires on every
|
|
39
|
+
commit is a trigger that gets skipped. A name-based list has the same blind spot
|
|
40
|
+
as `ARCCHR0009`: a secret with an innocuous property name passes it, so read the
|
|
41
|
+
command's properties as well as grepping them.
|
|
42
|
+
|
|
26
43
|
## Route near misses
|
|
27
44
|
|
|
28
45
|
- General correctness and maintainability: use `cratis-code-review`.
|
|
@@ -16,9 +16,9 @@ This skill is verified against these exact public releases:
|
|
|
16
16
|
|
|
17
17
|
| Package | Version | Purpose |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| `Cratis.Specifications` | `4.1.
|
|
20
|
-
| `Cratis.Arc.Testing` | `22.
|
|
21
|
-
| `Cratis.Chronicle.Testing` | `
|
|
19
|
+
| `Cratis.Specifications` | `4.1.1` | `Specification` base, `Catch.Exception`, `ShouldXxx` assertions |
|
|
20
|
+
| `Cratis.Arc.Testing` | `22.16.0` | `CommandScenario<TCommand>` and `CommandResult` assertions |
|
|
21
|
+
| `Cratis.Chronicle.Testing` | `18.3.0` | `EventScenario`, `ReadModelScenario<T>`, `ReactorScenario<T>` |
|
|
22
22
|
|
|
23
23
|
Reverify against the owning product repository before claiming support for
|
|
24
24
|
another version. Never translate an assertion or helper name from memory.
|
package/package/corpus/skills/cratis-specifications-csharp/references/application-scenarios.md
CHANGED
|
@@ -5,8 +5,8 @@ in-process. They are the default for event-sourced *application* behavior. A
|
|
|
5
5
|
library or framework repository reaches for one only to test the very engine it
|
|
6
6
|
provides.
|
|
7
7
|
|
|
8
|
-
Verified against `Cratis.Arc.Testing` `22.
|
|
9
|
-
`
|
|
8
|
+
Verified against `Cratis.Arc.Testing` `22.16.0` and `Cratis.Chronicle.Testing`
|
|
9
|
+
`18.3.0`.
|
|
10
10
|
|
|
11
11
|
| Helper | Exercises | Use for |
|
|
12
12
|
| --- | --- | --- |
|
|
@@ -42,9 +42,12 @@ public class and_<condition> : Specification
|
|
|
42
42
|
#endif
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
`CommandScenario<TCommand>` itself exposes
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
`CommandScenario<TCommand>` itself exposes `Services`, `Context`, `Execute`
|
|
46
|
+
(two overloads), `Validate`, `LastResult`, `Operations`, the operation assertions
|
|
47
|
+
`ShouldHaveExecutedOperation<T>()` / `ShouldHaveCompensatedOperation<T>()` /
|
|
48
|
+
`ShouldHaveNoOperationInvocations()`, and `Dispose`/`DisposeAsync`. Seeding
|
|
49
|
+
(`Given`), the event log and the *event* assertions arrive as extension members
|
|
50
|
+
from `Cratis.Arc.Chronicle.Testing`.
|
|
48
51
|
|
|
49
52
|
- **Event assertions** are extension methods keyed by command *and* event type:
|
|
50
53
|
`ShouldHaveAppendedEvent<TCommand, TEvent>(eventSourceId)`, its
|
|
@@ -120,9 +123,10 @@ and `ShouldNotHaveConstraintViolations()`,
|
|
|
120
123
|
`ShouldHaveConcurrencyViolations()` and its negation, `ShouldHaveErrors()` and
|
|
121
124
|
its negation. Assert the constraint **name**, never the message.
|
|
122
125
|
|
|
123
|
-
⚠️ `EventScenario` wires a
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
⚠️ `EventScenario` wires a strategy that always answers `ConcurrencyScope.None`,
|
|
127
|
+
which the validator skips, so an append that lets the strategy choose the scope
|
|
128
|
+
never produces a concurrency violation. `ShouldHaveConcurrencyViolations()`
|
|
129
|
+
cannot pass for such an append and its negation passes vacuously — specify concurrency against the
|
|
126
130
|
real kernel with an out-of-process integration specification instead.
|
|
127
131
|
|
|
128
132
|
## `ReadModelScenario<TReadModel>`
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Detail for the plain `Cratis.Specifications` surface: phases, substitution,
|
|
4
4
|
assertions, and exception capture. Verified against `Cratis.Specifications`
|
|
5
|
-
`4.1.
|
|
5
|
+
`4.1.1` and NSubstitute as consumed by that package.
|
|
6
6
|
|
|
7
7
|
## Phases
|
|
8
8
|
|
|
@@ -9,7 +9,7 @@ They live under `when_<behavior>/` **inside the behavior's own folder**, not in
|
|
|
9
9
|
`for_<Type>/` unit folder: there is no isolated unit, the whole slice is under
|
|
10
10
|
test. Never mix unit and integration specifications in one folder.
|
|
11
11
|
|
|
12
|
-
Verified against `Cratis.Chronicle.Testing` `
|
|
12
|
+
Verified against `Cratis.Chronicle.Testing` `18.3.0` (`Cratis.Chronicle.XUnit.Integration` at the same tag).
|
|
13
13
|
|
|
14
14
|
## Structure
|
|
15
15
|
|
|
@@ -106,7 +106,9 @@ _collector = StartCollectingAppends();
|
|
|
106
106
|
await _collector.WaitForCount(2, TimeSpan.FromSeconds(10));
|
|
107
107
|
|
|
108
108
|
[Fact] void should_append_<event>() =>
|
|
109
|
-
_collector.ShouldHaveEvent<<EventType>>(appended => appended.<Property
|
|
109
|
+
_collector.Last.ShouldHaveEvent<<EventType>>(appended => appended.<Property>.ShouldEqual(<expected>));
|
|
110
|
+
// IEventAppendCollection has no assertions of its own — only All, Last and WaitForCount.
|
|
111
|
+
// ShouldHaveEvent<TEvent>(Action<TEvent>? validate) is an extension on each AppendedEventWithResult.
|
|
110
112
|
|
|
111
113
|
void Destroy() => _collector.Dispose();
|
|
112
114
|
```
|
|
@@ -120,7 +122,9 @@ deadline, not a sleep — it turns a hang into a named failure.
|
|
|
120
122
|
- Add the `using context = <full.namespace>.context;` alias at the top of the
|
|
121
123
|
file.
|
|
122
124
|
- `[Collection(ChronicleCollection.Name)]` goes on the outer class and is
|
|
123
|
-
required for isolation.
|
|
125
|
+
required for isolation. `ChronicleCollection` is **yours to define** — one
|
|
126
|
+
`[CollectionDefinition(Name)] public class ChronicleCollection : ICollectionFixture<ChronicleOutOfProcessFixture>`
|
|
127
|
+
in the specs project (Chronicle ships the fixture, not the collection).
|
|
124
128
|
- `Establish` seeds preconditions; `Because` performs the action under test.
|
|
125
129
|
- Declare `Result` nullable.
|
|
126
130
|
- The outer class receives `context` through xUnit constructor injection.
|
|
@@ -109,9 +109,12 @@ describe('when <behavior> with <condition>', given(a_<system_under_test>, contex
|
|
|
109
109
|
}));
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
-
`given()`
|
|
113
|
-
|
|
114
|
-
`
|
|
112
|
+
`given()` constructs the context class **once per `describe`** and hands that
|
|
113
|
+
instance to the suite — it does not re-create it per `it()`. Isolation therefore
|
|
114
|
+
comes from the spec's shape: `beforeEach` performs the single action under
|
|
115
|
+
specification, and each `it()` only asserts one outcome of it. Never put a second
|
|
116
|
+
action in an `it()`; the stubs it would disturb are shared with the sibling
|
|
117
|
+
`it()` blocks.
|
|
115
118
|
|
|
116
119
|
## Step 4 — Skip the context when nothing is shared
|
|
117
120
|
|
package/package/corpus/skills/cratis-specifications-typescript/references/typescript-patterns.md
CHANGED
|
@@ -78,13 +78,30 @@ afterEach(() => sinon.restore());
|
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
`sinon.restore()` matters only for stubs installed on shared objects such as
|
|
81
|
-
`globalThis`. A `createStubInstance` built inside a context class
|
|
82
|
-
|
|
81
|
+
`globalThis`. A `createStubInstance` built inside a context class lives for the
|
|
82
|
+
whole `describe` (see below), so a stub whose call count you assert must be
|
|
83
|
+
exercised by exactly one action — the one in `beforeEach` — or reset there.
|
|
83
84
|
|
|
84
85
|
## The `given()` helper
|
|
85
86
|
|
|
86
|
-
`given()`
|
|
87
|
-
|
|
87
|
+
`given()` constructs the context class **once, when the `describe` body is
|
|
88
|
+
registered**, and hands that single instance to the suite callback:
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
export function given<TContext extends object>(contextType: Constructor<TContext>, callback: ContextForSuite<TContext>) {
|
|
92
|
+
return function (this: Suite) {
|
|
93
|
+
const context = new contextType(this); // once per describe, not per it()
|
|
94
|
+
callback.call(this, context);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
There is no `beforeEach` inside `given()`. Every `it()` under one `describe`
|
|
100
|
+
sees the same context and the same stubs, so isolation comes from the shape of
|
|
101
|
+
the spec, not from the helper: one `describe` = one behavior, one action in
|
|
102
|
+
`beforeEach`, and `it()` blocks that only *assert*. A spec that needs a fresh
|
|
103
|
+
collaborator per `it()` creates it in its own `beforeEach`. (The constructor is
|
|
104
|
+
handed the Mocha `Suite`; a context class may ignore it.)
|
|
88
105
|
|
|
89
106
|
```ts
|
|
90
107
|
import { given } from '../../given';
|
|
@@ -22,15 +22,18 @@ rendered.
|
|
|
22
22
|
|
|
23
23
|
| Artifact | Version | What it is |
|
|
24
24
|
| --- | --- | --- |
|
|
25
|
-
| `Cratis.Stage.Contracts` | `3.
|
|
26
|
-
| `Cratis.Stage.Rendering.Cratis` | `3.
|
|
27
|
-
| `Cratis.Stage` | `3.
|
|
28
|
-
| `
|
|
29
|
-
| `cratis/stage
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
| `Cratis.Stage.Contracts` | `3.15.1` | `ArtifactRenderPlan`, `EventModelLoader`, specification-result contracts |
|
|
26
|
+
| `Cratis.Stage.Rendering.Cratis` | `3.15.1` | The one rendering target and the `CratisRendering` facade |
|
|
27
|
+
| `Cratis.Stage.Rendering.Cratis.Scaffolding` | `3.15.1` | Scaffolds the Cratis project a rendered application is placed into |
|
|
28
|
+
| `Cratis.Stage` | `3.15.1` | The partial direct runtime engine |
|
|
29
|
+
| `cratis/stage` | `3.15.1`, `latest` | Disposable HTTP host plus an in-memory Chronicle kernel |
|
|
30
|
+
| `cratis/stage-specrunner` | `3.15.1`, `latest` | Run-to-completion specification job |
|
|
31
|
+
|
|
32
|
+
Behavior below is read from the repository at tag `v3.15.1`. Packing is opt-in
|
|
33
|
+
per project (`<IsPackable>true</IsPackable>` on `Contracts`, `Rendering.Cratis`,
|
|
34
|
+
`Rendering.Cratis.Scaffolding` and `Stage`); `Cratis.Stage.Host` and
|
|
35
|
+
`Cratis.Stage.SpecRunner` never opt in and exist only as the two container
|
|
36
|
+
images.
|
|
34
37
|
|
|
35
38
|
## Input
|
|
36
39
|
|
|
@@ -74,8 +77,13 @@ artifacts.**
|
|
|
74
77
|
|
|
75
78
|
### What it admits
|
|
76
79
|
|
|
77
|
-
Every rule below is enforced, and each failure is a blocking `STAGE-ESM-
|
|
78
|
-
diagnostic that stops the whole plan.
|
|
80
|
+
Every rule below is enforced, and each failure is a blocking `STAGE-ESM-0xx`
|
|
81
|
+
diagnostic that stops the whole plan. Before these per-slice rules run, three
|
|
82
|
+
admission diagnostics reject the model outright — `STAGE-ESM-001` (a slice kind
|
|
83
|
+
other than `StateChange`/`StateView`), `STAGE-ESM-002` (concept values or
|
|
84
|
+
validation the renderer cannot express) and `STAGE-ESM-003` (an unresolved
|
|
85
|
+
property type) — and `STAGE-ESM-011` rejects a specification the runtime cannot
|
|
86
|
+
execute.
|
|
79
87
|
|
|
80
88
|
For a `StateChange` slice:
|
|
81
89
|
|
|
@@ -174,8 +182,9 @@ docker run --rm \
|
|
|
174
182
|
cratis/stage:latest
|
|
175
183
|
```
|
|
176
184
|
|
|
177
|
-
The image pairs the Stage host with an in-memory Chronicle kernel and
|
|
178
|
-
model
|
|
185
|
+
The image pairs the Stage host with an in-memory Chronicle kernel and reads the
|
|
186
|
+
model from the fixed `/eventmodel` directory (mount your folder there; the
|
|
187
|
+
entrypoint takes no arguments — passing a folder is a documented override form). The Stage API is on `9090`, the Chronicle
|
|
179
188
|
Workbench on `35000`. Deployment configuration is read from `cratis-stage.json`,
|
|
180
189
|
overridable through the `STAGE_CONFIG` environment variable — not from
|
|
181
190
|
`appsettings.json`.
|
|
@@ -183,10 +192,13 @@ overridable through the `STAGE_CONFIG` environment variable — not from
|
|
|
183
192
|
⚠️ It is a **partial** runtime, not a generated application. Commands evaluate
|
|
184
193
|
their modeled `produces` mappings, append the facts to Chronicle and echo the
|
|
185
194
|
payload; **modeled validation and authorization are not enforced on this path.**
|
|
186
|
-
Modeled queries **
|
|
187
|
-
`IsAuthorized` returns
|
|
188
|
-
|
|
189
|
-
|
|
195
|
+
Modeled queries are **served without authorization**: the query performer's
|
|
196
|
+
`IsAuthorized` returns `true` unconditionally, and `Perform` reads the projected
|
|
197
|
+
documents (by id when the query declares one, otherwise all instances). There is
|
|
198
|
+
no executable query authorization contract in Screenplay yet, so a sandbox
|
|
199
|
+
query answering is not evidence that the model's authorization is right —
|
|
200
|
+
it is evidence that Stage does not enforce it. (Earlier Stage releases returned
|
|
201
|
+
nothing from every query; that is no longer the case at 3.15.1.)
|
|
190
202
|
|
|
191
203
|
## Modeled specifications
|
|
192
204
|
|