@cratis/pi 8.5.0 → 8.7.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/harnesses/copilot/instructions/glossary.instructions.md +5 -3
- package/package/corpus/harnesses/copilot/instructions/react.instructions.md +3 -1
- package/package/corpus/harnesses/copilot/instructions/reactors.instructions.md +3 -1
- package/package/corpus/harnesses/copilot/instructions/specs.csharp.instructions.md +6 -3
- package/package/corpus/harnesses/copilot/instructions/vertical-slices.instructions.md +5 -2
- package/package/corpus/rules/glossary.md +5 -3
- package/package/corpus/rules/react.md +3 -1
- package/package/corpus/rules/reactors.md +3 -1
- package/package/corpus/rules/specs.csharp.md +6 -3
- package/package/corpus/rules/vertical-slices.md +5 -2
- package/package/corpus/skills/cratis-application-growth/SKILL.md +1 -2
- package/package/corpus/skills/cratis-application-growth/references/csharp.md +0 -2
- package/package/corpus/skills/cratis-application-growth/references/move-and-untangle.md +1 -2
- package/package/corpus/skills/cratis-application-growth/references/rename-window.md +1 -3
- package/package/corpus/skills/cratis-application-growth/references/service-and-delivery.md +3 -2
- package/package/corpus/skills/cratis-application-growth/references/stages.md +2 -2
- package/package/corpus/skills/cratis-arc-authorize-request/SKILL.md +2 -2
- package/package/corpus/skills/cratis-arc-authorize-request/references/authproxy.md +19 -0
- package/package/corpus/skills/cratis-arc-authorize-request/references/csharp-query-security.md +15 -0
- package/package/corpus/skills/cratis-arc-authorize-request/references/csharp.md +12 -3
- package/package/corpus/skills/cratis-arc-declare-command/SKILL.md +2 -0
- package/package/corpus/skills/cratis-arc-declare-command/references/csharp-chronicle.md +46 -7
- package/package/corpus/skills/cratis-arc-declare-command/references/csharp-controller.md +3 -1
- package/package/corpus/skills/cratis-arc-declare-command/references/csharp-history.md +4 -1
- package/package/corpus/skills/cratis-arc-declare-command/references/csharp.md +31 -4
- package/package/corpus/skills/cratis-arc-declare-command/references/go.md +1 -1
- package/package/corpus/skills/cratis-arc-diagnose-live-query/references/csharp.md +24 -2
- package/package/corpus/skills/cratis-arc-expose-mcp-operation/references/csharp.md +49 -0
- package/package/corpus/skills/cratis-arc-expose-query/SKILL.md +3 -1
- package/package/corpus/skills/cratis-arc-expose-query/references/csharp.md +27 -4
- package/package/corpus/skills/cratis-arc-generate-proxies/SKILL.md +1 -0
- package/package/corpus/skills/cratis-arc-generate-proxies/references/csharp.md +49 -2
- package/package/corpus/skills/cratis-arc-generate-proxies/references/typescript.md +9 -0
- package/package/corpus/skills/cratis-arc-host-application/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-host-application/references/csharp-configuration.md +54 -0
- package/package/corpus/skills/cratis-arc-host-application/references/csharp-deployment.md +98 -0
- package/package/corpus/skills/cratis-arc-host-application/references/csharp-http.md +9 -1
- package/package/corpus/skills/cratis-arc-host-application/references/csharp-identity.md +84 -2
- package/package/corpus/skills/cratis-arc-host-application/references/csharp.md +2 -0
- package/package/corpus/skills/cratis-arc-invoke-command/references/csharp.md +2 -1
- package/package/corpus/skills/cratis-arc-isolate-tenant/SKILL.md +18 -1
- package/package/corpus/skills/cratis-arc-page-query/references/csharp.md +2 -0
- package/package/corpus/skills/cratis-arc-react-bind-slice/SKILL.md +18 -16
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-commands.md +8 -3
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-host.md +84 -16
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-identity.md +22 -2
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-instant-feedback.md +81 -0
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-localization.md +80 -0
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-navigation.md +103 -0
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-queries.md +40 -1
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-structure.md +117 -0
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript.md +7 -3
- package/package/corpus/skills/cratis-arc-react-separate-view-model/SKILL.md +3 -3
- package/package/corpus/skills/cratis-arc-react-separate-view-model/references/typescript.md +27 -6
- package/package/corpus/skills/cratis-arc-validate-command/references/csharp-rules.md +23 -2
- package/package/corpus/skills/cratis-arc-validate-command/references/csharp.md +28 -2
- package/package/corpus/skills/cratis-authproxy-configure/SKILL.md +136 -0
- package/package/corpus/skills/cratis-authproxy-configure/references/admission.md +125 -0
- package/package/corpus/skills/cratis-authproxy-configure/references/aspire.md +154 -0
- package/package/corpus/skills/cratis-authproxy-configure/references/operations.md +122 -0
- package/package/corpus/skills/cratis-authproxy-configure/references/services-and-routing.md +114 -0
- package/package/corpus/skills/cratis-authproxy-configure/references/sessions-and-logout.md +126 -0
- package/package/corpus/skills/cratis-authproxy-configure/references/sign-in-providers.md +116 -0
- package/package/corpus/skills/cratis-authproxy-configure/references/tenant-resolution.md +135 -0
- package/package/corpus/skills/cratis-choreography-run-workflow/SKILL.md +117 -0
- package/package/corpus/skills/cratis-choreography-run-workflow/references/csharp-chronicle.md +164 -0
- package/package/corpus/skills/cratis-choreography-run-workflow/references/csharp.md +354 -0
- package/package/corpus/skills/cratis-chronicle-cli-operations/SKILL.md +2 -2
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/project-tooling.md +28 -0
- package/package/corpus/skills/cratis-chronicle-connect-application/references/csharp-services.md +13 -2
- package/package/corpus/skills/cratis-chronicle-connect-application/references/csharp.md +12 -0
- package/package/corpus/skills/cratis-chronicle-connect-application/references/kotlin.md +2 -0
- package/package/corpus/skills/cratis-chronicle-connect-application/references/typescript.md +10 -1
- package/package/corpus/skills/cratis-chronicle-constrain-append/SKILL.md +8 -1
- package/package/corpus/skills/cratis-chronicle-constrain-append/references/csharp.md +35 -3
- package/package/corpus/skills/cratis-chronicle-constrain-append/references/go.md +1 -1
- package/package/corpus/skills/cratis-chronicle-constrain-append/references/operations.md +70 -0
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/SKILL.md +2 -0
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/configuration.md +27 -0
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/container-and-kubernetes.md +293 -0
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/kernel-options.md +13 -6
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/network-and-tls.md +45 -0
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/storage.md +91 -1
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/upgrade-and-recovery.md +9 -0
- package/package/corpus/skills/cratis-chronicle-evolve-event/SKILL.md +12 -0
- package/package/corpus/skills/cratis-chronicle-inspect-observer/SKILL.md +11 -1
- package/package/corpus/skills/cratis-chronicle-inspect-observer/references/csharp.md +1 -1
- package/package/corpus/skills/cratis-chronicle-project-view/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-fluent.md +14 -3
- package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-model-bound.md +3 -0
- package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-reading.md +3 -2
- package/package/corpus/skills/cratis-chronicle-project-view/references/csharp.md +23 -0
- package/package/corpus/skills/cratis-chronicle-project-view/references/elixir.md +1 -0
- package/package/corpus/skills/cratis-chronicle-project-view/references/go.md +2 -1
- package/package/corpus/skills/cratis-chronicle-project-view/references/java.md +2 -0
- package/package/corpus/skills/cratis-chronicle-project-view/references/kotlin.md +1 -0
- package/package/corpus/skills/cratis-chronicle-project-view/references/typescript.md +1 -1
- package/package/corpus/skills/cratis-chronicle-protect-decision/SKILL.md +2 -0
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp-scopes.md +40 -3
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp.md +20 -2
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/elixir.md +7 -0
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/go.md +9 -1
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/java.md +8 -0
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/kotlin.md +9 -0
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/typescript.md +7 -0
- package/package/corpus/skills/cratis-chronicle-protect-personal-data/references/csharp.md +24 -1
- package/package/corpus/skills/cratis-chronicle-publish-contract/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-publish-contract/references/csharp.md +41 -0
- package/package/corpus/skills/cratis-chronicle-publish-contract/references/webhook-signature-wire-format.md +82 -0
- package/package/corpus/skills/cratis-chronicle-react-to-fact/SKILL.md +17 -0
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp-outputs.md +3 -1
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp.md +35 -2
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/elixir.md +11 -0
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/java.md +1 -0
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/kotlin.md +1 -0
- package/package/corpus/skills/cratis-chronicle-record-event/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-record-event/references/csharp-coordination.md +31 -2
- package/package/corpus/skills/cratis-chronicle-record-event/references/csharp-history.md +21 -4
- package/package/corpus/skills/cratis-chronicle-record-event/references/csharp.md +20 -2
- package/package/corpus/skills/cratis-chronicle-record-event/references/go.md +1 -1
- package/package/corpus/skills/cratis-chronicle-record-event/references/java.md +1 -1
- package/package/corpus/skills/cratis-chronicle-record-event/references/kotlin.md +3 -0
- package/package/corpus/skills/cratis-chronicle-reduce-state/SKILL.md +2 -1
- package/package/corpus/skills/cratis-chronicle-reduce-state/references/csharp.md +3 -1
- package/package/corpus/skills/cratis-chronicle-reduce-state/references/java.md +10 -1
- package/package/corpus/skills/cratis-chronicle-reduce-state/references/kotlin.md +10 -1
- package/package/corpus/skills/cratis-chronicle-reduce-state/references/typescript.md +27 -5
- package/package/corpus/skills/cratis-chronicle-select-client/SKILL.md +18 -0
- package/package/corpus/skills/cratis-chronicle-select-client/references/elixir.md +21 -1
- package/package/corpus/skills/cratis-chronicle-select-client/references/go.md +13 -0
- package/package/corpus/skills/cratis-chronicle-select-client/references/java.md +15 -0
- package/package/corpus/skills/cratis-chronicle-select-client/references/kotlin.md +15 -0
- package/package/corpus/skills/cratis-chronicle-select-client/references/typescript.md +16 -0
- package/package/corpus/skills/cratis-code-review/references/csharp-diagnostics.md +28 -2
- package/package/corpus/skills/cratis-code-review/references/csharp.md +1 -1
- package/package/corpus/skills/cratis-components-accessibility/SKILL.md +6 -8
- package/package/corpus/skills/cratis-components-accessibility/references/typescript.md +32 -14
- package/package/corpus/skills/cratis-components-build-canvas/SKILL.md +4 -3
- package/package/corpus/skills/cratis-components-build-canvas/references/typescript-props.md +1 -1
- package/package/corpus/skills/cratis-components-build-canvas/references/typescript.md +4 -2
- package/package/corpus/skills/cratis-components-choose-control/SKILL.md +13 -7
- package/package/corpus/skills/cratis-components-choose-control/references/from-primereact.md +116 -0
- package/package/corpus/skills/cratis-components-choose-control/references/menu.md +90 -0
- package/package/corpus/skills/cratis-components-choose-control/references/typescript-composition.md +48 -0
- package/package/corpus/skills/cratis-components-choose-control/references/typescript.md +2 -2
- package/package/corpus/skills/cratis-components-compose-toolbar/SKILL.md +2 -1
- package/package/corpus/skills/cratis-components-compose-toolbar/references/floating-toolbar.md +146 -0
- package/package/corpus/skills/cratis-components-diagnose-screen/SKILL.md +102 -0
- package/package/corpus/skills/cratis-components-display-list/SKILL.md +10 -10
- package/package/corpus/skills/cratis-components-display-list/references/typescript-custom-panel.md +74 -0
- package/package/corpus/skills/cratis-components-display-list/references/typescript-datatables.md +2 -7
- package/package/corpus/skills/cratis-components-display-list/references/typescript.md +3 -2
- package/package/corpus/skills/cratis-components-submit-form/references/typescript-commandform.md +72 -2
- package/package/corpus/skills/cratis-components-submit-form/references/typescript.md +5 -3
- package/package/corpus/skills/cratis-components-theme-application/SKILL.md +17 -15
- package/package/corpus/skills/cratis-components-theme-application/references/localization.md +166 -0
- package/package/corpus/skills/cratis-components-theme-application/references/typescript.md +18 -14
- package/package/corpus/skills/cratis-components-theme-application/references/upgrade-from-previous-major.md +141 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/SKILL.md +2 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/csharp-domain-philosophy.md +31 -3
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/csharp-fundamentals-helpers.md +119 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/csharp.md +4 -0
- package/package/corpus/skills/cratis-fundamentals-concept/references/csharp-serialization.md +70 -0
- package/package/corpus/skills/cratis-fundamentals-concept/references/csharp.md +8 -0
- package/package/corpus/skills/cratis-fundamentals-concept/references/go.md +1 -0
- package/package/corpus/skills/cratis-fundamentals-concept/references/typescript-serialization.md +33 -0
- package/package/corpus/skills/cratis-fundamentals-name-value/references/csharp.md +2 -1
- package/package/corpus/skills/cratis-fundamentals-type-discovery/references/csharp-diagnostics.md +5 -0
- package/package/corpus/skills/cratis-fundamentals-type-discovery/references/go-dependency-injection.md +3 -0
- package/package/corpus/skills/cratis-modeling-design-event-model/SKILL.md +6 -4
- package/package/corpus/skills/cratis-modeling-design-event-model/references/command-inventory.md +7 -1
- package/package/corpus/skills/cratis-modeling-design-event-model/references/model-first.md +13 -1
- package/package/corpus/skills/cratis-modeling-design-event-model/references/review-one-slice.md +6 -0
- package/package/corpus/skills/cratis-multi-service-local-orchestration/SKILL.md +6 -6
- package/package/corpus/skills/cratis-multi-service-local-orchestration/references/csharp-aspire.md +116 -28
- package/package/corpus/skills/cratis-multi-service-local-orchestration/references/docker-compose.md +2 -2
- package/package/corpus/skills/cratis-observability/references/chronicle-kernel-export.md +46 -0
- package/package/corpus/skills/cratis-orleans-jobs/SKILL.md +4 -2
- package/package/corpus/skills/cratis-platform-build-application/SKILL.md +8 -0
- package/package/corpus/skills/cratis-platform-build-application/references/cratis-identity.md +71 -0
- package/package/corpus/skills/cratis-platform-build-application/references/studio-repository.md +96 -0
- package/package/corpus/skills/cratis-platform-deliver-slice/SKILL.md +14 -8
- package/package/corpus/skills/cratis-platform-deliver-slice/references/csharp.md +167 -3
- package/package/corpus/skills/cratis-platform-deliver-slice/references/eventual-consistency.md +150 -0
- package/package/corpus/skills/cratis-platform-diagnose-slice/SKILL.md +1 -1
- package/package/corpus/skills/cratis-platform-start-application/SKILL.md +21 -0
- package/package/corpus/skills/cratis-platform-start-application/references/csharp.md +77 -3
- package/package/corpus/skills/cratis-platform-upgrade-application/SKILL.md +118 -0
- package/package/corpus/skills/cratis-platform-upgrade-application/references/csharp.md +117 -0
- package/package/corpus/skills/cratis-platform-upgrade-application/references/java.md +53 -0
- package/package/corpus/skills/cratis-platform-upgrade-application/references/kotlin.md +53 -0
- package/package/corpus/skills/cratis-platform-upgrade-application/references/typescript.md +71 -0
- package/package/corpus/skills/cratis-screenplay-accept-model/references/csharp.md +29 -0
- package/package/corpus/skills/cratis-screenplay-accept-model/references/read-the-evidence.md +82 -1
- package/package/corpus/skills/cratis-screenplay-declare-slice/SKILL.md +1 -1
- package/package/corpus/skills/cratis-screenplay-declare-slice/references/structure-and-imports.md +10 -0
- package/package/corpus/skills/cratis-screenplay-onboard-workspace/SKILL.md +5 -4
- package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/cli.md +19 -2
- package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/smallest-model.md +87 -0
- package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/typescript.md +13 -0
- package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/workspace-mcp.md +5 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/SKILL.md +2 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-colocated.md +101 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-command-results.md +3 -1
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-decision-reads.md +1 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-events.md +1 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-integration.md +4 -2
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-reactors.md +3 -3
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp.md +34 -1
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/elixir.md +2 -0
- package/package/corpus/skills/cratis-specifications-isolate-behavior/SKILL.md +1 -1
- package/package/corpus/skills/cratis-specifications-isolate-behavior/references/csharp-running.md +10 -3
- package/package/corpus/skills/cratis-specifications-test-application-ui/references/typescript.md +22 -4
- package/package/corpus/skills/cratis-specifications-test-typescript-behavior/SKILL.md +2 -1
- package/package/corpus/skills/cratis-specifications-test-typescript-behavior/references/typescript.md +40 -0
- package/package/profile-catalog.json +15 -0
- package/package.json +1 -1
|
@@ -49,7 +49,7 @@ Done when exactly one root is named and no other `.play` files sit beneath it un
|
|
|
49
49
|
|
|
50
50
|
Use this when the root has no `.play` files. If it already has some, the application exists. Skip to the next task (`cratis-screenplay-declare-slice` for new behaviour).
|
|
51
51
|
|
|
52
|
-
1. Run `screenplay version`. If the command is missing, install it with `dotnet tool install --global Cratis.Screenplay.Tool`, which needs
|
|
52
|
+
1. Run `screenplay version`. If the command is missing, install it with `dotnet tool install --global Cratis.Screenplay.Tool`, which needs the .NET 11 SDK and the global .NET tool folder on `PATH`. Without .NET, use the Docker image or the Cratis CLI (see Connect an MCP server).
|
|
53
53
|
2. Create `<root>/application.play` with this content:
|
|
54
54
|
|
|
55
55
|
```play
|
|
@@ -62,7 +62,7 @@ Use this when the root has no `.play` files. If it already has some, the applica
|
|
|
62
62
|
4. Run `screenplay test <root>`. With no specifications yet, expect `passed: 0 discovered` and exit `0`. Exit `3` means the model did not bind (or execution was unsupported): read the diagnostics before going on. This only proves that the workspace loads. It says nothing about business behaviour.
|
|
63
63
|
|
|
64
64
|
Without the .NET tool, run the same checks through Docker: `docker run --rm -v "<absolute root>:/work:ro" cratis/screenplay /work`, and `... cratis/screenplay test /work`.
|
|
65
|
-
5. Commit `application.play`. Next, declare the first slice from the agreed timeline (`cratis-screenplay-declare-slice`).
|
|
65
|
+
5. Commit `application.play`. Next, declare the first slice from the agreed timeline (`cratis-screenplay-declare-slice`); see the [smallest complete model](references/smallest-model.md).
|
|
66
66
|
|
|
67
67
|
If systems reference extensions, run `screenplay restore <root>` before standalone validation, tests or export. Those commands reject unpinned or unrestored contracts.
|
|
68
68
|
|
|
@@ -139,7 +139,7 @@ For an isolated saved file, VS Code **Screenplay: Migrate document** asks for th
|
|
|
139
139
|
Toolchain and hosting:
|
|
140
140
|
|
|
141
141
|
- `screenplay version` (or `--version`), `screenplay help`: identify the installed compiler; show usage.
|
|
142
|
-
- `dotnet tool install --global Cratis.Screenplay.Tool` / `dotnet tool update --global Cratis.Screenplay.Tool`: install or update the standalone tool (needs the
|
|
142
|
+
- `dotnet tool install --global Cratis.Screenplay.Tool` / `dotnet tool update --global Cratis.Screenplay.Tool`: install or update the standalone tool (needs the .NET 11 SDK).
|
|
143
143
|
- `cratis/screenplay` Docker image: the same program without a local .NET.
|
|
144
144
|
- `cratis version`: the Cratis CLI's bundled compiler version.
|
|
145
145
|
- `code --install-extension cratis.screenplay`: VS Code board and diagnostics beside the source.
|
|
@@ -174,6 +174,7 @@ File directives:
|
|
|
174
174
|
## References
|
|
175
175
|
|
|
176
176
|
- `references/<language>.md` for the project's SDK (`.csproj` → csharp, Node server `package.json` → typescript, `*.kt` → kotlin, `*.java` → java, `go.mod` → go, `mix.exs` → elixir; only the project's languages are installed): read it to embed the compiler in your own tool or host a `.play` editor in a web page.
|
|
177
|
-
- [Command selection and flags](references/cli.md): read it for standalone and Cratis CLI options, delivery commands
|
|
177
|
+
- [Command selection and flags](references/cli.md): read it for standalone and Cratis CLI options, migration versions, delivery commands, desktop integration verbs and VS Code editor defaults.
|
|
178
|
+
- [Smallest complete model](references/smallest-model.md): read it for one slice that compiles and passes its specifications.
|
|
178
179
|
- [Workspace request catalog](references/workspace-mcp.md): read it for the arguments, views and paging of each workspace MCP tool.
|
|
179
180
|
- [Exchange a model with Studio](references/studio.md): read it before importing into, exporting from or Git-syncing a Studio board.
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
# Screenplay command selection
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Commands
|
|
6
|
+
- Desktop integration
|
|
7
|
+
- VS Code extension
|
|
8
|
+
|
|
3
9
|
Every command of the standalone `screenplay` tool, with the skill that teaches it. Where a path is optional, it defaults to the current folder. A folder compiles as one application. A file compiles with the documents it imports.
|
|
4
10
|
|
|
11
|
+
## Commands
|
|
12
|
+
|
|
5
13
|
Compile the root first, then run the specifications. A successful compile does not prove executable binding or target admission.
|
|
6
14
|
|
|
7
15
|
- **Compile and gate the model:** `screenplay [<file.play|folder>]`. Exit `0` means clean, `1` means model defects, `2` means the check could not run. Taught by `cratis-screenplay-accept-model`.
|
|
@@ -23,8 +31,8 @@ Compile the root first, then run the specifications. A successful compile does n
|
|
|
23
31
|
- `--source <directory>`: choose a package directory instead of `SCREENPLAY_EXTENSION_SOURCE`.
|
|
24
32
|
- `--vendor`: copy restored extension contracts into the model's vendor cache for distribution.
|
|
25
33
|
- **Move source forward across retired forms:** `screenplay migrate <file.play|folder>`.
|
|
26
|
-
- `--from <source-major>`: required
|
|
27
|
-
- `--to <target-major>`: select the target explicitly only when required by the migration.
|
|
34
|
+
- `--from <source-major>`: required, because a file does not record the version it was written for. Only the major counts: `5`, `5.11` and `v5.11.0` all mean 5. No step starts before 5, so a model written for Screenplay 4 or earlier uses `--from 5`; `--from 4` is refused.
|
|
35
|
+
- `--to <target-major>`: defaults to the language major the installed compiler reads, which is not the tool's package version (`screenplay --version`); select the target explicitly only when required by the migration. Migrations only move forward: a `--to` below `--from` is refused.
|
|
28
36
|
- `--dry-run`: compute changes without rewriting the model.
|
|
29
37
|
- `--report <file>`: write the reviewable report, including during a dry run.
|
|
30
38
|
- **Inspect the language and tool contract:** `screenplay contract`; `--output <path>` writes it to a file for tooling.
|
|
@@ -86,3 +94,12 @@ Use the `cratis screenplay desktop` branch for user-level integration; the match
|
|
|
86
94
|
- `install` and `update`: `--clients claude,chatgpt` selects clients; `--model-root <dir>` registers an existing physical folder for ChatGPT; `--dry-run` previews the install or update. For Claude, name the folder in the conversation after approving the extension in the app.
|
|
87
95
|
- `status`: `--clients` selects clients. Inspect registration or handoff and update availability; verify the integration is enabled in the host itself.
|
|
88
96
|
- `uninstall`: `--clients` selects clients; `--dry-run` previews removal. Remove or disable the host-owned extension or plugin in the app as well.
|
|
97
|
+
|
|
98
|
+
## VS Code extension
|
|
99
|
+
|
|
100
|
+
For `.play` files, the extension (`cratis.screenplay`) changes two editor defaults, so that suggestions come from the Screenplay language service:
|
|
101
|
+
|
|
102
|
+
- **GitHub Copilot inline suggestions are off.** To bring them back, add `"github.copilot.enable": { "screenplay": true }` to the VS Code settings.
|
|
103
|
+
- **Word-based suggestions are off.**
|
|
104
|
+
|
|
105
|
+
In Restricted Mode (an untrusted workspace), the board and local language assistance still work. Typed repairs never run: they need workspace trust and explicit User settings. Until the workspace is trusted, VS Code also ignores workspace overrides of `screenplay.sourceRoot`, the `screenplay.repairs.*` settings and `screenplay.verdicts.onSave`. A source-root override can point outside the workspace, so review it before granting trust.
|
package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/smallest-model.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Smallest complete model
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- When to use it
|
|
6
|
+
- The model
|
|
7
|
+
- Prove it
|
|
8
|
+
- What each part is for
|
|
9
|
+
- Avoid
|
|
10
|
+
|
|
11
|
+
## When to use it
|
|
12
|
+
|
|
13
|
+
Use it as the shape of a first slice, or to prove that a new toolchain compiles, gates and runs specifications end to end. It is one module, one feature and one `StateChange` slice: a command with one rule, the event it produces, a screen that issues the command, and one accepted and one refused specification. Names are illustrative.
|
|
14
|
+
|
|
15
|
+
It is not a starting template for a real application. Real slices come from the agreed timeline (`cratis-screenplay-declare-slice`).
|
|
16
|
+
|
|
17
|
+
## The model
|
|
18
|
+
|
|
19
|
+
Save it as `<root>/application.play` in a fresh, empty root: the expected output below holds only there. The first two lines are the root directives from the default path.
|
|
20
|
+
|
|
21
|
+
To adapt it into an existing application, keep that application's entry point and root directives, and move `concept PlotId` together with the module: the module does not compile without it. The file and specification counts then cover the whole loaded model, not these two specifications.
|
|
22
|
+
|
|
23
|
+
```play
|
|
24
|
+
reaction batches atomic
|
|
25
|
+
command reads protected
|
|
26
|
+
|
|
27
|
+
concept PlotId : Uuid
|
|
28
|
+
|
|
29
|
+
module Greenhouse
|
|
30
|
+
feature Watering
|
|
31
|
+
slice StateChange ScheduleWatering
|
|
32
|
+
command ScheduleWatering
|
|
33
|
+
plotId PlotId identifier
|
|
34
|
+
minutes Int
|
|
35
|
+
validate
|
|
36
|
+
minutes > 0 message "Minutes must be positive"
|
|
37
|
+
produces WateringScheduled
|
|
38
|
+
for plotId
|
|
39
|
+
minutes = minutes
|
|
40
|
+
|
|
41
|
+
event WateringScheduled
|
|
42
|
+
minutes Int
|
|
43
|
+
|
|
44
|
+
screen WateringPlan
|
|
45
|
+
action ScheduleWatering for screen
|
|
46
|
+
|
|
47
|
+
specification SchedulingTenMinutes
|
|
48
|
+
when ScheduleWatering
|
|
49
|
+
plotId = "11111111-1111-4111-8111-111111111111"
|
|
50
|
+
minutes = 10
|
|
51
|
+
then WateringScheduled
|
|
52
|
+
for "11111111-1111-4111-8111-111111111111"
|
|
53
|
+
minutes = 10
|
|
54
|
+
|
|
55
|
+
specification RefusingZeroMinutes
|
|
56
|
+
when ScheduleWatering
|
|
57
|
+
plotId = "11111111-1111-4111-8111-111111111111"
|
|
58
|
+
minutes = 0
|
|
59
|
+
then error "Minutes must be positive"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Indentation is the structure. Indent with spaces: a tab reports warning `PLAY0006`.
|
|
63
|
+
|
|
64
|
+
## Prove it
|
|
65
|
+
|
|
66
|
+
Run both commands on the fresh root, in this order:
|
|
67
|
+
|
|
68
|
+
1. `screenplay <root> --warnaserror --no-gate-file`. `--no-gate-file` keeps the run independent of a `screenplay.json` in a folder above the root: a fresh subfolder inherits the nearest one up to the repository boundary, and an inherited scope that this model lacks makes the check exit `2`. Expect `1 file(s) compiled - 0 error(s), 0 warning(s)` and exit `0`.
|
|
69
|
+
2. `screenplay test <root>`. Expect a `passed:` line for each of the two specifications, the summary `2 discovered, 2 selected, 2 executed; 2 passed, 0 failed, 0 unsupported` and exit `0`.
|
|
70
|
+
|
|
71
|
+
The test run also prints information `PLAY0269` for the screen: screens are deferred from the backend executable model by default and enter it only when explicitly admitted (`screenplay export --format esm --screens`, or the `screens` argument of an MCP executable-model read). It is not a failure.
|
|
72
|
+
|
|
73
|
+
Without the .NET tool, run the same two commands, with the same flags, through the Docker image, as in the skill's default path.
|
|
74
|
+
|
|
75
|
+
## What each part is for
|
|
76
|
+
|
|
77
|
+
- **`plotId PlotId identifier` and `for plotId`**: the identifier names the event source, and `for` appends the event there. The event does not repeat the identifier as a property.
|
|
78
|
+
- **`produces` mappings**: every event property is mapped explicitly (`minutes = minutes`); nothing is copied by name.
|
|
79
|
+
- **`validate` with `message`**: the rule the command promises. `RefusingZeroMinutes` expects exactly that message.
|
|
80
|
+
- **`screen` with `action … for screen`**: something that issues the command. Without it, the command reports warning `PLAY0533` and step 1 exits `1`.
|
|
81
|
+
- **Two specifications**: one accepted case that states the destination (`for`) and every event property, and one refusal for the rule. More shapes: `cratis-screenplay-specify-outcome`.
|
|
82
|
+
|
|
83
|
+
## Avoid
|
|
84
|
+
|
|
85
|
+
- Removing the screen, or dropping `--warnaserror`, to get a clean run. Model how the command is issued (`cratis-screenplay-model-interaction`).
|
|
86
|
+
- Treating a passing run as an accepted model. It proves that the model compiles and that these two scenarios hold; the executable and target verdicts belong to `cratis-screenplay-accept-model`.
|
|
87
|
+
- Keeping the `Greenhouse` names in a real model.
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Use `@cratis/screenplay-language` when a web page must host a Monaco editor for `.play` text. It gives highlighting, completions, hover and diagnostics in the browser, with no .NET process. For editing on a developer machine, install the VS Code extension instead (see the skill's catalog).
|
|
4
4
|
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
- Register the language
|
|
8
|
+
- What the editor checks
|
|
9
|
+
- Highlight a construct of your own (edge case)
|
|
10
|
+
- Read a model from TypeScript tooling
|
|
11
|
+
|
|
5
12
|
## Register the language
|
|
6
13
|
|
|
7
14
|
```typescript
|
|
@@ -43,3 +50,9 @@ registerSubLanguage('workflow', {
|
|
|
43
50
|
- It can be called before or after `register(monaco)`.
|
|
44
51
|
|
|
45
52
|
This is a reading aid only. It does not add the construct to the language: the compiler still reports an unknown construct keyword inside a slice as warning `PLAY0029` and skips its body, and rejects one anywhere else.
|
|
53
|
+
|
|
54
|
+
## Read a model from TypeScript tooling
|
|
55
|
+
|
|
56
|
+
`@cratis/screenplay-language` is the only Screenplay package on npm. The Screenplay documentation also describes a TypeScript compiler, `@cratis/screenplay-compiler` (`parse`, `parseFolder`, visitors), and `@cratis/screenplay-event-models` (`toEventModelDocument`). Both are private packages inside the Screenplay repository: `npm install` cannot resolve them, so never add them to an application's dependencies.
|
|
57
|
+
|
|
58
|
+
To read a model from a Node script or build step, run the `screenplay` tool and parse its output: `screenplay <root> --format json` for diagnostics, `screenplay export <root> --format esm|openapi|ui` for the model's contracts (options in [command selection](cli.md)). The TypeScript compiler parses and reports part of the validation, but it cannot bind or execute a model. The `screenplay` check is the source-validation gate either way; `screenplay export <root> --format esm` proves that the model binds, and `screenplay test <root>` executes its specifications.
|
package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/workspace-mcp.md
CHANGED
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
Use `open-workspace` before reading or proposing. Reopening or switching the workspace discards outstanding proposals on that connection.
|
|
16
16
|
|
|
17
17
|
- `path`: select an admitted physical model root; use it for a multi-root client or a registered Git worktree of the startup root.
|
|
18
|
+
- **Another checkout:** when the server started with a root, another checkout of that repository is admitted only as a registered Git worktree (or the main checkout, when the server started in a linked worktree). Pass the worktree's checkout folder or its model folder; the server opens the same relative model folder there. Any other folder returns `RootChangeRefused`, with one exception: the model folder beside a code folder described below, which is admitted by its location alone and is not checked for Git membership.
|
|
19
|
+
- **Checkouts that cannot be verified:** the switch to another checkout is refused for submodules and checkouts created with `--separate-git-dir`. Per-worktree configuration (`extensions.worktreeConfig` or a `config.worktree` file) refuses a switch to or from the main checkout; it is not checked when both the startup root and the requested root are registered linked worktrees. When a switch is refused, start a separate server connection rooted at that checkout's model instead.
|
|
20
|
+
- **A model folder beside a code folder:** when the startup root is a folder named `Source` or `src` that holds no model yet (no `.play` files at its top or one level down, no `.screenplay` state), `path` may name a folder beside it that is missing, empty, or already holds `.play` files or `.screenplay` state. This needs no Git worktree, so a server started on a project's `src` can open `Screenplay` next to it.
|
|
18
21
|
- `applicationName`: name an uninitialized application instead of inheriting the folder name; must match the persisted name when identities already exist.
|
|
19
22
|
- `workspaceJson`: reopen the canonical snapshot from `export-workspace` against matching disk documents. It cannot replace a different persisted catalog or document mapping.
|
|
20
23
|
- `includeContent`: opt into inline snapshot and diagnostics when the workspace is small; page larger content instead.
|
|
@@ -79,6 +82,8 @@ If `InvalidIdentityMigration` returns `identityMigrationIssues`, use its typed a
|
|
|
79
82
|
- `production-destination-identities`: review the identities newly enrolled by that repair.
|
|
80
83
|
- `expectedRepairEvidenceRevision`: carry the evidence pin for a proposal tied to pinned repair evidence.
|
|
81
84
|
|
|
85
|
+
Host hints: `apply` and `recover-workspace` report `readOnlyHint: false` and `destructiveHint: true`; every other tool reports `readOnlyHint: true` and `destructiveHint: false`, and all tools report `openWorldHint: false`. The server adds no confirmation parameter, so the host must ask for approval before these two calls. A recovery journal makes a write recoverable, not non-destructive.
|
|
86
|
+
|
|
82
87
|
Use `workspace-state` with the same `proposalId` to inspect identity-state changes separately from document bytes. Use `discard-proposal` with `proposalId` to drop the plan. `apply` needs approval, `proposalId`, `expectedRevision` and `expectedCatalogRevision` from the original base. Optionally send `expectedReleaseBaselineRevision` to pin the reviewed release baseline, `expectedRepairEvidenceRevision` for a pinned repair, or `includeContent` for inline snapshots of a small apply. The server verifies disk bytes and identities again; a stale plan must be rebuilt and reviewed. A journal enables recovery, not instant all-file visibility during a write.
|
|
83
88
|
|
|
84
89
|
## Read the current workspace
|
|
@@ -207,4 +207,6 @@ Where supported: append events and read the nodes and edges graph projections bu
|
|
|
207
207
|
|
|
208
208
|
Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Node server `package.json` → typescript, `*.kt` → kotlin, `*.java` → java, `go.mod` → go, `mix.exs` → elixir); only the project's languages are installed.
|
|
209
209
|
|
|
210
|
+
- `references/csharp-colocated.md`: read when a C# application project compiles its specs beside its slices instead of in a separate spec project (project setup, Release exclusion, how to run them).
|
|
211
|
+
|
|
210
212
|
Python has no Cratis application SDK or testing kit: write the spec in the service that owns the command, query or event, and reach that behavior from Python only through the service's HTTP API.
|
package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-colocated.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Keep C# specs beside their slices
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- When this applies
|
|
6
|
+
- Where the files go
|
|
7
|
+
- Project setup
|
|
8
|
+
- Run the specs
|
|
9
|
+
- Common mistakes
|
|
10
|
+
|
|
11
|
+
Names in the examples are illustrative; the application's own domain language replaces them.
|
|
12
|
+
|
|
13
|
+
## When this applies
|
|
14
|
+
|
|
15
|
+
- **Default for a new application:** a separate spec project whose folders mirror the slice path. Nothing in this reference is needed there.
|
|
16
|
+
- **This reference:** the application project already compiles its specs beside its slices. Keep that layout and extend it; do not add a separate spec project for the in-process specs of such an application.
|
|
17
|
+
- **Running-kernel specs:** a separate project is the default in both layouts, so unit and filtered runs never start infrastructure. Where the application already keeps a co-located running-kernel tier, keep it isolated instead: its own namespaces, outside the in-process spec namespaces, and a runner filter that selects the in-process specs alone (see Run the specs).
|
|
18
|
+
|
|
19
|
+
Apart from that, do not mix the two layouts in one application.
|
|
20
|
+
|
|
21
|
+
## Where the files go
|
|
22
|
+
|
|
23
|
+
- The spec folders sit inside the slice folder: `for_<Unit>/` holding `when_<behaviour>.cs` files (or `when_<behaviour>/` folders with one file per case), and `given/` for reusable contexts.
|
|
24
|
+
- The namespace is the slice's namespace plus the folder: `Library.Lending.Borrowing.for_BorrowBook` for specs of the `Borrowing` slice.
|
|
25
|
+
- Every spec source file lies under a `for_*`, `when_*` or `given` folder. The Release exclusion matches those folder names, not file names, so a `when_*.cs` file placed directly in the slice folder still compiles in Release and breaks that build.
|
|
26
|
+
- Spec support that is not a spec (collection definitions, a web application factory) goes in a folder the project also excludes in Release, such as a root `Specs/` folder. Place those files directly in that folder when its exclusion is `./Specs/*.cs`, which matches direct children only; nested support folders need `Specs/**/*.cs` instead.
|
|
27
|
+
- A `.http` file beside the slice is a convenience for manual calls. It is not a specification and proves nothing.
|
|
28
|
+
|
|
29
|
+
## Project setup
|
|
30
|
+
|
|
31
|
+
An application with this layout already has the three parts below, which keep everything test-related out of a Release build. Keep them intact and extend them; do not introduce them into an application that has a separate spec project.
|
|
32
|
+
|
|
33
|
+
```xml
|
|
34
|
+
<ItemGroup Condition="'$(Configuration)' == 'Release'">
|
|
35
|
+
<Compile Remove="**/when_*/**/*.cs" />
|
|
36
|
+
<Compile Remove="**/for_*/**/*.cs" />
|
|
37
|
+
<Compile Remove="**/given/**/*.cs" />
|
|
38
|
+
<Compile Remove="./Specs/*.cs" />
|
|
39
|
+
</ItemGroup>
|
|
40
|
+
|
|
41
|
+
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
|
|
42
|
+
<XunitAutoGeneratedEntryPoint>false</XunitAutoGeneratedEntryPoint>
|
|
43
|
+
</PropertyGroup>
|
|
44
|
+
|
|
45
|
+
<ItemGroup Condition="'$(Configuration)' == 'Debug'">
|
|
46
|
+
<PackageReference Include="xunit.v3.mtp-off" />
|
|
47
|
+
<PackageReference Include="NSubstitute" />
|
|
48
|
+
<PackageReference Include="Cratis.Specifications" />
|
|
49
|
+
<PackageReference Include="Cratis.Specifications.XUnit.v3" />
|
|
50
|
+
<PackageReference Include="Cratis.Arc.Chronicle.Testing" />
|
|
51
|
+
<PackageReference Include="Cratis.Chronicle.Testing" />
|
|
52
|
+
</ItemGroup>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
1. **Release removes the spec sources from compilation.** One `Compile Remove` per spec folder pattern, plus the spec-support folder when the project has one.
|
|
56
|
+
2. **The runner, the specification packages, the testing packages and the substitute library are referenced only in Debug.** Add `Cratis.Chronicle.XUnit.Integration.v3` to the same group when the project holds running-kernel specs ([csharp-integration.md](csharp-integration.md)). Use the runner packages the project already has.
|
|
57
|
+
3. **The runner's generated entry point is turned off** (`XunitAutoGeneratedEntryPoint` set to `false`), because the application is an executable that owns its entry point.
|
|
58
|
+
|
|
59
|
+
Global usings for spec namespaces go inside `#if DEBUG`, in the same file as the application's other global usings:
|
|
60
|
+
|
|
61
|
+
```csharp
|
|
62
|
+
#if DEBUG
|
|
63
|
+
global using Cratis.Arc.Chronicle.Testing.Commands;
|
|
64
|
+
global using Cratis.Arc.Testing.Commands;
|
|
65
|
+
global using Cratis.Specifications;
|
|
66
|
+
global using NSubstitute;
|
|
67
|
+
global using Xunit;
|
|
68
|
+
#endif
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
When the application host references the Chronicle testing package this way, the rules in "When the application host references the testing package" in [csharp.md](csharp.md) apply.
|
|
72
|
+
|
|
73
|
+
## Run the specs
|
|
74
|
+
|
|
75
|
+
With the generated entry point off, the application's own entry point starts the runner. Use the invocation the application already defines. The usual form is a Debug-only branch at the top of `Program.cs` that hands the remaining arguments to the xUnit console runner:
|
|
76
|
+
|
|
77
|
+
```csharp
|
|
78
|
+
#if DEBUG
|
|
79
|
+
if (args.FirstOrDefault() == "--specifications")
|
|
80
|
+
{
|
|
81
|
+
return await Xunit.Runner.InProc.SystemConsole.ConsoleRunner.Run(args[1..]);
|
|
82
|
+
}
|
|
83
|
+
#endif
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Because this branch returns a value, the entry point ends with `return 0;` after the host has run.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
dotnet build <App>.csproj --configuration Debug
|
|
90
|
+
dotnet run --project <App>.csproj --configuration Debug --no-build -- --specifications
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
- Arguments after the switch go to the xUnit runner. For example, `-class "*.for_*"` runs only the classes whose full name contains `.for_`. When specs that need a running kernel live in other namespaces, that filter runs the in-process specs alone.
|
|
94
|
+
- Always build and run in Debug. A Release build contains no specs, so it cannot run any.
|
|
95
|
+
- After adding specs, also build once in Release to prove the application still compiles without them.
|
|
96
|
+
|
|
97
|
+
## Common mistakes
|
|
98
|
+
|
|
99
|
+
- A separate spec project added to an application that already keeps specs beside its slices.
|
|
100
|
+
- A spec file outside the excluded folders, or application code that uses a type declared in a spec folder: the Release build fails.
|
|
101
|
+
- A testing namespace imported without `#if DEBUG`, or a test package referenced in every configuration: the Release build fails or ships test code.
|
|
@@ -111,7 +111,9 @@ result.ShouldBeAuthorized();
|
|
|
111
111
|
| `CommandAuthorization.For<TCommand>(services, principal, command)` | Evaluate with a command instance, for policies that read it |
|
|
112
112
|
| `CommandAuthorization.ForContext<TCommand>(services, principal, context)` | Evaluate with a prepared `CommandContext` |
|
|
113
113
|
| `ShouldBeAuthorized()` / `ShouldBeDenied()` | The caller satisfies / fails the declaration |
|
|
114
|
-
| `ShouldBeUnsupported()` | The boundary cannot be evaluated standalone,
|
|
114
|
+
| `ShouldBeUnsupported()` | The boundary cannot be evaluated standalone; `ReasonCode` says why. Prove through `CommandScenario`: a command behind an availability gate (`availability-gate`), `[RequiresApproval]` (`approval-required`), a custom command filter (`custom-filter`), and a refusal raised while resolving a read-model key (`read-model-key-resolution`). Prove through the HTTP host: a named authentication scheme or an active request (`host-required`). An unregistered policy (`invalid-configuration`) is a defect: correct the declaration or the policy registration. Unsupported is not a denial |
|
|
115
|
+
|
|
116
|
+
The check does not evaluate tenant-membership verification: when the provider has tenant membership registered and no earlier check has already stopped the evaluation, the outcome is Unsupported with `tenant-membership`; prove that boundary through the HTTP host.
|
|
115
117
|
|
|
116
118
|
The result also exposes `Outcome` (`Authorized`, `Denied`, `Unsupported`), `ReasonCode` (set when unsupported) and a `Message` safe to print. Use it for a matrix of roles and policies across commands; keep one pipeline scenario per command to prove authorization actually gates execution.
|
|
117
119
|
|
|
@@ -36,6 +36,7 @@ A command that declares read protection, `[ProtectedDecision]`, a `DecisionRead<
|
|
|
36
36
|
|
|
37
37
|
- Seed with `_scenario.Given.ForEventSource(id).Events(...)`. `_scenario.EventScenario` throws in this mode.
|
|
38
38
|
- Give the command state and assert the outcome. Do not invent sequence numbers or decision tokens, and do not simulate a concurrent writer: the guard itself is the framework's behavior, already covered there.
|
|
39
|
+
- Let Arc complete a protected command's unit of work: the command returns its events. Calling `Commit()` or `Rollback()` on that unit of work directly fails with `ProtectedUnitOfWorkRequiresOwner`. An aggregate root's own `Commit()` is narrower than it looks. Arc completes it as the owner only when read protection is on and the aggregate belongs to that command's own unit of work, not to a unit inherited from an outer command. Otherwise it is a direct completion, which fails the same way once protected reads have enrolled in the unit. A command executing as an occurrence effect refuses any early commit. Where the aggregate commit applies, read first and return that `Commit()` last; in every other case return the events.
|
|
39
40
|
- `EnableDecisionReads()` exists only for an untyped `CommandScenario<object>` that executes protected commands; call it before seeding. A typed scenario needs no switch.
|
|
40
41
|
- `AppendConcurrently(source, events)` (or `(source, route, events)`) queues competing events to append after the handler reads and before the commit. It is hidden from editor completion and exists to verify the framework's concurrency handling; use it only when the task explicitly asks to prove a guard against an interleaved writer, then assert `ShouldHaveValidationErrorBecauseOf(ValidationResultReason.ConcurrencyViolation)` and that nothing was appended. Queue it before the first `Execute`.
|
|
41
42
|
|
package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-events.md
CHANGED
|
@@ -26,6 +26,7 @@ result.ShouldHaveConstraintViolation("UniqueCarrierName");
|
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
- Assert the specific channel: `ShouldHaveConstraintViolation(name)`, `ShouldHaveConcurrencyViolations()` or `ShouldHaveErrors()`. `ShouldBeFailed()` alone accepts any of them.
|
|
29
|
+
- A refused append has no position: `result.SequenceNumber` is `EventSequenceNumber.Unavailable`. Assert the refusal channel, never a sequence number, for a refusal.
|
|
29
30
|
- `When...Events(a, b)` appends one event at a time and stops at the first rejection. It **does not roll back the events already accepted**. To prove an atomic batch, call `AppendMany` on `scenario.EventLog` and assert its result.
|
|
30
31
|
- Assertions on `scenario.EventLog`, such as `ShouldHaveTailSequenceNumber(...)` and `ShouldHaveAppendedEvent<T>(...)`, return `Task`. Await them.
|
|
31
32
|
|
|
@@ -26,6 +26,7 @@ Use the xUnit fixtures from `Cratis.Chronicle.XUnit.Integration.v3`; a project o
|
|
|
26
26
|
|
|
27
27
|
- `ChronicleInProcessFixture` hosts the kernel in the test process with MongoDB in a container. Start with it.
|
|
28
28
|
- `ChronicleOutOfProcessFixture` runs the kernel in a separate container. Use it when the promise depends on the kernel being a separate process.
|
|
29
|
+
- `ChronicleOrleansFixture` exists for testing Chronicle's own internals. Application specs use one of the two fixtures above.
|
|
29
30
|
- Register a consumer-owned xUnit collection: for an in-process suite, define `ChronicleCollection : ICollectionFixture<ChronicleInProcessFixture>` with `[CollectionDefinition(Name)]`, where `Name` is a constant unique to the collection. Put `[Collection(ChronicleCollection.Name)]` on the spec class. If using a custom fixture, register that type instead.
|
|
30
31
|
- `UsesPerContextMongoDBHost` defaults to `false`. Override it on a collection fixture derived from `ChronicleInProcessFixture` and register that fixture for the collection; every context in that collection then gets a fresh host and unique database prefix. The default storage configuration applies the prefix. If the client fixture overrides `GetStorageConfigurator`, pass its `DatabaseNamePrefix` to `WithMongoDB` as `databaseNamePrefix` so contexts do not share storage. One host per context adds startup cost; the switch does not isolate out-of-process or remote kernels.
|
|
31
32
|
- A context's `EventTypes`, `Reactors` and other artifact overrides need no extra isolation: the shared in-process host switches to the current context's lists and rediscovers them. `ChronicleOptions.ExplicitArtifacts` is different. Configure it before the fixture host starts: a store snapshots it when the store is created, and by default every class deriving from the same closed `ChronicleClientFixture<TChronicleFixture>` shares one host, so a store that host already created ignores later changes. Another context class over the same `TChronicleFixture` argument is not enough. To give a context different `ExplicitArtifacts`, close the client fixture over a different `TChronicleFixture` type, or run it in a collection whose fixture overrides `UsesPerContextMongoDBHost => true`; a store created on a new host takes its own snapshot.
|
|
@@ -73,7 +74,7 @@ public class when_holding_a_parcel(a_held_parcel context) : Given<a_held_parcel>
|
|
|
73
74
|
- Assert a collected append with `ShouldHaveEvent<PickupScheduled>(e => e.Depot.ShouldEqual("depot-4"))` and `ShouldBeSuccessful()`.
|
|
74
75
|
- To act through the application's HTTP surface, call `await client.ExecuteCommand(route, command)` on the fixture's `HttpClient` and assert the returned `CommandResult`.
|
|
75
76
|
|
|
76
|
-
When the repository keeps specs inside the application assembly, follow its convention
|
|
77
|
+
When the repository keeps specs inside the application assembly, follow its convention for keeping them out of release builds ([csharp-colocated.md](csharp-colocated.md)). A dedicated spec project needs no such exclusion.
|
|
77
78
|
|
|
78
79
|
## Fixture and context members
|
|
79
80
|
|
|
@@ -82,7 +83,7 @@ When the repository keeps specs inside the application assembly, follow its conv
|
|
|
82
83
|
| `Specification<TFixture>(fixture)` | Context base hosting the application's client in process |
|
|
83
84
|
| `Specification<TFixture, TFactory, TStartup>(fixture)` | Context base that hosts the application through its own web application factory and startup |
|
|
84
85
|
| `Given<TSetup>` with `Context` | Share one initialized context class across spec classes as an xUnit class fixture |
|
|
85
|
-
| `AutoDiscoverArtifacts` | `true` by default; override to `false` and list artifacts explicitly |
|
|
86
|
+
| `AutoDiscoverArtifacts` | `true` by default; override to `false` and list artifacts explicitly. This turns off assembly discovery only: explicit nominations and automatic client registration stay. `ChronicleOptions.AutoDiscoverAndRegister = false` is a different switch, which leaves both discovery and registration to the caller |
|
|
86
87
|
| `EventTypes`, `EventSources`, `EventTypeMigrators`, `EventSeeders` | Override to name the event artifacts this context registers |
|
|
87
88
|
| `Projections`, `ModelBoundProjections`, `Reducers` | Read-model artifacts |
|
|
88
89
|
| `GraphElements`, `GraphProjections`, `GraphViews` | Graph artifacts |
|
|
@@ -123,6 +124,7 @@ The in-process fixture's MongoDB image can be replaced with the `CHRONICLE_MONGO
|
|
|
123
124
|
|
|
124
125
|
Failures raised by the fixtures themselves:
|
|
125
126
|
|
|
127
|
+
- A container that cannot be started: the fixture retries only a start the container runtime rejects with an API error or that times out; any other start failure surfaces at once as its own exception. When the retries are exhausted it throws `InvalidOperationException` naming the image and the number of attempts. The exit code and the last container log lines are included only when they could be read, and a failure to rebuild the container between attempts surfaces the original start exception instead. It is an environment fault: check the container runtime and that message first; do not treat it as a spec timeout.
|
|
126
128
|
- `InvalidWebApplicationFactory`: the factory given to `Specification<TFixture, TFactory, TStartup>` lacks a public constructor taking exactly `(IChronicleSetupFixture fixture, ContentRoot contentRoot)`. Derive the factory from `ChronicleWebApplicationFactory<TStartup>` and declare that constructor with those two parameters only, whatever the exception text lists.
|
|
127
129
|
- `ContentRootNotFound`: no project file exists at or above the test assembly.
|
|
128
130
|
- `KernelProcessExited`: the kernel container stopped. The stock fixtures above do not raise it; it only comes from a fixture that monitors its kernel container. Every later context then reports the same failure: read its exit code and markers, fix the cause, rerun.
|
package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-reactors.md
CHANGED
|
@@ -55,7 +55,7 @@ A green `ReactorScenario` does not prove the application registers or subscribes
|
|
|
55
55
|
| --- | --- |
|
|
56
56
|
| `new ReactorScenario<TReactor>()` | Activate the reactor from `Services`; optional arguments supply a service provider, side-effect handlers or an event store, and a leading `Defaults` |
|
|
57
57
|
| `new ReactorScenario<TReactor>(services => ...)` | Register dependencies inline |
|
|
58
|
-
| `new ReactorScenario(reactorId, defaults)` | A reactor declared without a class; the same `Given` and `Redeliver` apply |
|
|
58
|
+
| `new ReactorScenario(reactorId, defaults)` | A reactor declared without a class; the same `Given` and `Redeliver` apply. The constructor does not validate the identifier: the first delivery throws `UnknownReactorId` when the identifier has no explicit fluent definition in the scenario's event store |
|
|
59
59
|
| `Given.ForEventSource(id).OnStream(eventSourceType, eventStreamType, eventStreamId)` | Deliver with the stream coordinates production would carry |
|
|
60
60
|
| `.Events(...)` | Deliver each event once |
|
|
61
61
|
| `.History(event)` / `.History(first, second)` | Record without delivering; returns `RecordedOccurrence` (`Event`, `Context`) values for `Redeliver` |
|
|
@@ -123,8 +123,8 @@ scenario.ShouldHaveAppended<ImportCompleted>();
|
|
|
123
123
|
|
|
124
124
|
The assertions are synchronous and read collected state; after mutating outside a delivery, await `StatusOf(id)` first.
|
|
125
125
|
|
|
126
|
-
For a handler or command spec that only needs a context, build one: `new OccurrenceContextBuilder().For<ImportRequested>().WithIdempotencyId("import-42").BuildDetached()`. A detached context owns no lease. For a real lease use `await new OccurrenceContextBuilder(store.Time).For<ImportRequested>().WithIdempotencyId("import-42").RecordAndClaimIn(store)`. Further builder steps: `ForTrigger(id)`, `WithId`, `Kind`, `RecordedAt`, `DueAt`, `Attempt`, `Epoch`. `RecordAndClaimIn` throws `OccurrenceContextCannotBeClaimed` unless attempt and epoch are at least 1 and the store holds no occurrence for that trigger yet; use a fresh store.
|
|
126
|
+
For a handler or command spec that only needs a context, build one: `new OccurrenceContextBuilder().For<ImportRequested>().WithIdempotencyId("import-42").BuildDetached()`. A detached context owns no lease: receipts still deduplicate, but completing its lease returns `OccurrenceLeaseLost`. `For<T>()` throws `TriggerNotValid` when `T` has no `[Trigger]` attribute, and `OccurrenceScenario<THandler>` throws it when the handler does not implement exactly one `IOccurrenceHandler<TTrigger>` or that trigger type lacks the attribute. For a real lease use `await new OccurrenceContextBuilder(store.Time).For<ImportRequested>().WithIdempotencyId("import-42").RecordAndClaimIn(store)`. Further builder steps: `ForTrigger(id)`, `WithId`, `Kind`, `RecordedAt`, `DueAt`, `Attempt`, `Epoch`. `RecordAndClaimIn` throws `OccurrenceContextCannotBeClaimed` unless attempt and epoch are at least 1 and the store holds no occurrence for that trigger yet; use a fresh store.
|
|
127
127
|
|
|
128
|
-
**Older store (edge case).** `EventStoreForTesting.Capabilities` selects what the in-memory store advertises: `Current()` (default), `Old()` (no optional capabilities) or `Unknown()` (compatibility check skipped or failed). After `scenario.EventStore.Capabilities.Old()` or `Unknown()`, capability-gated operations fail closed, for example `unit.UseEffectReceipt(key)` throws `EffectReceiptsNotSupported`. Use it only to prove how the application reacts to such a store.
|
|
128
|
+
**Older store (edge case).** `EventStoreForTesting.Capabilities` selects what the in-memory store advertises: `Current()` (default), `Old()` (no optional capabilities) or `Unknown()` (compatibility check skipped or failed). After `scenario.EventStore.Capabilities.Old()` or `Unknown()`, capability-gated operations fail closed, for example `unit.UseEffectReceipt(key)` throws `EffectReceiptsNotSupported`. Use it only to prove how the application reacts to such a store. Event schemas are discovered when the store is constructed, so switching afterwards changes which operations are admitted, not the schemas already discovered. To choose the advertisement before discovery, create a `KernelCapabilitiesForTesting`, call `Old()` or `Unknown()` on it, and pass it to the store: `new EventStoreForTesting(null, artifacts, null, new ScenarioTime(), capabilities)`, where `artifacts` is the `IClientArtifactsProvider`.
|
|
129
129
|
|
|
130
130
|
The scenario replaces the background delivery shell with explicit calls. Restart, clustering and storage durability need a running store.
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
## Contents
|
|
4
4
|
|
|
5
5
|
- Setup
|
|
6
|
+
- What to prove per slice type
|
|
6
7
|
- Default path: refuse an invalid command
|
|
7
8
|
- Common mistakes
|
|
8
9
|
- Command scenario
|
|
@@ -37,6 +38,36 @@ Names in the examples are illustrative; the application's own domain language re
|
|
|
37
38
|
|
|
38
39
|
Write specs with `Cratis.Specifications` and the runner package the repository already uses (for xUnit, `Cratis.Specifications.XUnit.v3`): `Establish`, `Because`, `Destroy` and `should_` facts.
|
|
39
40
|
|
|
41
|
+
Versions:
|
|
42
|
+
|
|
43
|
+
- Match `Cratis.Chronicle.Testing` to the application's Chronicle client release, and use Arc testing packages compatible with the application's Arc packages.
|
|
44
|
+
- Arc and Chronicle have independent release numbers. Do not make the numbers equal; the Arc dependency that `Cratis.Chronicle.Testing` release declares is the minimum, and the application's Arc release must be that version or a compatible newer one. With the `Cratis` meta package, check its dependencies the same way.
|
|
45
|
+
- `Cratis.Chronicle.Testing` brings `Cratis.Arc` and `Cratis.Arc.Core`, so a Chronicle-only spec project needs no Arc reference.
|
|
46
|
+
- To move Arc to a compatible newer release, pin `Cratis.Arc` and `Cratis.Arc.Core` to one version in `Directory.Packages.props` and reference both in the spec project, or enable `CentralPackageTransitivePinningEnabled` there. Align the other Arc runtime packages with it, never go below the versions the testing package declares, and rerun the scenarios.
|
|
47
|
+
|
|
48
|
+
Where the specs live: a separate spec project by default. When the application project already compiles its specs beside its slices, follow [csharp-colocated.md](csharp-colocated.md).
|
|
49
|
+
|
|
50
|
+
### When the application host references the testing package
|
|
51
|
+
|
|
52
|
+
This happens when specs are compiled into the application project.
|
|
53
|
+
|
|
54
|
+
- Register the Chronicle client as usual; the order relative to Arc does not matter. In a host that only runs the client, kernel commands and queries stay out of the application's Arc endpoints, and the application's own commands, queries and authorization policies are unchanged. A container that also hosts the kernel, such as the in-process silo of the xUnit fixtures, keeps them: the kernel dispatches its own work through Arc.
|
|
55
|
+
- Register a custom `ICommandHandlerProvider` or `IQueryPerformerProvider` as an individual implementation. Do not replace the `IInstancesOf<ICommandHandlerProvider>` or `IInstancesOf<IQueryPerformerProvider>` collection: that is refused at client registration when the replacement is already present, or at host startup when it is added afterwards.
|
|
56
|
+
|
|
57
|
+
## What to prove per slice type
|
|
58
|
+
|
|
59
|
+
Each row lists the proofs a slice of that type needs; follow the link for how to write them.
|
|
60
|
+
|
|
61
|
+
| Slice type | Prove | Read |
|
|
62
|
+
| --- | --- | --- |
|
|
63
|
+
| State Change | Each decision branch: call `Handle()` directly when the decision can be invoked without the pipeline, otherwise go through `CommandScenario`. The accepted outcome through `CommandScenario`, with the exact appended event and its event source. One case per refusal, asserting its kind; for a refusal before commit, also that nothing was appended. | [csharp-command-results.md](csharp-command-results.md) |
|
|
64
|
+
| State View | The read model through `ReadModelScenario` for each event, key, join, child collection and removal. The query through `QueryScenario` when it filters, pages or authorizes; a query restricted to a named authentication scheme fails closed there, so prove that one in an HTTP-hosted spec. | [csharp-read-models.md](csharp-read-models.md), [csharp-query-scenario.md](csharp-query-scenario.md) |
|
|
65
|
+
| Automation | A reactor that returns its events or commands: `ReactorScenario`, asserting what it produced, and the same event delivered twice. With its default recording handlers the scenario records what the reactor returned and does not execute it, so prove the outside effect separately. Explicit side-effect handlers passed to the constructor replace the recorder and may execute what the reactor returns; assert against those handlers then. A reactor that executes commands through an injected `ICommandPipeline`: call the handler with a substituted pipeline; assert the commands issued, and for each kind of unsuccessful result whether the handler throws or tolerates it, as its code decides. | [csharp-reactors.md](csharp-reactors.md) |
|
|
66
|
+
| Translation | Call the handler directly: filtered input issues nothing, accepted input maps field by field, and each kind of unsuccessful result throws or is tolerated as the handler's code decides. Add specs against a running kernel for the two repeats, which are different cases: the same input arriving again through the real adapter, and Chronicle retrying an event whose command succeeded before the reactor acknowledged it. Without them, report delivery and the outside system as unproven. | [csharp-reactors.md](csharp-reactors.md), [csharp-integration.md](csharp-integration.md) |
|
|
67
|
+
| Screen | Each decision the screen makes. | `cratis-specifications-test-application-ui` |
|
|
68
|
+
|
|
69
|
+
A reactor that calls the command pipeline is not failed by an unsuccessful result unless its own code throws on it, so which results it throws on and which it tolerates is behaviour to prove.
|
|
70
|
+
|
|
40
71
|
## Default path: refuse an invalid command
|
|
41
72
|
|
|
42
73
|
Seed another registration so earlier history is distinguishable from this command’s work.
|
|
@@ -95,7 +126,7 @@ Await every assertion that returns `Task`. Chronicle's analyzer reports a Cratis
|
|
|
95
126
|
|
|
96
127
|
## Common mistakes
|
|
97
128
|
|
|
98
|
-
- Preserve existing placement and any `#if DEBUG` guards when extending co-located specs; a new case does not need a new project.
|
|
129
|
+
- Preserve existing placement and any `#if DEBUG` guards when extending co-located specs; a new case does not need a new project. See [csharp-colocated.md](csharp-colocated.md).
|
|
99
130
|
- An unauthorized caller never proves a validation rule. Give that case the required role; exercise denial separately.
|
|
100
131
|
- Command and query Chronicle givens are synchronous; read-model scenario event givens return a task.
|
|
101
132
|
|
|
@@ -103,6 +134,8 @@ Await every assertion that returns `Task`. Chronicle's analyzer reports a Cratis
|
|
|
103
134
|
|
|
104
135
|
`CommandScenario<TCommand>` (namespace `Cratis.Arc.Testing.Commands`): `Services`, `Execute(command)`, `Validate(command)`, `LastResult`, `Operations`, `Context`, `WithPrincipal`, `WithClaims`, `Unauthenticated`, `Tenant`, `Clock`, `PinGeneratedValue`, `AllowGeneration`, `GeneratedValues`. Details and false greens: [csharp-command-results.md](csharp-command-results.md).
|
|
105
136
|
|
|
137
|
+
The scenario's service provider is local to the scenario: it never replaces the process-wide provider an Arc host sets. Code that reads that process-wide provider directly, such as the MongoDB and EF Core `Observe()` query extensions, therefore does not see `scenario.Services`; it uses the running host's provider, or throws `ServiceProviderNotConfigured` when no host has set one. Prove such code through the HTTP host ([csharp-integration.md](csharp-integration.md)).
|
|
138
|
+
|
|
106
139
|
## Command result assertions
|
|
107
140
|
|
|
108
141
|
`ShouldBeSuccessful`, `ShouldNotBeSuccessful`, `ShouldBeValid`, `ShouldHaveValidationErrors`, `ShouldHaveValidationErrorFor(message)`, `ShouldHaveValidationErrorBecauseOf(reason)`, `ShouldHaveConstraintViolationFor(name)`, `ShouldBeRejected([reason])` (a concurrency conflict is `ShouldHaveValidationErrorBecauseOf(ValidationResultReason.ConcurrencyViolation)`), `ShouldBeAuthorized`, `ShouldNotBeAuthorized`, `ShouldBeDenied`, `ShouldHaveExceptions`, `ShouldNotHaveExceptions`, and the operation assertions `ShouldHaveExecutedOperation<T>`, `ShouldHaveCompensatedOperation<T>`, `ShouldHaveNoOperationInvocations`. See [csharp-command-results.md](csharp-command-results.md).
|
|
@@ -21,6 +21,8 @@ Module, event and constraint names below (`Rooms.*`, `BookRoom`, `RoomBooked`, `
|
|
|
21
21
|
|
|
22
22
|
The harnesses ship inside the `cratis_arc` and `cratis_chronicle` libraries; no separate test package. Every scenario starts a real Chronicle client against Chronicle's in-memory kernel: appends, constraints (`:unique`, `:unique_event_type`), every concurrency-scope dimension and sequence numbers are real; reactors and reducers run synchronously after each committed append.
|
|
23
23
|
|
|
24
|
+
The in-memory kernel models appends, reads, concurrency scopes and the two uniqueness constraints. An operation it does not model is answered with `{:error, {:not_supported_in_memory, rpc}}`: most prominently read-model and projection queries, and also copying events from one event source to another within a sequence, and compensation. `closes_stream` constraints are the exception: they are dropped without an error, so an append to a closed stream is not rejected by `closes_stream`; the modelled constraints and the concurrency scope can still reject it. Prove those against a running kernel with the integration helper (see Running kernel and HTTP host).
|
|
25
|
+
|
|
24
26
|
Specs are `.exs` scripts beside the code, named `for_<unit>/when_<behavior>/<and|with|without>_<condition>.exs`, each case `test "should ..."`. Point Mix at them:
|
|
25
27
|
|
|
26
28
|
```elixir
|
|
@@ -148,7 +148,7 @@ Analyzers ship with the library and run by default. Fix the cause; lower one rul
|
|
|
148
148
|
|
|
149
149
|
### Project, runner and run options (see `references/csharp-running.md`)
|
|
150
150
|
|
|
151
|
-
- **Framework adapter:** exactly one package for xUnit (the default for a new project), NUnit or TUnit. Match the runner the project already uses.
|
|
151
|
+
- **Framework adapter:** exactly one package for xUnit (the default for a new project), NUnit or TUnit; xUnit and NUnit have a separate package per major. Match the runner and major the project already uses. xUnit generates its framework registration; remove a hand-written duplicate.
|
|
152
152
|
- **Native runner:** no third-party framework, with compile-time discovery, facts found by name, parallel classes and concurrent facts. Choose it for a new suite that needs fast startup or documentation reports. It does not support parameterized cases, framework fixtures, traits or categories, or a per-fact lifecycle.
|
|
153
153
|
- **Select by tree path (native):** the assembly, namespace, class and fact code names, with wildcards.
|
|
154
154
|
- **Select by identifier (native):** one class or fact by its stable identifier; unsupported filter types fail instead of running everything.
|
package/package/corpus/skills/cratis-specifications-isolate-behavior/references/csharp-running.md
CHANGED
|
@@ -20,11 +20,15 @@ Reference exactly one specification package. Each brings `Cratis.Specifications`
|
|
|
20
20
|
| Package | Also reference | Use when |
|
|
21
21
|
| --- | --- | --- |
|
|
22
22
|
| `Cratis.Specifications.XUnit.v3` | `xunit.v3.mtp-off`, `Microsoft.NET.Test.Sdk`, `xunit.runner.visualstudio` (or the MTP-enabled `xunit.v3`); set `OutputType` to `Exe` | Default for a new spec project |
|
|
23
|
-
| `Cratis.Specifications.
|
|
23
|
+
| `Cratis.Specifications.XUnit` | `Microsoft.NET.Test.Sdk`, `xunit.runner.visualstudio` | The project already runs xUnit v2 |
|
|
24
|
+
| `Cratis.Specifications.NUnit5` | `Microsoft.NET.Test.Sdk`, `NUnit3TestAdapter` | The project already runs NUnit 5 |
|
|
25
|
+
| `Cratis.Specifications.NUnit` | `Microsoft.NET.Test.Sdk`, `NUnit3TestAdapter` | The project already runs NUnit 4 |
|
|
24
26
|
| `Cratis.Specifications.TUnit` | `TUnit` | The project already runs TUnit |
|
|
25
27
|
| `Cratis.Specifications.Runner` | Nothing | A suite without a third-party framework; see Native runner |
|
|
26
28
|
|
|
27
|
-
Follow an existing spec project before choosing. The xUnit packages generate the framework registration
|
|
29
|
+
Follow an existing spec project before choosing, and match the major version of the xUnit or NUnit it already runs. The xUnit packages generate the framework registration, except where the project turns off both the shared lifecycle and readable names or generates no assembly attributes (see Project switches). Where it is generated, remove a hand-written `[assembly: Xunit.TestFramework(...)]`, or the build fails with `CS0579`.
|
|
30
|
+
|
|
31
|
+
The current packages target `net10.0` and `net11.0` only. Only the spec project has to target one of them; the projects it tests keep their own target frameworks.
|
|
28
32
|
|
|
29
33
|
## Default project: xUnit
|
|
30
34
|
|
|
@@ -61,7 +65,7 @@ spec='./path/to/Shipping.Specs/bin/Release/<tfm>/Shipping.Specs'
|
|
|
61
65
|
Omit the filter for the full project or use `-method` with the fully qualified fact name. If there is no apphost, launch the built DLL with `dotnet "$spec.dll"` and pass the same arguments. Readable names change the display, not the class and method names used by filters; explicit xUnit display names stay.
|
|
62
66
|
|
|
63
67
|
- **MTP-enabled `xunit.v3`:** run the executable with its own filters, such as `--filter-class` or `--filter-method`; do not pass the standalone xUnit flags.
|
|
64
|
-
- **TUnit or the native runner:** run the executable with that runner's filters.
|
|
68
|
+
- **TUnit or the native runner:** run the executable with that runner's filters. On the .NET 10 and .NET 11 SDKs, `dotnet test` works on these projects only after `global.json` opts in with `"test": { "runner": "Microsoft.Testing.Platform" }` (merged into the existing file, keeping its SDK settings). That setting applies to every test project in the repository, so add it only when all of them run on Microsoft.Testing.Platform; where the repository already has it, use its configured `dotnet test` entry point when required by tooling. In a repository that also has VSTest projects, keep running the executable or `dotnet run --project`, one project at a time.
|
|
65
69
|
- **VSTest projects only**, such as a VSTest-hosted NUnit suite: use `dotnet test path/to/Shipping.Specs --no-build --configuration Release --filter 'FullyQualifiedName~Shipping.for_Tariff.when_pricing_a_parcel'` after building that configuration. Keep the test run project-scoped.
|
|
66
70
|
|
|
67
71
|
## Skip a fact
|
|
@@ -102,6 +106,7 @@ After building, set `spec` to the native runner executable as in Run and select:
|
|
|
102
106
|
| `--specs-slow <ms>` | Slow-phase threshold; implies `--specs-timings` |
|
|
103
107
|
| `--specs-no-color` | No color; `NO_COLOR` does the same |
|
|
104
108
|
| `--report-trx` | Standard TRX report |
|
|
109
|
+
| `--no-progress` | Microsoft.Testing.Platform's own option: drops its live progress line; the runner's output and reports are unchanged |
|
|
105
110
|
|
|
106
111
|
With `dotnet run`, pass these options after `--`: `dotnet run --project Shipping.Specs --configuration Release --no-build -- --shard 2/4`.
|
|
107
112
|
|
|
@@ -123,6 +128,8 @@ MSBuild properties in the spec project. Leave defaults unless a measured need ex
|
|
|
123
128
|
| `CratisSpecificationsPhaseTimingsFile` | unset | JSON file receiving every phase timing at session end |
|
|
124
129
|
| `CratisSpecificationsSharedResources` | `false` | `true` enables leasing from shared resources |
|
|
125
130
|
|
|
131
|
+
Readable names without the shared lifecycle on xUnit: set `CratisSpecificationsSharedLifecycle` to `false` and leave readable names on. Edge case: a project gets no generated registration when it generates no assembly attributes (`GenerateAssemblyInfo` is `false`) or sets both switches to `false`. Where such a project needs the Cratis framework, for example to end the session, register it by hand exactly once, with `[assembly: Xunit.TestFramework(typeof(Cratis.Specifications.SpecificationTestFramework))]` on xUnit v3 or `[assembly: Xunit.TestFramework("Cratis.Specifications.SpecificationTestFramework", "Cratis.Specifications.XUnit")]` on xUnit v2. Without generated assembly attributes, that registration alone means the shared lifecycle with the original display names; add `[assembly: ReadableSpecificationNames]` for readable names and `[assembly: PerFactSpecificationLifecycle]` for a fresh instance per fact (names only takes both). With both switches off and assembly attributes generated, the generated per-fact marker still applies, so the hand-written registration keeps a fresh instance per fact.
|
|
132
|
+
|
|
126
133
|
## Diagnose slow specs
|
|
127
134
|
|
|
128
135
|
Capture a baseline before changing the harness. Phase timings are off by default and additive when enabled. Using the built `xunit.v3.mtp-off` executable from Run and select:
|