@cratis/pi 7.14.2 → 7.14.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.
- package/package/corpus/skills/cratis-application-slice-conformance/SKILL.md +11 -2
- package/package/corpus/skills/cratis-application-slice-conformance/references/build-prompts.md +8 -0
- package/package/corpus/skills/cratis-application-slice-conformance/references/checklists.md +10 -6
- package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/SKILL.md +11 -7
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authentication.md +12 -2
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authorization.md +16 -1
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/frontend.md +7 -0
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/observable-emission-guards.md +9 -0
- package/package/corpus/skills/cratis-arc-command/SKILL.md +20 -15
- package/package/corpus/skills/cratis-arc-command/references/command-result.md +7 -0
- package/package/corpus/skills/cratis-arc-command/references/handler-shapes.md +10 -3
- package/package/corpus/skills/cratis-arc-command-execution/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-command-operation/SKILL.md +5 -1
- package/package/corpus/skills/cratis-arc-command-operation/references/execution-and-recovery.md +12 -0
- package/package/corpus/skills/cratis-arc-command-operation/references/testing.md +10 -3
- package/package/corpus/skills/cratis-arc-command-typescript/SKILL.md +20 -116
- package/package/corpus/skills/cratis-arc-command-typescript/references/chronicle-events.md +11 -8
- package/package/corpus/skills/cratis-arc-command-typescript/references/command-specifications.md +63 -0
- package/package/corpus/skills/cratis-arc-command-typescript/references/hosting-and-storage.md +10 -0
- package/package/corpus/skills/cratis-arc-command-typescript/references/proxy-generation.md +38 -0
- package/package/corpus/skills/cratis-arc-command-typescript/references/slice-layout.md +19 -0
- package/package/corpus/skills/cratis-arc-command-typescript/verification.json +1 -1
- package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-query-paging/SKILL.md +11 -10
- package/package/corpus/skills/cratis-arc-react-page/SKILL.md +30 -19
- package/package/corpus/skills/cratis-arc-react-page/references/data-page.md +11 -0
- package/package/corpus/skills/cratis-arc-react-page/references/data-tables.md +10 -0
- package/package/corpus/skills/cratis-arc-react-page/references/dialogs.md +12 -10
- package/package/corpus/skills/cratis-arc-react-page/references/from-screenplay.md +10 -0
- package/package/corpus/skills/cratis-arc-react-page/references/mvvm.md +11 -0
- package/package/corpus/skills/cratis-arc-react-page/references/queries-and-commands.md +7 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/SKILL.md +58 -122
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/compatibility-check.md +26 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/discovery.md +22 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/hosting.md +31 -0
- package/package/corpus/skills/cratis-chronicle-client-elixir/SKILL.md +52 -131
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/append-api.md +19 -0
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/variants.md +73 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/SKILL.md +29 -232
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/connection-lifecycle.md +20 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/discovery-and-registration.md +44 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/java-api.md +33 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/spring-boot.md +54 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/variants.md +77 -0
- package/package/corpus/skills/cratis-chronicle-client-typescript/SKILL.md +26 -102
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/read-models-and-projections.md +23 -0
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/variants.md +63 -0
- package/package/corpus/skills/cratis-chronicle-event-type-migration/SKILL.md +13 -13
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +13 -4
- package/package/corpus/skills/cratis-chronicle-projection/references/fluent-builder.md +10 -0
- package/package/corpus/skills/cratis-chronicle-projection/references/model-bound-attributes.md +14 -6
- package/package/corpus/skills/cratis-chronicle-projection/references/variants.md +9 -0
- package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +7 -49
- package/package/corpus/skills/cratis-chronicle-reactor/references/domain-failures.md +19 -0
- package/package/corpus/skills/cratis-chronicle-reactor/references/specifications.md +33 -0
- package/package/corpus/skills/cratis-chronicle-read-model/SKILL.md +2 -2
- package/package/corpus/skills/cratis-chronicle-read-model/references/queries.md +11 -0
- package/package/corpus/skills/cratis-chronicle-read-model-specifications/SKILL.md +1 -0
- package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-web-workbench/SKILL.md +24 -24
- package/package/corpus/skills/cratis-content-length/SKILL.md +1 -1
- package/package/corpus/skills/cratis-content-length/references/length-evidence.md +12 -0
- package/package/corpus/skills/cratis-developer-marketing/SKILL.md +19 -19
- package/package/corpus/skills/cratis-developer-marketing/references/measurement.md +10 -0
- package/package/corpus/skills/cratis-developer-marketing/references/playbook-evidence.md +10 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/SKILL.md +5 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/code-style.md +15 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/exceptions-logging-and-di.md +9 -4
- package/package/corpus/skills/cratis-engineering-decision-record/SKILL.md +1 -2
- package/package/corpus/skills/cratis-engineering-decision-record/references/record-format.md +8 -0
- package/package/corpus/skills/cratis-engineering-docs-authoring/SKILL.md +1 -2
- package/package/corpus/skills/cratis-engineering-effect-boundaries/references/failure-archetypes.md +10 -0
- package/package/corpus/skills/cratis-fundamentals-concept/SKILL.md +1 -1
- package/package/corpus/skills/cratis-fundamentals-type-discovery/SKILL.md +1 -1
- package/package/corpus/skills/cratis-lens-browser-extension/SKILL.md +18 -18
- package/package/corpus/skills/cratis-performance-review/SKILL.md +1 -1
- package/package/corpus/skills/cratis-release-notes/SKILL.md +1 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +29 -4
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/automation-patterns.md +16 -4
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/effects-and-idempotency.md +4 -15
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/todo-list-example.md +6 -2
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translation-patterns.md +1 -6
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +45 -245
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/capture-map-and-example.md +42 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/complete-examples.md +155 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/specifying-triggers-and-clock.md +27 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/trigger-reads-example.md +21 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +69 -227
- package/package/corpus/skills/cratis-screenplay-command-surface/references/context.md +10 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/generated-values-and-responses.md +51 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/inline-events.md +62 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/policy-persona-seed.md +46 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/validate-rules.md +36 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/verification.json +11 -11
- package/package/corpus/skills/cratis-screenplay-discovery/SKILL.md +10 -3
- package/package/corpus/skills/cratis-screenplay-discovery/references/facilitation.md +1 -6
- package/package/corpus/skills/cratis-screenplay-discovery/references/human-workshop.md +13 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/personas-and-causes.md +8 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/plotting-and-handoff.md +11 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/storming-loop.md +7 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +75 -198
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/file-layout.md +89 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/naming-primitives.md +26 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/nine-steps.md +14 -1
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +8 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/provenance.md +10 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/slice-type-rules.md +12 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/verification.json +12 -6
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +5 -6
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/candidate-inventory.md +11 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/prologue-safety.md +8 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/side-car-migration.md +11 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/ui-observation.md +1 -1
- package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +33 -10
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +8 -0
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-loop.md +13 -17
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +11 -0
- package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +9 -9
- package/package/corpus/skills/cratis-screenplay-model-review/references/business-questions.md +9 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +15 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/report-template.md +9 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/worked-example.md +9 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/SKILL.md +17 -8
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/handoff-template.md +8 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/identity-and-edits.md +1 -6
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phases.md +19 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/safety.md +1 -1
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/verdicts-and-modes.md +11 -1
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md +2 -2
- package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +3 -4
- package/package/corpus/skills/cratis-screenplay-projections/references/pdl-grammar.md +8 -0
- package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +2 -2
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +3 -3
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +1 -1
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/worked-example.md +8 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +10 -10
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/coverage-matrix.md +8 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/invoicing-dues-example.md +4 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-catalogue.md +17 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-examples.md +10 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-workshop.md +11 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/view-and-story-specs.md +12 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +2 -2
- package/package/corpus/skills/cratis-screenplay-slice-design/references/command-inventory.md +7 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/field-lineage.md +8 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/read-model-design.md +16 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/slicing.md +10 -0
- package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +52 -360
- package/package/corpus/skills/cratis-screenplay-specifications/references/actions-beyond-commands.md +34 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/concept-rules.md +77 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/generated-fixtures.md +39 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/reactions-and-cascades.md +72 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/worked-example.md +110 -0
- package/package/corpus/skills/cratis-screenplay-specifications/verification.json +6 -6
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +21 -1
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md +13 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/chronicle-boundaries.md +1 -1
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/consistency-and-concurrency.md +16 -20
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-patterns.md +16 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +13 -7
- package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +10 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +10 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/generated-responses-example.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/traps.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +10 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/versions.md +12 -0
- package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +11 -13
- package/package/corpus/skills/cratis-screenplay-ui-composition/references/flow-review.md +1 -1
- package/package/corpus/skills/cratis-social-feed-post/SKILL.md +10 -10
- package/package/corpus/skills/cratis-social-feed-post/references/engagement-evidence.md +12 -0
- package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +13 -2
- package/package/corpus/skills/cratis-specifications-csharp/references/application-scenarios.md +10 -10
- package/package/corpus/skills/cratis-specifications-csharp/references/csharp-patterns.md +10 -0
- package/package/corpus/skills/cratis-specifications-csharp/references/integration-specs.md +9 -0
- package/package/corpus/skills/cratis-specifications-typescript/SKILL.md +1 -2
- package/package/corpus/skills/cratis-specifications-typescript/references/typescript-patterns.md +11 -1
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +30 -21
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +9 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/render-example.md +5 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/sandbox-and-specrunner.md +2 -4
- package/package/corpus/skills/cratis-studio-mcp-safety-guidance/SKILL.md +2 -2
- package/package/corpus/skills/cratis-writing-voice-and-cadence/SKILL.md +39 -39
- package/package/corpus/skills/cratis-writing-voice-and-cadence/references/ai-tells.md +10 -0
- package/package.json +1 -1
|
@@ -26,6 +26,15 @@ other infrastructure. Change behaviour in the model first, never in managed outp
|
|
|
26
26
|
(`cratis-application-slice-specifications`); the render workflow itself
|
|
27
27
|
(`cratis-screenplay-render-and-gap-fill`).
|
|
28
28
|
|
|
29
|
+
## Startup verification for Automation and Translation
|
|
30
|
+
|
|
31
|
+
- **Real startup participation.** A `ReactorScenario` bypasses observer registration, so it
|
|
32
|
+
cannot show that the application subscribes the reactor. Verify, through the repository's
|
|
33
|
+
integration route or a startup check, that the real application discovers the intended
|
|
34
|
+
reactor (its assembly is scanned, per the repository's discovery convention), that it observes
|
|
35
|
+
the intended event store and event sequence, and that a trigger event delivered there reaches
|
|
36
|
+
it. Report this apart from the in-process specifications.
|
|
37
|
+
|
|
29
38
|
## Verified product sources
|
|
30
39
|
|
|
31
40
|
This skill is a method: it names no API of its own. Product facts it relies on are pinned
|
|
@@ -169,8 +178,8 @@ contract is implemented in code, and no specification lacks an executable equiva
|
|
|
169
178
|
- `references/contract-and-precedence.md` - sources, precedence, conflicting evidence.
|
|
170
179
|
- `references/build-prompts.md` - standing instructions, mandatory build flow, loop prompt, result packet, learning candidates.
|
|
171
180
|
- `references/checklists.md` - State Change, State View, Automation final checklists; Chronicle runtime guarantees; evidence.
|
|
172
|
-
- `references/worked-example.md` - a marina slice reconciled and re-delivered, with the report.
|
|
173
|
-
- `references/provenance.md` - sources and attribution.
|
|
181
|
+
- `references/worked-example.md` - a marina slice reconciled and re-delivered, with the report. Read when you need an example of reconciliation, delta delivery, or the final report.
|
|
182
|
+
- `references/provenance.md` - sources and attribution. Read when checking source attribution or adaptation history.
|
|
174
183
|
|
|
175
184
|
## Lineage
|
|
176
185
|
|
package/package/corpus/skills/cratis-application-slice-conformance/references/build-prompts.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Slice build prompts
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- 1. Standing project instructions
|
|
6
|
+
- 2. Build a slice: the mandatory flow
|
|
7
|
+
- 3. One slice per iteration (loop prompt)
|
|
8
|
+
- 4. Result packet
|
|
9
|
+
- 5. Learning candidates
|
|
10
|
+
|
|
3
11
|
Standing instructions for an implementer, or an unattended loop, that builds one slice at a
|
|
4
12
|
time from its contract. Paste or reference them in the brief; they restate rules already in
|
|
5
13
|
`SKILL.md` as an operating procedure. Adapted from Martin Dilger and Nebulit GmbH's build kit (see
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Final checklists
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Contract reconciliation
|
|
6
|
+
- State Change
|
|
7
|
+
- State View
|
|
8
|
+
- Automation and Translation
|
|
9
|
+
- Chronicle runtime guarantees
|
|
10
|
+
- Evidence
|
|
11
|
+
|
|
3
12
|
Reconcile in both directions with each list. Moved here from the render workflow; it gives
|
|
4
13
|
the renderer no right to browse managed output or implement rejected semantics.
|
|
5
14
|
|
|
@@ -79,12 +88,7 @@ the renderer no right to browse managed output or implement rejected semantics.
|
|
|
79
88
|
specification.
|
|
80
89
|
- A failed handling is not swallowed: failure behavior follows `cratis-chronicle-reactor`
|
|
81
90
|
(failure and quarantine), never a catch that continues.
|
|
82
|
-
|
|
83
|
-
cannot show that the application subscribes the reactor. Verify, through the repository's
|
|
84
|
-
integration route or a startup check, that the real application discovers the intended
|
|
85
|
-
reactor (its assembly is scanned, per the repository's discovery convention), that it observes
|
|
86
|
-
the intended event store and event sequence, and that a trigger event delivered there reaches
|
|
87
|
-
it. Report this apart from the in-process specifications.
|
|
91
|
+
See "Startup verification for Automation and Translation" in SKILL.md.
|
|
88
92
|
|
|
89
93
|
## Chronicle runtime guarantees
|
|
90
94
|
Follow the owning corpus skill. Verify the actual namespace, subject, constraint scope,
|
|
@@ -262,7 +262,7 @@ single append is `0`, never `1`.
|
|
|
262
262
|
## Lineage
|
|
263
263
|
|
|
264
264
|
Step 0, repeat execution and rule isolation are adapted in our own words from
|
|
265
|
-
ideas recorded in `references/provenance.md`.
|
|
265
|
+
ideas recorded in `references/provenance.md`. Read `references/provenance.md` when checking attribution or the origin of Step 0, repeat-execution coverage, and rule isolation.
|
|
266
266
|
|
|
267
267
|
## What breaks
|
|
268
268
|
|
|
@@ -43,7 +43,7 @@ is the trust boundary. But it means:
|
|
|
43
43
|
the application itself to validate a token, that is ordinary ASP.NET Core
|
|
44
44
|
authentication you configure yourself.
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
At `22.41.1` the default is that a plain `builder.AddCratis()` host registers the
|
|
47
47
|
unsigned-header scheme as its **default** authentication scheme, so any caller who
|
|
48
48
|
can reach it can forge a principal for every authorized command and query (open
|
|
49
49
|
Arc#2946). Run it only behind that ingress; otherwise use `AddCratisArc()` and
|
|
@@ -97,7 +97,7 @@ does its own 401/403. There is no public constant for the identity routes — th
|
|
|
97
97
|
are string literals in the endpoint mapper.
|
|
98
98
|
|
|
99
99
|
⚠️ **A fallback policy does not protect an endpoint that is explicitly anonymous**,
|
|
100
|
-
and the word "development" is not an environment check.
|
|
100
|
+
and the word "development" is not an environment check. At `22.41.1` the default is that
|
|
101
101
|
these routes are public and expose your command, query, user and tenant surface;
|
|
102
102
|
the exposure is tracked in open Arc#2834. To change it:
|
|
103
103
|
|
|
@@ -119,7 +119,7 @@ is `Lax`, `Path` is `/`.
|
|
|
119
119
|
|
|
120
120
|
⚠️ A non-`HttpOnly` cookie the browser can read is a cookie the user can edit.
|
|
121
121
|
Treat everything in it as a **display** input. Never let it decide anything the
|
|
122
|
-
server has not already decided.
|
|
122
|
+
server has not already decided. At `22.41.1` the default is that `/.cratis/me` returns
|
|
123
123
|
whatever a presented `.cratis-identity` cookie decodes to *before* it looks at the
|
|
124
124
|
authenticated principal, so a client can make it report any identity or roles
|
|
125
125
|
(open Arc#2939). Commands and queries authorize on the request principal and are
|
|
@@ -205,7 +205,7 @@ closed — the latter denies every observable query in the process. The principa
|
|
|
205
205
|
from `ObservableQueryEmissionContext.Principal`, never from ambient accessors or
|
|
206
206
|
`IHttpContextAccessor`; the guard is constructed per emission, so keep it cheap and
|
|
207
207
|
cache in a singleton. Guards do not protect the HTTP snapshot path. Read
|
|
208
|
-
[observable emission guards](references/observable-emission-guards.md).
|
|
208
|
+
[observable emission guards](references/observable-emission-guards.md) when implementing or reviewing revocation of an observable-query subscription.
|
|
209
209
|
|
|
210
210
|
### Validators are not an authorization boundary
|
|
211
211
|
|
|
@@ -238,14 +238,18 @@ the claim Arc reserves, and the ASP.NET Core scheme variant.
|
|
|
238
238
|
|
|
239
239
|
## Tenancy
|
|
240
240
|
|
|
241
|
+
Anything that must be isolated per tenant has to enforce that isolation itself,
|
|
242
|
+
downstream of resolution. Never treat a resolved tenant id as an authorization
|
|
243
|
+
decision.
|
|
244
|
+
|
|
241
245
|
`Cratis.Arc.Tenancy` resolves a tenant per request. The default resolver is
|
|
242
246
|
**header-based** on `x-cratis-tenant-id`; `TenantResolverType` also offers
|
|
243
247
|
`Query`, `Claim`, `Development`, `Subdomain` and `Fixed`, configured through
|
|
244
248
|
`ArcOptions.Tenancy` or the `Use*Tenancy` extension methods.
|
|
245
249
|
|
|
246
250
|
`ITenantIdAccessor.Current` gives the current `TenantId`, which is
|
|
247
|
-
`TenantId.NotSet` (`"[NotSet]"`) when nothing resolved.
|
|
248
|
-
[tenancy](references/tenancy.md)
|
|
251
|
+
`TenantId.NotSet` (`"[NotSet]"`) when nothing resolved. Read
|
|
252
|
+
[tenancy](references/tenancy.md) when selecting or configuring a tenant resolver, or handling an unresolved tenant; it gives the exact defaults and each resolver's
|
|
249
253
|
behavior.
|
|
250
254
|
|
|
251
255
|
Arc tenancy is request-scoped tenant *resolution*. It is not Chronicle's tenant
|
|
@@ -284,7 +288,7 @@ filter.
|
|
|
284
288
|
`Arc.React.MVVM` has **no** identity hook. It registers `IIdentityProvider` in
|
|
285
289
|
its container so a view model can constructor-inject it; that is all.
|
|
286
290
|
|
|
287
|
-
|
|
291
|
+
Read [frontend](references/frontend.md) when consuming identity in React or injecting it into a view model; it gives the exact exported shapes.
|
|
288
292
|
|
|
289
293
|
## Local development
|
|
290
294
|
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Authentication
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- The contract
|
|
6
|
+
- The Microsoft Identity Platform handler
|
|
7
|
+
- The reserved claim
|
|
8
|
+
- ASP.NET Core hosting
|
|
9
|
+
- Forwarded headers, ingress requirements and protected introspection
|
|
10
|
+
- What is not here
|
|
11
|
+
- The security boundary, stated plainly
|
|
12
|
+
|
|
3
13
|
Verified against `Cratis.Arc.Core` and `Cratis.Arc` `22.41.1`. Types are in
|
|
4
14
|
`Cratis.Arc.Authentication` and `Cratis.Arc.Identity`.
|
|
5
15
|
|
|
@@ -124,7 +134,7 @@ whose `SchemeName` is `"MicrosoftIdentityPlatform"`. `builder.AddCratis()` (the
|
|
|
124
134
|
`Cratis` package) calls this for you and makes it the **default** authentication
|
|
125
135
|
scheme; `AddCratisArc()` from `Cratis.Arc` does not register it.
|
|
126
136
|
|
|
127
|
-
⚠️
|
|
137
|
+
⚠️ At `22.41.1` the default is that a plain `builder.AddCratis()` host trusts the unsigned
|
|
128
138
|
`x-ms-client-principal*` headers from **any caller that can reach it** — it is safe
|
|
129
139
|
only behind the ingress described below (tracked as open Arc#2946). If the host is
|
|
130
140
|
not behind such an ingress, do not use this scheme: configure a credential-validating
|
|
@@ -149,7 +159,7 @@ Arc applies that rule to one place itself: the protected introspection catalogs
|
|
|
149
159
|
| `Roles` | `null` | Comma-separated, any one grants access; needs `RequireAuthentication: true` and no empty entries |
|
|
150
160
|
| `TrustForwardedIdentityHeaders` | `false` | Accepts identity from the unsigned forwarded headers for the protected catalog; needs `Enabled` and `RequireAuthentication` |
|
|
151
161
|
|
|
152
|
-
|
|
162
|
+
At `22.41.1` the default is that the catalogs are public, and with
|
|
153
163
|
`RequireAuthentication: true` the forwarded headers are **ignored** for them until
|
|
154
164
|
you set `TrustForwardedIdentityHeaders: true`: the built-in
|
|
155
165
|
`MicrosoftIdentityPlatformAuthenticationHandler` returns
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Authorization
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Versions differ — check the one you run
|
|
6
|
+
- Attributes
|
|
7
|
+
- Composition and precedence
|
|
8
|
+
- Named policies
|
|
9
|
+
- Guests and anonymous policies
|
|
10
|
+
- Evaluation order
|
|
11
|
+
- Baselines: two separate mechanisms
|
|
12
|
+
- Default access by hosting model
|
|
13
|
+
- The filters and results
|
|
14
|
+
- Direct calls bypass authorization
|
|
15
|
+
- The principal and system actors
|
|
16
|
+
- Protected decisions and validators
|
|
17
|
+
|
|
3
18
|
Verified against `Cratis.Arc.Core` and `Cratis.Arc` `22.41.1`. Everything below
|
|
4
19
|
describes that version and is in `Cratis.Arc.Authorization` unless stated.
|
|
5
20
|
|
|
@@ -127,7 +142,7 @@ opt-in:
|
|
|
127
142
|
- Only a declaration made **entirely** of opted-in policies, with no roles and no
|
|
128
143
|
schemes, can evaluate guests. Roles and schemes always require authentication.
|
|
129
144
|
|
|
130
|
-
⚠️ The opt-in governs Arc's pipeline verdict only.
|
|
145
|
+
⚠️ The opt-in governs Arc's pipeline verdict only. At `22.41.1` the HTTP layer can reject
|
|
131
146
|
a guest before the policy runs: a Core host with any authentication handler, or an
|
|
132
147
|
ASP.NET Core `FallbackPolicy` that requires authentication, returns 401 first
|
|
133
148
|
(tracked in Cratis/Arc#2948). Test guest endpoints through the real HTTP host.
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Observable query emission guards
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- The opt-in
|
|
6
|
+
- Verdicts
|
|
7
|
+
- The context
|
|
8
|
+
- Fail closed, and its blast radius
|
|
9
|
+
- Cost
|
|
10
|
+
- What a guard does not protect
|
|
11
|
+
|
|
3
12
|
Verified against `Cratis.Arc.Core` `22.41.1` (`Cratis.Arc.Queries`).
|
|
4
13
|
|
|
5
14
|
Authorization for an observable query runs **once, when the subscription is
|
|
@@ -11,6 +11,17 @@ Arc discovers it, runs authorization and validation, calls `Handle()`, and turns
|
|
|
11
11
|
whatever `Handle()` returns into events, server-executed operations, a response,
|
|
12
12
|
or a combination.
|
|
13
13
|
|
|
14
|
+
- An accepted `.play` model under the model root covers the behavior, or the
|
|
15
|
+
repository is opted in (the root holds a committed `.play` file (`git ls-tree -r --name-only HEAD` lists a `.play` file there, narrowed to `-- <root>` when a root is configured), or the project set
|
|
16
|
+
`mcpServers.screenplay.root` in `.cratis/ai.json`; an empty directory, install
|
|
17
|
+
output, an uncommitted `.play` draft or a `.play` file outside the root does not count; master definition:
|
|
18
|
+
`cratis-screenplay-modeling-lifecycle`): change the model first with
|
|
19
|
+
`cratis-screenplay-event-modeling`. If the Screenplay skills are not installed,
|
|
20
|
+
say so and do not author `.play` from memory.
|
|
21
|
+
Edit code here only for infrastructure, clients, adapters, Screenplay code
|
|
22
|
+
attachments, or gap-fill scope (`cratis-screenplay-render-and-gap-fill`);
|
|
23
|
+
never edit Stage-managed output.
|
|
24
|
+
|
|
14
25
|
## Verified product sources
|
|
15
26
|
|
|
16
27
|
| Package | Version | Purpose |
|
|
@@ -94,9 +105,13 @@ the *declared* return type must name `ICommandOperation`/`CommandOperations`
|
|
|
94
105
|
| `Result<TEvent, ValidationResult>` | Success appends the event; failure becomes a validation failure |
|
|
95
106
|
| `Task<T>` / `ValueTask<T>` of any of the above | Awaited first, then dispatched |
|
|
96
107
|
|
|
97
|
-
|
|
108
|
+
When choosing a return shape or diagnosing dispatch failures, read [handler shapes](references/handler-shapes.md) for the dispatch order, the
|
|
98
109
|
tuple rule, and the exact failure modes.
|
|
99
110
|
|
|
111
|
+
⚠️ **An unregistered event type is not an error.** No handler claims it, so it
|
|
112
|
+
silently becomes the HTTP response body instead of being appended. A command
|
|
113
|
+
that "runs fine" but appends nothing is almost always a missing `[EventType]`.
|
|
114
|
+
|
|
100
115
|
For immediate inline side effects chosen by the command, prefer returning an
|
|
101
116
|
operation rather than calling the service inside `Handle()`. Arc executes the
|
|
102
117
|
work and selects optional compensation from the commit facts. Direct service
|
|
@@ -257,7 +272,7 @@ either way, so the reading is all a reviewer has to go on.
|
|
|
257
272
|
|
|
258
273
|
`dotnet build` runs the generator after the build, and only when
|
|
259
274
|
`CratisProxiesOutputPath` is set. Output folders mirror the C# namespace, not the
|
|
260
|
-
file path.
|
|
275
|
+
file path. When configuring proxy generation or diagnosing missing or stale output, read [proxy generation](references/proxy-generation.md) for the full
|
|
261
276
|
set of MSBuild knobs and the common failures.
|
|
262
277
|
|
|
263
278
|
## The generated client contract
|
|
@@ -278,15 +293,15 @@ whatever renders it:
|
|
|
278
293
|
| `setInitialValuesFromCurrentValues()` | Rebaselines onto the current values |
|
|
279
294
|
| `revertChanges()` / `clear()` | Restore the baseline / reset everything |
|
|
280
295
|
|
|
281
|
-
Branch on the specific flag, not only on `isSuccess`. The exact `CommandResult`
|
|
296
|
+
Read `references/command-result.md` when branching on a command result or matching validation failures to fields. Branch on the specific flag, not only on `isSuccess`. The exact `CommandResult`
|
|
282
297
|
and `ValidationResult` shapes are in
|
|
283
298
|
[command result](references/command-result.md) — in particular, a validation
|
|
284
299
|
failure carries `members: string[]` (camelCased) and a numeric `severity`, not a
|
|
285
300
|
`propertyName` string.
|
|
286
301
|
|
|
287
302
|
`validateClientSide()` runs only the rules the generator could extract, so it can
|
|
288
|
-
pass where `execute()` still fails validation —
|
|
289
|
-
[proxy generation](references/proxy-generation.md)
|
|
303
|
+
pass where `execute()` still fails validation — read
|
|
304
|
+
[proxy generation](references/proxy-generation.md) when checking which validation rules are extractable.
|
|
290
305
|
|
|
291
306
|
Binding this proxy into a React component — the generated `use()` hook and the
|
|
292
307
|
Cratis Components command dialog and form fields — belongs to the Arc React and
|
|
@@ -302,16 +317,6 @@ Components guidance, not to this skill.
|
|
|
302
317
|
- Append-time uniqueness or concurrency constraints: the Chronicle event
|
|
303
318
|
constraints guidance.
|
|
304
319
|
- Choosing the concept or identity type for a value: `cratis-fundamentals-concept`.
|
|
305
|
-
- An accepted `.play` model under the model root covers the behavior, or the
|
|
306
|
-
repository is opted in (the root holds a committed `.play` file (`git ls-tree -r --name-only HEAD` lists a `.play` file there, narrowed to `-- <root>` when a root is configured), or the project set
|
|
307
|
-
`mcpServers.screenplay.root` in `.cratis/ai.json`; an empty directory, install
|
|
308
|
-
output, an uncommitted `.play` draft or a `.play` file outside the root does not count; master definition:
|
|
309
|
-
`cratis-screenplay-modeling-lifecycle`): change the model first with
|
|
310
|
-
`cratis-screenplay-event-modeling`. If the Screenplay skills are not installed,
|
|
311
|
-
say so and do not author `.play` from memory.
|
|
312
|
-
Edit code here only for infrastructure, clients, adapters, Screenplay code
|
|
313
|
-
attachments, or gap-fill scope (`cratis-screenplay-render-and-gap-fill`);
|
|
314
|
-
never edit Stage-managed output.
|
|
315
320
|
|
|
316
321
|
## Verify
|
|
317
322
|
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Handler shapes and how Arc dispatches them
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- The pipeline around `Handle`
|
|
6
|
+
- Dispatch
|
|
7
|
+
- What claims an event
|
|
8
|
+
- The tuple rule
|
|
9
|
+
- Cross-stream appends
|
|
10
|
+
- Failure shapes
|
|
11
|
+
|
|
3
12
|
Verified against `Cratis.Arc.Core` and `Cratis.Arc.Chronicle` `22.16.0` with
|
|
4
13
|
`Cratis.Chronicle` `18.3.0`. Operation dispatch additions are verified against
|
|
5
14
|
Arc **v22.48.1**, `CommandPipeline` and `CommandOperationExecution`.
|
|
@@ -72,9 +81,7 @@ type registry knows it.
|
|
|
72
81
|
| `EventForEventSourceId` | single wrapper handler | the wrapper's own id |
|
|
73
82
|
| A collection containing at least one `EventForEventSourceId`, every other element being a registered event | wrapper-collection handler | each wrapper to its own id, each plain event to the command's |
|
|
74
83
|
|
|
75
|
-
|
|
76
|
-
silently becomes the HTTP response body instead of being appended. A command
|
|
77
|
-
that "runs fine" but appends nothing is almost always a missing `[EventType]`.
|
|
84
|
+
See "Choose the return shape" in SKILL.md.
|
|
78
85
|
|
|
79
86
|
An empty collection statically typed as `IEnumerable<EventForEventSourceId>` is
|
|
80
87
|
still recognised and appends nothing, rather than being serialized as the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cratis-arc-command-execution
|
|
3
|
-
description: Execute an existing Cratis Arc command from backend code through ICommandPipeline — the scopeless and scoped overloads, the typed Execute
|
|
3
|
+
description: Execute an existing Cratis Arc command from backend code through ICommandPipeline — the scopeless and scoped overloads, the typed generic Execute, the pre-flight Validate, validation severity filtering, and how to read CommandResult. Use when a reactor, background job, scheduled task, or backend service must run a command without an HTTP request. Do not use to define a command.
|
|
4
4
|
license: MIT
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -103,7 +103,7 @@ operation-handler or response-value-handler registration is needed.
|
|
|
103
103
|
public/internal operation types and accessible non-generic containing types.
|
|
104
104
|
|
|
105
105
|
Omit `Compensate()` when there is no meaningful reversal; Arc does not invent
|
|
106
|
-
one.
|
|
106
|
+
one. Read [execution and recovery](references/execution-and-recovery.md) when checking declaration contracts, execution ordering, recovery observations, cancellation, or custom-scope compatibility.
|
|
107
107
|
|
|
108
108
|
## Return one, none, or many
|
|
109
109
|
|
|
@@ -223,6 +223,10 @@ See the [custom-scope checklist](references/execution-and-recovery.md#supported-
|
|
|
223
223
|
|
|
224
224
|
## Observe and test on the backend
|
|
225
225
|
|
|
226
|
+
Use `Cratis.Specifications.XUnit`, NSubstitute, and matching Arc packages in a
|
|
227
|
+
separate spec project. Keep standalone and Chronicle scenarios in separate
|
|
228
|
+
projects: Chronicle's discovered scenario extender changes the test environment.
|
|
229
|
+
|
|
226
230
|
Backend `CommandResult.Recovery` and `OperationOutcomes` describe recovery and
|
|
227
231
|
entered invocations. Both are excluded from HTTP JSON and the TypeScript result.
|
|
228
232
|
`Completed` recovery means callbacks returned, not that external history was
|
package/package/corpus/skills/cratis-arc-command-operation/references/execution-and-recovery.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Operation execution and recovery reference
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Declaration contract
|
|
6
|
+
- Returned values
|
|
7
|
+
- Nine-step ordering
|
|
8
|
+
- Commit and recovery
|
|
9
|
+
- Backend observations
|
|
10
|
+
- Optional failure context
|
|
11
|
+
- Cancellation and budget
|
|
12
|
+
- Supported scopes
|
|
13
|
+
- Troubleshooting
|
|
14
|
+
|
|
3
15
|
Verified at **Arc v22.48.1** against the
|
|
4
16
|
[product reference](https://github.com/Cratis/Arc/blob/v22.48.1/Documentation/backend/csharp/commands/operations/reference.md)
|
|
5
17
|
and `Source/DotNET/Arc.Core/Commands/`. Types below are in
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
# Specify decisions, adapters, and pipeline composition
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Decision: direct Handle
|
|
6
|
+
- Adapter: direct Execute and Compensate
|
|
7
|
+
- Composition: forward failure and reverse compensation
|
|
8
|
+
- Chronicle: a real commit rejection
|
|
9
|
+
- Extend the failure coverage
|
|
10
|
+
- Migrate an existing service-backed Handle
|
|
11
|
+
|
|
3
12
|
Verified at **Arc v22.48.1**. These class excerpts follow the product's
|
|
4
13
|
[standalone lesson](https://github.com/Cratis/Arc/blob/v22.48.1/Documentation/backend/csharp/testing/command-operations.md)
|
|
5
14
|
and [Chronicle rejection lesson](https://github.com/Cratis/Arc/blob/v22.48.1/Documentation/backend/csharp/testing/command-operations-with-chronicle.md).
|
|
6
|
-
|
|
7
|
-
separate spec project. Keep standalone and Chronicle scenarios in separate
|
|
8
|
-
projects: Chronicle's discovered scenario extender changes the test environment.
|
|
15
|
+
See "Observe and test on the backend" in SKILL.md.
|
|
9
16
|
|
|
10
17
|
The standalone examples reuse `ReservationId`, `SeatId`, `ISeatReservations`,
|
|
11
18
|
`ReserveSeat`, `BookSeat`, `SeatReservation`, and `BookSeats` from the
|
|
@@ -36,10 +36,19 @@ Verified against `Cratis/Arc.TypeScript` `main` at commit `94d398d` (tag
|
|
|
36
36
|
Chronicle SDK: `@cratis/chronicle` peer `^6.7.0`; the Library sample pins
|
|
37
37
|
`6.14.0`. Fundamentals: `@cratis/fundamentals` `^7.19.6`.
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Chronicle
|
|
42
|
-
|
|
39
|
+
Read [references/hosting-and-storage.md](references/hosting-and-storage.md) when setting up a host, using the Fetch entry, or wiring storage integrations. Read [references/chronicle-events.md](references/chronicle-events.md) when returning Chronicle events or specifying those commands.
|
|
40
|
+
|
|
41
|
+
## Chronicle traps
|
|
42
|
+
|
|
43
|
+
- Appending and projecting are separate: a query sent right after the command
|
|
44
|
+
may not see the event yet. Prefer an observable query on the client.
|
|
45
|
+
`completionTimeoutMs` makes the command wait for observers, but Chronicle waits
|
|
46
|
+
for **every** observer on the log (Cratis/Chronicle#4132), so a projection or
|
|
47
|
+
reactor that does not handle the event makes every command time out with 500.
|
|
48
|
+
|
|
49
|
+
- The in-memory scenario does **not** run projections, aggregates, constraints
|
|
50
|
+
or concurrency checks. `ChronicleKernelScenario` runs against a live kernel at
|
|
51
|
+
`ARC_CHRONICLE_TEST_URL` for those.
|
|
43
52
|
|
|
44
53
|
## Set up a project
|
|
45
54
|
|
|
@@ -129,23 +138,9 @@ local machine only.
|
|
|
129
138
|
|
|
130
139
|
## Lay out the slice
|
|
131
140
|
|
|
132
|
-
House convention (not a runtime requirement): one folder per behavior, one
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
Specs sit beside the slice in `for_<Subject>/when_<action>/<case>.ts`, which
|
|
136
|
-
`discover()` skips.
|
|
137
|
-
|
|
138
|
-
```text
|
|
139
|
-
Features/Tasks/
|
|
140
|
-
├── TaskId.ts
|
|
141
|
-
├── TaskTitle.ts
|
|
142
|
-
├── Tasks.ts
|
|
143
|
-
├── Registration/
|
|
144
|
-
│ ├── Registration.ts
|
|
145
|
-
│ └── for_RegisterTask/when_registering/with_valid_title.ts
|
|
146
|
-
└── Listing/
|
|
147
|
-
└── Listing.ts
|
|
148
|
-
```
|
|
141
|
+
House convention (not a runtime requirement): one folder per behavior, one TypeScript file holding the command, its validator and its events; specs in `for_<Subject>/when_<action>/`, which `discover()` skips.
|
|
142
|
+
|
|
143
|
+
Read [references/slice-layout.md](references/slice-layout.md) when creating a new feature folder.
|
|
149
144
|
|
|
150
145
|
## Declare the command
|
|
151
146
|
|
|
@@ -358,42 +353,9 @@ are in [references/chronicle-events.md](references/chronicle-events.md).
|
|
|
358
353
|
|
|
359
354
|
## Generate metadata and proxies
|
|
360
355
|
|
|
361
|
-
`arc-proxygenerator` (
|
|
362
|
-
reads the TypeScript source with the compiler API — it never queries a running
|
|
363
|
-
server. It writes server metadata and client proxies in one run. The CLI
|
|
364
|
-
rejects relative paths, and the output folder must exist:
|
|
365
|
-
|
|
366
|
-
```javascript
|
|
367
|
-
import { spawnSync } from 'node:child_process';
|
|
368
|
-
import { mkdirSync } from 'node:fs';
|
|
369
|
-
import process from 'node:process';
|
|
370
|
-
import { fileURLToPath } from 'node:url';
|
|
371
|
-
|
|
372
|
-
const path = relative => fileURLToPath(new URL(relative, import.meta.url));
|
|
373
|
-
const cli = fileURLToPath(new URL('./cli.js', import.meta.resolve('@cratis/arc.proxygenerator')));
|
|
374
|
-
mkdirSync(path('./generated'), { recursive: true });
|
|
375
|
-
const result = spawnSync(process.execPath, [cli,
|
|
376
|
-
'--project', path('./tsconfig.json'),
|
|
377
|
-
'--artifacts', path('./Features'),
|
|
378
|
-
'--output', path('./generated'),
|
|
379
|
-
'--metadata', path('./Features/generatedMetadata.ts'),
|
|
380
|
-
...process.argv.slice(2)], { stdio: 'inherit' });
|
|
381
|
-
process.exitCode = result.status ?? 1;
|
|
382
|
-
```
|
|
356
|
+
`arc-proxygenerator` (`@cratis/arc.proxygenerator`, unpublished) reads the TypeScript source and writes server metadata and client proxies in one run. Regenerate after **every** change to a command, read model or validator — `useGeneratedMetadata` throws `Stale generated artifact metadata for <Type>` otherwise — and gate CI with `--check-metadata`. Never edit the committed metadata module.
|
|
383
357
|
|
|
384
|
-
-
|
|
385
|
-
to a command, read model or validator — `useGeneratedMetadata` throws
|
|
386
|
-
`Stale generated artifact metadata for <Type>` otherwise. Reordering
|
|
387
|
-
parameters without changing their count goes undetected, so gate CI with
|
|
388
|
-
`--check-metadata` and keep `--watch` running beside `tsx` while developing.
|
|
389
|
-
- `--artifacts` must be the folder passed to `discover()`. Match route options
|
|
390
|
-
(`--api-prefix`, `--segments-to-skip`, `--root-namespace`) to the server's
|
|
391
|
-
`generatedApis` options, or proxies call URLs the server does not serve.
|
|
392
|
-
- Generated proxies import the **published** `@cratis/arc` and
|
|
393
|
-
`@cratis/arc.react` (the docs pin `22.19.1`) plus `@cratis/fundamentals`.
|
|
394
|
-
Compile them in `Bundler` resolution with `experimentalDecorators: true`, and
|
|
395
|
-
import `reflect-metadata` once in the frontend entry. Consuming the proxies in
|
|
396
|
-
React is `cratis-arc-react-page`.
|
|
358
|
+
Read [references/proxy-generation.md](references/proxy-generation.md) when wiring the generator script, matching route options to the server, or compiling the generated proxies in a frontend.
|
|
397
359
|
|
|
398
360
|
## Host the application
|
|
399
361
|
|
|
@@ -410,67 +372,9 @@ Start with a direct `handle()` call for pure command decisions, passing any
|
|
|
410
372
|
provided values explicitly. Add `CommandScenario` only where binding,
|
|
411
373
|
authorization, validation or dependency wiring contribute proof.
|
|
412
374
|
|
|
413
|
-
`@cratis/arc.testing` runs a command through the real pipeline in-process —
|
|
414
|
-
binding, authorization, validators, services, `provide()`, `handle()` — without
|
|
415
|
-
a listener. From `Samples/Tasks`:
|
|
416
|
-
|
|
417
|
-
```typescript
|
|
418
|
-
import { CommandScenario } from '@cratis/arc.testing';
|
|
419
|
-
import { Tasks } from '../../../Tasks.js';
|
|
420
|
-
import { RegisterTask, RegisterTaskValidator } from '../../Registration.js';
|
|
421
|
-
import { metadata } from '../../../../generatedMetadata.js';
|
|
422
|
-
|
|
423
|
-
export class a_task_registration {
|
|
424
|
-
tasks = new Tasks();
|
|
425
|
-
scenario = CommandScenario.for(RegisterTask, RegisterTaskValidator);
|
|
426
|
-
|
|
427
|
-
constructor() {
|
|
428
|
-
this.scenario.extend(builder => builder.useGeneratedMetadata(metadata));
|
|
429
|
-
this.scenario.services.addSingleton(Tasks, this.tasks);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
```
|
|
433
|
-
|
|
434
|
-
```typescript
|
|
435
|
-
import { given, type ScenarioCommandResult } from '@cratis/arc.testing';
|
|
436
|
-
import { TaskId } from '../../../TaskId.js';
|
|
437
|
-
import { TaskTitle } from '../../../TaskTitle.js';
|
|
438
|
-
import { a_task_registration } from '../given/a_task_registration.js';
|
|
439
|
-
|
|
440
|
-
describe('when registering a task with a valid title', given(a_task_registration, context => {
|
|
441
|
-
const id = TaskId.create();
|
|
442
|
-
let result: ScenarioCommandResult;
|
|
443
|
-
|
|
444
|
-
beforeAll(async () => {
|
|
445
|
-
result = await context.scenario.execute({ id, title: new TaskTitle('Plan release') });
|
|
446
|
-
});
|
|
447
|
-
afterAll(async () => { await context.scenario.dispose(); });
|
|
448
|
-
|
|
449
|
-
it('should succeed through the command pipeline', () => { result.shouldBeSuccessful(); });
|
|
450
|
-
}));
|
|
451
|
-
```
|
|
375
|
+
`CommandScenario` from `@cratis/arc.testing` runs a command through the real pipeline in-process, without a listener. Register fakes on `scenario.services` before the first call, create one context per `describe` (act in `beforeAll`, dispose in `afterAll`), and specify authorization for three callers — anonymous, without the role, with it — and on `validate()` too.
|
|
452
376
|
|
|
453
|
-
- `CommandScenario
|
|
454
|
-
artifacts the command needs; it cannot discover classes that were never
|
|
455
|
-
imported.
|
|
456
|
-
- Register fakes on `scenario.services` **before** the first call.
|
|
457
|
-
`extend(builder => ...)` installs builder setup such as generated metadata.
|
|
458
|
-
- `execute(values)` runs everything; `validate(values)` stops before
|
|
459
|
-
`provide()`/`handle()`. `withContext({ principal, tenantId, correlationId })`
|
|
460
|
-
sets a trusted caller.
|
|
461
|
-
- `given(Context, ...)` creates **one** context per `describe`: act in
|
|
462
|
-
`beforeAll`, dispose in `afterAll`. A disposed scenario cannot run again.
|
|
463
|
-
- Assertions on the result: `shouldBeSuccessful()`, `shouldNotBeSuccessful()`,
|
|
464
|
-
`shouldBeValid()`, `shouldHaveValidationErrors()`,
|
|
465
|
-
`shouldHaveValidationErrorForMember(member)`, `shouldHaveValidationErrorFor(text)`,
|
|
466
|
-
`shouldHaveValidationErrorBecauseOf(reason)`, `shouldBeAuthorized()`,
|
|
467
|
-
`shouldNotBeAuthorized()`, `shouldHaveExceptions()`, `shouldNotHaveExceptions()`.
|
|
468
|
-
Do not assert presentation text by default; assert exact wording only when it
|
|
469
|
-
is the specified behavior, named in the fact. A text-matching helper alone
|
|
470
|
-
does not prove exact equality; compare the actual message when equality is
|
|
471
|
-
the requirement.
|
|
472
|
-
- Specify authorization for three callers — anonymous, without the role, with
|
|
473
|
-
it — and on `validate()` too.
|
|
377
|
+
Read [references/command-specifications.md](references/command-specifications.md) when writing a `CommandScenario` spec, choosing result assertions, or setting up the scenario context.
|
|
474
378
|
|
|
475
379
|
Folder and naming conventions for specs are `cratis-specifications-typescript`.
|
|
476
380
|
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Returning Chronicle events from an Arc for TypeScript command
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Register the integration
|
|
6
|
+
- What `handle()` may return
|
|
7
|
+
- The event source
|
|
8
|
+
- Routing defaults and concurrency
|
|
9
|
+
- Rejections and the batch
|
|
10
|
+
- Read current state in the command
|
|
11
|
+
- Reactors that return commands
|
|
12
|
+
- Specify it without a kernel
|
|
13
|
+
|
|
3
14
|
Verified against `Cratis/Arc.TypeScript` `main` at commit `94d398d` (tag
|
|
4
15
|
`v0.33.0` plus three commits): `Documentation/chronicle/**`,
|
|
5
16
|
`Documentation/testing/chronicle.md`, `Source/Chronicle/index.ts`, and
|
|
@@ -88,11 +99,6 @@ sample's `UniqueAuthorName` does).
|
|
|
88
99
|
exception, because Arc cannot tell what was stored.
|
|
89
100
|
- An SDK `eventLog.append(...)` inside `handle()` is outside the batch. Return
|
|
90
101
|
events instead.
|
|
91
|
-
- Appending and projecting are separate: a query sent right after the command
|
|
92
|
-
may not see the event yet. Prefer an observable query on the client.
|
|
93
|
-
`completionTimeoutMs` makes the command wait for observers, but Chronicle waits
|
|
94
|
-
for **every** observer on the log (Cratis/Chronicle#4132), so a projection or
|
|
95
|
-
reactor that does not handle the event makes every command time out with 500.
|
|
96
102
|
|
|
97
103
|
## Read current state in the command
|
|
98
104
|
|
|
@@ -136,6 +142,3 @@ await scenario.dispose();
|
|
|
136
142
|
6.14.0 or later).
|
|
137
143
|
- `shouldHaveAppendedEvent` does not check count or order — assert
|
|
138
144
|
`appendedEvents` when either matters.
|
|
139
|
-
- The in-memory scenario does **not** run projections, aggregates, constraints
|
|
140
|
-
or concurrency checks. `ChronicleKernelScenario` runs against a live kernel at
|
|
141
|
-
`ARC_CHRONICLE_TEST_URL` for those.
|