@cratis/pi 8.4.1 → 8.6.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/ai-distribution.instructions.md +2 -1
- package/package/corpus/harnesses/copilot/instructions/exit-codes-and-wrappers.instructions.md +1 -1
- 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/scripting.instructions.md +2 -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/hooks/scripts/cratis-guard-secrets.sh +131 -9
- package/package/corpus/rules/ai-distribution.md +2 -1
- package/package/corpus/rules/exit-codes-and-wrappers.md +1 -1
- 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/scripting.md +2 -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 +1 -3
- 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 +3 -3
- package/package/corpus/skills/cratis-arc-authorize-request/references/authproxy.md +47 -3
- package/package/corpus/skills/cratis-arc-authorize-request/references/csharp-query-security.md +18 -3
- package/package/corpus/skills/cratis-arc-authorize-request/references/csharp.md +12 -3
- package/package/corpus/skills/cratis-arc-authorize-request/references/typescript.md +2 -0
- package/package/corpus/skills/cratis-arc-connect-storage/references/csharp.md +1 -0
- package/package/corpus/skills/cratis-arc-connect-storage/references/elixir.md +9 -2
- package/package/corpus/skills/cratis-arc-declare-command/SKILL.md +2 -0
- package/package/corpus/skills/cratis-arc-declare-command/references/csharp-chronicle.md +47 -8
- 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 +6 -3
- package/package/corpus/skills/cratis-arc-declare-command/references/csharp.md +38 -11
- package/package/corpus/skills/cratis-arc-declare-command/references/go.md +1 -1
- package/package/corpus/skills/cratis-arc-declare-operation/references/csharp-abilities.md +2 -2
- package/package/corpus/skills/cratis-arc-declare-operation/references/csharp-recovery.md +6 -4
- package/package/corpus/skills/cratis-arc-declare-operation/references/csharp.md +2 -2
- package/package/corpus/skills/cratis-arc-diagnose-live-query/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-diagnose-live-query/references/csharp.md +29 -7
- package/package/corpus/skills/cratis-arc-diagnose-live-query/references/java.md +1 -1
- package/package/corpus/skills/cratis-arc-diagnose-live-query/references/kotlin.md +1 -1
- package/package/corpus/skills/cratis-arc-expose-mcp-operation/references/csharp-diagnose-tool-call.md +9 -7
- package/package/corpus/skills/cratis-arc-expose-mcp-operation/references/csharp.md +52 -1
- package/package/corpus/skills/cratis-arc-expose-query/SKILL.md +4 -2
- package/package/corpus/skills/cratis-arc-expose-query/references/csharp.md +36 -10
- package/package/corpus/skills/cratis-arc-expose-query/references/go.md +2 -2
- package/package/corpus/skills/cratis-arc-expose-query/references/typescript.md +6 -3
- package/package/corpus/skills/cratis-arc-generate-proxies/SKILL.md +1 -0
- package/package/corpus/skills/cratis-arc-generate-proxies/references/csharp.md +55 -6
- 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 +87 -4
- package/package/corpus/skills/cratis-arc-host-application/references/csharp.md +9 -0
- package/package/corpus/skills/cratis-arc-invoke-command/references/csharp-extensions.md +4 -0
- package/package/corpus/skills/cratis-arc-invoke-command/references/csharp.md +2 -1
- package/package/corpus/skills/cratis-arc-isolate-tenant/SKILL.md +19 -2
- package/package/corpus/skills/cratis-arc-isolate-tenant/references/csharp.md +4 -2
- package/package/corpus/skills/cratis-arc-page-query/references/csharp.md +2 -0
- package/package/corpus/skills/cratis-arc-react-bind-slice/SKILL.md +33 -36
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-commands.md +18 -3
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-host.md +94 -19
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-identity.md +29 -5
- 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 +41 -2
- 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 +8 -4
- 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-testing-typescript/references/typescript.md +2 -2
- 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-arc-validation-typescript/SKILL.md +1 -0
- 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 +6 -6
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/inspection.md +11 -3
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/project-tooling.md +50 -0
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/recovery-and-comparison.md +17 -3
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/setup-and-target.md +8 -2
- 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/python.md +2 -2
- package/package/corpus/skills/cratis-chronicle-connect-application/references/typescript.md +10 -1
- package/package/corpus/skills/cratis-chronicle-constrain-append/SKILL.md +9 -2
- 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 +6 -3
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/configuration.md +113 -16
- 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 +16 -9
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/network-and-tls.md +60 -7
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/storage.md +124 -2
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/upgrade-and-recovery.md +36 -1
- package/package/corpus/skills/cratis-chronicle-evolve-event/SKILL.md +12 -0
- package/package/corpus/skills/cratis-chronicle-evolve-event/references/csharp.md +2 -2
- package/package/corpus/skills/cratis-chronicle-inspect-observer/SKILL.md +15 -5
- package/package/corpus/skills/cratis-chronicle-inspect-observer/references/csharp.md +9 -8
- package/package/corpus/skills/cratis-chronicle-inspect-observer/references/go.md +2 -2
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/deployment.md +1 -1
- package/package/corpus/skills/cratis-chronicle-project-view/SKILL.md +2 -2
- package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-fluent.md +15 -4
- package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-model-bound.md +4 -1
- package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-reading.md +5 -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 +3 -1
- package/package/corpus/skills/cratis-chronicle-project-view/references/kotlin.md +4 -3
- package/package/corpus/skills/cratis-chronicle-project-view/references/typescript.md +3 -1
- package/package/corpus/skills/cratis-chronicle-protect-decision/SKILL.md +3 -1
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp-scopes.md +41 -4
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp.md +22 -4
- 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/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-protect-personal-data/references/csharp.md +28 -3
- package/package/corpus/skills/cratis-chronicle-publish-contract/SKILL.md +7 -6
- package/package/corpus/skills/cratis-chronicle-publish-contract/references/csharp.md +41 -0
- package/package/corpus/skills/cratis-chronicle-publish-contract/references/elixir-integrations.md +3 -3
- 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 +19 -1
- 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-pages.md +1 -1
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp.md +37 -4
- 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 +2 -1
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/kotlin.md +1 -0
- package/package/corpus/skills/cratis-chronicle-record-event/SKILL.md +3 -3
- 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-chronicle-web-workbench/SKILL.md +1 -1
- package/package/corpus/skills/cratis-ci-pipeline-performance/SKILL.md +4 -3
- package/package/corpus/skills/cratis-ci-pipeline-performance/references/publish-pipelines.md +19 -4
- package/package/corpus/skills/cratis-code-review/SKILL.md +6 -2
- package/package/corpus/skills/cratis-code-review/references/csharp-diagnostics.md +28 -2
- package/package/corpus/skills/cratis-code-review/references/csharp.md +4 -4
- package/package/corpus/skills/cratis-commits-and-pull-requests/SKILL.md +6 -38
- package/package/corpus/skills/cratis-commits-and-pull-requests/references/pr-description.md +2 -0
- package/package/corpus/skills/cratis-commits-and-pull-requests/references/pr-labels-and-release.md +5 -4
- package/package/corpus/skills/cratis-commits-and-pull-requests/references/workflow-inputs.md +39 -0
- 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/SKILL.md +6 -6
- package/package/corpus/skills/cratis-components-submit-form/references/typescript-commanddialog.md +21 -1
- 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 +7 -5
- 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 +72 -1
- package/package/corpus/skills/cratis-fundamentals-concept/references/csharp.md +9 -0
- package/package/corpus/skills/cratis-fundamentals-concept/references/go.md +2 -1
- package/package/corpus/skills/cratis-fundamentals-concept/references/java-json.md +3 -2
- package/package/corpus/skills/cratis-fundamentals-concept/references/kotlin-json.md +3 -2
- package/package/corpus/skills/cratis-fundamentals-concept/references/typescript-serialization.md +41 -2
- package/package/corpus/skills/cratis-fundamentals-name-value/SKILL.md +8 -7
- package/package/corpus/skills/cratis-fundamentals-name-value/references/csharp.md +2 -1
- package/package/corpus/skills/cratis-fundamentals-type-discovery/SKILL.md +3 -3
- package/package/corpus/skills/cratis-fundamentals-type-discovery/references/csharp-diagnostics.md +8 -0
- package/package/corpus/skills/cratis-fundamentals-type-discovery/references/csharp.md +2 -2
- 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-deliver-slice/references/typescript.md +14 -1
- package/package/corpus/skills/cratis-platform-diagnose-slice/SKILL.md +1 -1
- package/package/corpus/skills/cratis-platform-prepare-release-pr/SKILL.md +8 -8
- package/package/corpus/skills/cratis-platform-prepare-release-pr/references/product-release-checks.md +16 -2
- 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-release-notes/SKILL.md +1 -1
- package/package/corpus/skills/cratis-release-notes/references/publish-repair.md +6 -3
- package/package/corpus/skills/cratis-screenplay-accept-model/references/csharp.md +34 -3
- package/package/corpus/skills/cratis-screenplay-accept-model/references/read-the-evidence.md +84 -3
- package/package/corpus/skills/cratis-screenplay-declare-slice/SKILL.md +7 -11
- package/package/corpus/skills/cratis-screenplay-declare-slice/references/commands.md +8 -4
- package/package/corpus/skills/cratis-screenplay-declare-slice/references/projections.md +2 -0
- package/package/corpus/skills/cratis-screenplay-declare-slice/references/structure-and-imports.md +29 -1
- package/package/corpus/skills/cratis-screenplay-edit-workspace/SKILL.md +2 -1
- package/package/corpus/skills/cratis-screenplay-edit-workspace/references/mcp-tools.md +1 -1
- package/package/corpus/skills/cratis-screenplay-handoff-slice/references/csharp.md +13 -1
- package/package/corpus/skills/cratis-screenplay-model-translation/SKILL.md +1 -1
- package/package/corpus/skills/cratis-screenplay-model-translation/references/boundary-diagnostics.md +1 -1
- package/package/corpus/skills/cratis-screenplay-onboard-workspace/SKILL.md +30 -51
- 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/studio.md +5 -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-screenplay-specify-outcome/SKILL.md +8 -12
- package/package/corpus/skills/cratis-screenplay-specify-outcome/references/running-mcp.md +12 -0
- package/package/corpus/skills/cratis-screenplay-specify-outcome/references/scenarios.md +2 -2
- 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 +4 -2
- 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 +7 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-integration.md +7 -4
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-reactors.md +18 -5
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-read-models.md +4 -2
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp.md +35 -2
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/elixir.md +2 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/typescript.md +4 -2
- 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/corpus/skills/cratis-stage-render-slice/SKILL.md +6 -0
- package/package/corpus/skills/cratis-stage-render-slice/references/semantic-conformance.md +64 -0
- package/package/profile-catalog.json +15 -0
- package/package.json +1 -1
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
|
|
|
@@ -133,4 +134,10 @@ var other = events.Single(_ => _.Context.SequenceNumber == kept.SequenceNumber);
|
|
|
133
134
|
|
|
134
135
|
- `scenario.Time.Advance(duration)` and `scenario.Time.AdvanceTo(instant)` move the scenario clock forward; `Now` reads it. It starts at 2026-01-01T00:00:00Z, never moves backward (a negative duration or an earlier instant throws `ScenarioTimeCannotMoveBackwards`), and supplies the default occurrence time of appended events and the timestamps of effect receipts. Advancing it never delivers work or fires timers.
|
|
135
136
|
- `new Defaults(artifacts, serviceProvider, options, time)` builds explicit defaults: `artifacts` is an `IClientArtifactsProvider`, for which `InMemoryClientArtifactsProvider` lets a spec list exactly the `EventTypes`, `Projections`, `ModelBoundProjections`, `Reducers`, `Reactors`, `UniqueConstraints` and other artifact types in play. Use it when discovery over the loaded assemblies picks up artifacts the spec must not see, or when several scenarios share one clock. `Defaults.Instance` is the discovered default. A scenario that needs the schema of an event type or generation missing from those artifacts fails with `EventSchemaNotDiscovered`; add that type and generation to the provider.
|
|
137
|
+
- When the code under test checks the store name or namespace, give the test store that identity: `new Defaults(artifacts, serviceProvider, options, time, eventStoreName, namespaceName)` with an `EventStoreName` and an `EventStoreNamespaceName` (`time` may be `null`). Pass those defaults to `ReactorScenario`, `ReadModelScenario` or `OccurrenceScenario`, and the store each scenario creates takes that store name and namespace. Other `Defaults` give store `testing` in namespace `default`. Limits:
|
|
138
|
+
- A `ReactorScenario` given an explicit `eventStore` uses that store's identity instead. `EventStoreForTesting` takes names only in its full constructor `(serviceProvider, artifacts, options, time, eventStoreName, namespaceName)`, where `time` is a non-null `ScenarioTime`; no constructor takes the names alone. Prefer the `Defaults` above.
|
|
139
|
+
- Redelivered occurrences and events passed to `ProcessAppendedEvents` keep the store name and namespace of their original contexts.
|
|
140
|
+
- An occurrence handler receives the namespace in `OccurrenceContext.Namespace`, but no store name.
|
|
141
|
+
- `EventScenario` never takes its identity from `Defaults` (without explicit names it uses `test-event-store` in `default`): pass the names with `new EventScenario(defaults, eventSequenceId, eventStoreName, namespaceName)`.
|
|
142
|
+
- Matching names alone never share storage: each store a scenario creates is private. To share events, share one store explicitly; see [csharp-read-models.md](csharp-read-models.md#share-or-isolate-the-in-memory-store).
|
|
136
143
|
- `RoundDownTicks()` on `DateTimeOffset`, `DateTime` and `TimeOnly` trims a value to the precision a stored event keeps, so an expected timestamp compares equal after a round trip.
|
|
@@ -26,8 +26,10 @@ 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
|
-
- `UsesPerContextMongoDBHost` defaults to `false`. Override it on
|
|
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.
|
|
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.
|
|
31
33
|
|
|
32
34
|
A spec has two classes. The context derives from the integration `Specification<TFixture>(fixture)`, overrides `EventTypes` and `Reactors` to name what it registers, and arranges and acts once. The spec class derives from `Given<TContext>`, which hands it that initialized context as `Context`; its facts only assert.
|
|
33
35
|
|
|
@@ -72,7 +74,7 @@ public class when_holding_a_parcel(a_held_parcel context) : Given<a_held_parcel>
|
|
|
72
74
|
- Assert a collected append with `ShouldHaveEvent<PickupScheduled>(e => e.Depot.ShouldEqual("depot-4"))` and `ShouldBeSuccessful()`.
|
|
73
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`.
|
|
74
76
|
|
|
75
|
-
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.
|
|
76
78
|
|
|
77
79
|
## Fixture and context members
|
|
78
80
|
|
|
@@ -81,7 +83,7 @@ When the repository keeps specs inside the application assembly, follow its conv
|
|
|
81
83
|
| `Specification<TFixture>(fixture)` | Context base hosting the application's client in process |
|
|
82
84
|
| `Specification<TFixture, TFactory, TStartup>(fixture)` | Context base that hosts the application through its own web application factory and startup |
|
|
83
85
|
| `Given<TSetup>` with `Context` | Share one initialized context class across spec classes as an xUnit class fixture |
|
|
84
|
-
| `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 |
|
|
85
87
|
| `EventTypes`, `EventSources`, `EventTypeMigrators`, `EventSeeders` | Override to name the event artifacts this context registers |
|
|
86
88
|
| `Projections`, `ModelBoundProjections`, `Reducers` | Read-model artifacts |
|
|
87
89
|
| `GraphElements`, `GraphProjections`, `GraphViews` | Graph artifacts |
|
|
@@ -99,7 +101,7 @@ When the repository keeps specs inside the application assembly, follow its conv
|
|
|
99
101
|
|
|
100
102
|
Edge cases, each an override on the context:
|
|
101
103
|
|
|
102
|
-
- `
|
|
104
|
+
- `protected override bool ShouldBootstrap => <stable condition>;`: return `false` to skip the context's setup, act and cleanup for a suite tier that is switched off. It is `protected`, unlike the `public` artifact lists, so `public override` does not compile. The collection fixture still starts its container; to avoid that, do not register the collection.
|
|
103
105
|
- `ConfigureHostServices` and `AdditionalHostConfiguration`: services and configuration keys for the in-process kernel rather than the application, for example a naming policy or a sink connection.
|
|
104
106
|
- `GetStorageConfigurator`, `GetStorageHostConfiguration`, `GetDefaultSinkTypeId` and `WipeInProcessStorage`: run the in-process kernel on storage other than MongoDB.
|
|
105
107
|
|
|
@@ -122,6 +124,7 @@ The in-process fixture's MongoDB image can be replaced with the `CHRONICLE_MONGO
|
|
|
122
124
|
|
|
123
125
|
Failures raised by the fixtures themselves:
|
|
124
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.
|
|
125
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.
|
|
126
129
|
- `ContentRootNotFound`: no project file exists at or above the test assembly.
|
|
127
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
|
@@ -15,7 +15,20 @@ Names are illustrative; the application's own domain language replaces them.
|
|
|
15
15
|
|
|
16
16
|
`ReactorScenario<TReactor>` (namespace `Cratis.Chronicle.Testing.Reactors`) activates the reactor from `scenario.Services` and hands it each event once.
|
|
17
17
|
|
|
18
|
-
- Register fakes in `scenario.Services` before the first event.
|
|
18
|
+
- Register fakes in `scenario.Services` before the first event. `Services` resolves constructor dependencies and service-typed handler parameters, and already includes logging, so `ILogger<T>` needs no registration. If you pass a pre-built `IServiceProvider` to the constructor, `Services` is ignored: register every dependency in that provider instead, or drop it and use `Services`.
|
|
19
|
+
- A reactor class that does not implement `IReactor` must be nominated in the scenario's `Defaults`, together with every event type it handles and every event type it returns, because `InMemoryClientArtifactsProvider` (`Cratis.Chronicle.Testing`) starts empty:
|
|
20
|
+
|
|
21
|
+
```csharp
|
|
22
|
+
var options = new ChronicleOptions();
|
|
23
|
+
options.ExplicitArtifacts
|
|
24
|
+
.RegisterEventType<ParcelHeld>()
|
|
25
|
+
.RegisterEventType<CustomerNotified>()
|
|
26
|
+
.RegisterReactor<ParcelNotifier>();
|
|
27
|
+
var scenario = new ReactorScenario<ParcelNotifier>(new Defaults(new InMemoryClientArtifactsProvider(), null, options));
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Without the reactor nomination the constructor throws `InvalidExplicitArtifact`; an unregistered event type throws `TypeIsNotAnEventType` on delivery. A public method shaped as a handler (a registered event type, optionally followed by `EventContext` or `ReactorDelivery`) throws `InvalidReactorHandlerReturnType` when its return type is synchronous and unsupported, for example an unregistered event type. `void`, any `Task` (including `Task<T>`), a registered event type, `EventForEventSourceId`, `EventsWithConcurrencyScopes`, sequences of registered events, `EventForEventSourceId` or `object`, and any type a side-effect handler claims all pass. Events returned inside `EventForEventSourceId` are recorded without registration. With the default recorder (no explicit `IReactorSideEffectHandlers` passed to the constructor), a returned bare event whose type is not registered appears in `Produced` but not in `ProducedEvents`, so the ordered and destination assertions do not see it. Create new options and defaults for each independent run and never change `Defaults.Instance`: each scenario store keeps the registrations it had when it was created.
|
|
31
|
+
- A reactor that checks `EventContext.EventStore` or `EventContext.Namespace` sees the identity of the scenario's store, by default `testing` in namespace `default`. Pass `Defaults` built with the expected store and namespace, or an explicit `eventStore` that has them; its identity wins over the defaults. `Redeliver` keeps the occurrence's original context. See [csharp-events.md](csharp-events.md#control-time-and-artifacts).
|
|
19
32
|
- `await scenario.Given.ForEventSource(id).Events(...)` delivers the events. It does **not** build read models.
|
|
20
33
|
- A reactor method that takes a read model needs it declared: `scenario.Given.ForEventSource(id).ReadModel(instance)` or `.NoReadModel<T>()` for a deliberate `null`. Omitting both throws `ReadModelNotSeededForReactorScenario`, for nullable and non-nullable parameters alike; its message lists the keys already seeded for that type. When the reactor implements `ICanResolveReadModelKey`, seed or declare absence under the key it returns, not the triggering event source id.
|
|
21
34
|
- That guard applies to a parameter whose type has a discovered projection or reducer and that resolves to `null`, in the scenario's own store or an `EventStoreForTesting` passed as the constructor's `eventStore`. With any other explicit `IEventStore` the guard is off: the parameter is whatever that store resolves, and a scenario that seeded a read model throws `CannotSeedReadModelWithExplicitEventStore` when it delivers. Do not expect the missing-seed failure there.
|
|
@@ -42,7 +55,7 @@ A green `ReactorScenario` does not prove the application registers or subscribes
|
|
|
42
55
|
| --- | --- |
|
|
43
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` |
|
|
44
57
|
| `new ReactorScenario<TReactor>(services => ...)` | Register dependencies inline |
|
|
45
|
-
| `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 |
|
|
46
59
|
| `Given.ForEventSource(id).OnStream(eventSourceType, eventStreamType, eventStreamId)` | Deliver with the stream coordinates production would carry |
|
|
47
60
|
| `.Events(...)` | Deliver each event once |
|
|
48
61
|
| `.History(event)` / `.History(first, second)` | Record without delivering; returns `RecordedOccurrence` (`Event`, `Context`) values for `Redeliver` |
|
|
@@ -77,7 +90,7 @@ The scenario delivers a given only when it matches the reactor's `[EventSourceTy
|
|
|
77
90
|
|
|
78
91
|
## ReactionSlice
|
|
79
92
|
|
|
80
|
-
`ReactionSlice<TReactor>` (namespace `Cratis.Chronicle.Testing.Slices`) is the given/run/then shape: `new ReactionSlice<T>()` (or with `Defaults`), `.GivenEvents(id, events)`, `await Run()`, then chain `Then.ShouldHaveProducedEventsInOrder(...)`, `.ShouldHaveProducedEventsInAnyOrder(...)`, `.ShouldNotHaveProducedEvents()` or `.Should(scenario => ...)`. `Scenario` exposes the underlying `ReactorScenario<T>` for services, read models or history. Use the scenario directly for redelivery, pages or stream coordinates.
|
|
93
|
+
`ReactionSlice<TReactor>` (namespace `Cratis.Chronicle.Testing.Slices`) is the given/run/then shape: `new ReactionSlice<T>()` (or with `Defaults`), `.GivenEvents(id, events)`, `await Run()`, then chain `Then.ShouldHaveProducedEventsInOrder(...)`, `.ShouldHaveProducedEventsInAnyOrder(...)`, `.ShouldNotHaveProducedEvents()` or `.Should(scenario => ...)`. `Scenario` exposes the underlying `ReactorScenario<T>` for services, read models or history. Use the scenario directly for redelivery, pages or stream coordinates. The slice is `IDisposable`, not `IAsyncDisposable` like the command `Slice<TCommand>`: dispose it with `void Destroy() => _slice.Dispose();`. Disposing it disposes its scenario. After that, `GivenEvents`, `Run` and `Then` throw `SliceDisposed`; another `Dispose` does nothing, and `Scenario` still returns the disposed scenario, so do not use it.
|
|
81
94
|
|
|
82
95
|
## Occurrence scenario
|
|
83
96
|
|
|
@@ -110,8 +123,8 @@ scenario.ShouldHaveAppended<ImportCompleted>();
|
|
|
110
123
|
|
|
111
124
|
The assertions are synchronous and read collected state; after mutating outside a delivery, await `StatusOf(id)` first.
|
|
112
125
|
|
|
113
|
-
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.
|
|
114
127
|
|
|
115
|
-
**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`.
|
|
116
129
|
|
|
117
130
|
The scenario replaces the background delivery shell with explicit calls. Restart, clustering and storage durability need a running store.
|
|
@@ -47,7 +47,7 @@ Compare every mapped field against a distinguishing input; default values alone
|
|
|
47
47
|
| `InstanceForEventSourceId(id)` / `InstanceForKey(keyParts)` | One instance, or `null` |
|
|
48
48
|
| `ReadModels` | The seeded and materialized models through the client's read-model API |
|
|
49
49
|
| `ShouldPartiallyMatchReadModel(id, expected)` / `ShouldExactlyMatchReadModel(id, expected)` / `ShouldHaveNoReadModel(id)` | Listed properties match / every public property matches / nothing exists at that key |
|
|
50
|
-
| `CollectEventsFor(id, events)` / `await ProcessEventsFor(id, events)` | Accumulate events for a source
|
|
50
|
+
| `CollectEventsFor(id, events)` / `await ProcessEventsFor(id, events)` | Accumulate events for a source; both are folded on the next read |
|
|
51
51
|
| `CollectReadModelFor(id, instance)` | Seed the fold for that key and expose it through `ReadModels`; a model with no projection or reducer is only registered for keyed lookups |
|
|
52
52
|
| `ProcessAppendedEvents(events)` | Apply captured `AppendedEvent` envelopes with their context |
|
|
53
53
|
| `ClientArtifactsProvider` | The artifacts the scenario discovered |
|
|
@@ -70,6 +70,8 @@ An empty list still does not cover storage or observer delivery. Because the che
|
|
|
70
70
|
|
|
71
71
|
## Failures that name the cause
|
|
72
72
|
|
|
73
|
+
Seeding never folds: `Given...Events(...)`, `ProcessEventsFor` and `ProcessAppendedEvents` only collect events. The projection or reducer runs on the first read: `Instance`, `Instances`, `InstanceForEventSourceId` or a `Should...ReadModel` assertion. `InstanceForKey` reads only keys seeded by name: before any named seed it returns `null`; after one, key parts that do not match the named key throw `InvalidReadModelSeedKey`, and a valid key that was not seeded returns `null`. Getting `ReadModels` does not fold. Its single-key `GetInstanceById(key)` folds the scenario's input first only when model instances were seeded; the stream overload `GetInstanceById(eventSourceId, eventStreamId)` skips that step and folds the stream's events from the log on each read. Fold failures such as `ReducerFailed` and `ReducerDeferred` are thrown from that read, so wrap the read, not the seed, in `Catch.Exception` in `Because`.
|
|
74
|
+
|
|
73
75
|
| Thrown | Means | Do |
|
|
74
76
|
| --- | --- | --- |
|
|
75
77
|
| `NoReadModelHandlerFound` | No reducer, projection or model-bound mapping was discovered for the model | Fix the definition or its discovery; do not paper over it with `WithProjection` |
|
|
@@ -93,4 +95,4 @@ An empty list still does not cover storage or observer delivery. Because the che
|
|
|
93
95
|
|
|
94
96
|
## ProjectionSlice
|
|
95
97
|
|
|
96
|
-
`ProjectionSlice<TReadModel>` (namespace `Cratis.Chronicle.Testing.Slices`) is the given/run/then shape over the same engine: `new ProjectionSlice<T>()` (or with `Defaults`), `.GivenEvents(id, events)` per source, `await Run()`, then chain `Then.ShouldPartiallyMatchReadModel(id, expected)`, `.ShouldExactlyMatchReadModel(id, expected)`, `.ShouldHaveNoReadModel(id)` or `.Should(scenario => ...)`. `Scenario` exposes the underlying `ReadModelScenario<T>` for routing, seeded state or strictness. Choose it when the spec reads as "given these events, then this row"; use the scenario directly for streams, tags or seeded state. Await `Run()`, not the assertions: they synchronously return a chainable outcome. Keep direct reducer transition specs separate from this wiring check. Disposing the slice disposes its scenario
|
|
98
|
+
`ProjectionSlice<TReadModel>` (namespace `Cratis.Chronicle.Testing.Slices`) is the given/run/then shape over the same engine: `new ProjectionSlice<T>()` (or with `Defaults`), `.GivenEvents(id, events)` per source, `await Run()`, then chain `Then.ShouldPartiallyMatchReadModel(id, expected)`, `.ShouldExactlyMatchReadModel(id, expected)`, `.ShouldHaveNoReadModel(id)` or `.Should(scenario => ...)`. `Scenario` exposes the underlying `ReadModelScenario<T>` for routing, seeded state or strictness. Choose it when the spec reads as "given these events, then this row"; use the scenario directly for streams, tags or seeded state. Await `Run()`, not the assertions: they synchronously return a chainable outcome. Keep direct reducer transition specs separate from this wiring check. Disposing the slice disposes its scenario. After that, `GivenEvents`, `Run` and `Then` throw `SliceDisposed`; another `Dispose` does nothing, and `Scenario` still returns the disposed scenario, so do not use it.
|
|
@@ -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).
|
|
@@ -113,7 +146,7 @@ Awaited assertions on the scenario: `ShouldHaveAppendedEvent<TCommand, TEvent>(i
|
|
|
113
146
|
|
|
114
147
|
## Seeding before the act
|
|
115
148
|
|
|
116
|
-
`Given.ForEventSource(id)[.OnRoute(route)].Events(...)` and `.ReadModel(instance)`; `EventRoutes` resolves a route; `EventScenario.Given` seeds the log that constraints see. Guarded reads, uniqueness, competing writers (`AppendConcurrently`) and `DecisionReadAdmissions`: [csharp-decision-reads.md](csharp-decision-reads.md).
|
|
149
|
+
`Given.ForEventSource(id)[.OnRoute(route)].Events(...)` and `.ReadModel(instance)`; `EventRoutes` resolves a route; in an ordinary scenario, `EventScenario.Given` seeds the log that constraints see; routed seeds need decision mode, which commands with decision dependencies use automatically; there `Given` seeds one shared log and `EventScenario` throws. Guarded reads, uniqueness, competing writers (`AppendConcurrently`) and `DecisionReadAdmissions`: [csharp-decision-reads.md](csharp-decision-reads.md).
|
|
117
150
|
|
|
118
151
|
## Slice
|
|
119
152
|
|
|
@@ -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
|
package/package/corpus/skills/cratis-specifications-exercise-backend/references/typescript.md
CHANGED
|
@@ -183,7 +183,9 @@ emissions.should.have.lengthOf(1);
|
|
|
183
183
|
`new ReadModelScenario(ReadModelClass, artifacts?)` from `@cratis/chronicle/testing` folds events through the read model's reducer or a supported flat projection. Supply `artifacts` (`eventTypes`, `reducers`, `projections`, optional `readModels` and `globalForHandlers`) to isolate the catalog rather than discovering it.
|
|
184
184
|
|
|
185
185
|
- `scenario.given.forEventSource(id, appendOptions?).events(...events)` queues events and returns the scenario. `collectEventsFor(id, events, options?)` queues them without the builder. For non-default routes, use a kernel.
|
|
186
|
-
- `await scenario.instance` returns the
|
|
186
|
+
- `await scenario.instance` returns the one non-null model, or `null` when there is none; it rejects when more than one non-null model exists. One event source can populate several projection keys, so it says nothing about a particular key. Read one model with `await scenario.instanceForEventSourceId(key)`, passing the model key the projection resolves, which is not always the event source id. It returns `null` both for a removed model and for one never created.
|
|
187
|
+
- `await scenario.wasDeletedForEventSourceId(key)` reports the current deleted state: it is `true` when the latest state change the reducer or projection made for that key removed the model, even when the model never existed. Events the read model does not handle change nothing, so one seeded after a removal leaves the flag `true`; an event that recreates the model makes it `false` again. To prove that an existing model was removed, first assert it exists after the earlier events, then seed the removing event and assert the flag. In a reducer, returning `undefined` deletes the model, while returning `null` keeps a null state that is not deleted.
|
|
188
|
+
- You may seed more events after a read. The next read replays the complete seeded history, so read again to assert the new state. Seed order holds within each event source; a batch reducer receives only the events it subscribes to, one batch per source, so do not assert an order across sources.
|
|
187
189
|
- `scenario.observe(eventOrReactorScenario)` reads that scenario’s committed history afresh on each model read; reactor effects that were only recorded are not part of it. Select one observed scenario or seed events manually, never both.
|
|
188
190
|
- Not supported in this SDK: listing all instances, seeding an instance directly, match helpers and strict modes. Assert the instance with Chai. A projection shape or non-default route outside the in-process boundary throws `UnsupportedProjectionOperation`; a reducer filtered by tag, event source type or event stream type throws `UnsupportedReducerOperation`. Both mean the harness cannot prove that shape: test it with `ChronicleKernelScenario`.
|
|
189
191
|
|
|
@@ -194,7 +196,7 @@ emissions.should.have.lengthOf(1);
|
|
|
194
196
|
- `given.forEventSource(id, appendOptions?).events(...events)` seeds and delivers earlier events; use it only when the earlier handler calls are part of the setup.
|
|
195
197
|
- `when.forEventSource(id, appendOptions?).events(...events)` appends one atomic input batch and awaits its delivery; an append refusal rejects the call.
|
|
196
198
|
- `given.page(...entries)` / `when.page(...entries)` deliver a page of `EventForEventSourceId` entries from several sources, e.g. to prove that one partition can defer while another is handled.
|
|
197
|
-
- Options include the Event scenario options above for the input log and metadata. `artifactActivator` supplies production-style per-delivery activation for dependency injection and cleanup.
|
|
199
|
+
- Options include the Event scenario options above for the input log and metadata. `artifactActivator` supplies production-style per-delivery activation for dependency injection and cleanup. To give the reactor test doubles, build the instance from the requested type: `artifactActivator: type => ({ instance: new type(fakeGateway) })`. The activator is generic, so returning a fixed `new MyReactor(...)` does not type-check. Without an activator the reactor is constructed with no arguments.
|
|
198
200
|
- `servicesEventStore` supplies an explicit `IEventStore` test double for handler dependencies. The default supports the in-process event log, not read models or other store services, and rejects explicit appends of types this reactor subscribes to.
|
|
199
201
|
- `resultHandler(result, context, reactorType, eventStore, namespace)` is the application hook for a single-event handler’s return value. Return `true` to claim it without recording, `false` to fall through, or throw to fail delivery. The default recorder accepts registered events (including routed `EventForEventSourceId` wrappers), not commands or unknown values. A nonempty `commandTypes` option is rejected; use the hook to assert a returned command or a live host to prove its execution.
|
|
200
202
|
- `produced` holds recorded event payloads; `sideEffects` additionally gives `kind`, `value`, routed `target`, `triggeringContext`, `handler` and zero-based `deliveryIndex`. Setup effects are included, so separate them from effects of the act.
|
|
@@ -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:
|
package/package/corpus/skills/cratis-specifications-test-application-ui/references/typescript.md
CHANGED
|
@@ -39,7 +39,9 @@ Use this reference for the React frontend regardless of the backend SDK; a React
|
|
|
39
39
|
|
|
40
40
|
## Runner and structure
|
|
41
41
|
|
|
42
|
-
Dev dependencies of the frontend project: `vitest`, `chai`, `chai-as-promised`, `sinon`, `sinon-chai`, typings for the Mocha-style globals (`@types/mocha`), and a reflect-metadata polyfill (`reflect-metadata` or `@cratis/fundamentals/reflection`). View models carry `tsyringe` decorators, and `tsyringe` throws on import without the polyfill.
|
|
42
|
+
Dev dependencies of the frontend project: `vitest`, `chai`, `chai-as-promised`, `sinon`, `sinon-chai`, typings for the Mocha-style globals (`@types/mocha`), typings for the assertion libraries that do not bundle their own (`@types/chai`, `@types/chai-as-promised`, `@types/sinon`, `@types/sinon-chai`), and a reflect-metadata polyfill (`reflect-metadata` or `@cratis/fundamentals/reflection`). View models carry `tsyringe` decorators, and `tsyringe` throws on import without the polyfill. Mounted specs also need `@testing-library/react`, its peer `@testing-library/dom` (the package manager does not add it for you) and `jsdom`. Use what the app already has.
|
|
43
|
+
|
|
44
|
+
The frontend's TypeScript configuration includes the spec files in the strict type check, so missing typings fail the build, not only the specs. Installing a typings package for globals is not enough when the configuration does not load it: if the type check cannot find `describe`, `it` or `beforeEach`, name the package in `compilerOptions.types`, as `"types": ["mocha"]`. `"types": ["vitest/globals"]` types the same globals from Vitest itself and needs no `@types/mocha`. Keep the entries the configuration already lists.
|
|
43
45
|
|
|
44
46
|
Setup file, listed in `test.setupFiles`:
|
|
45
47
|
|
|
@@ -48,14 +50,19 @@ import 'reflect-metadata';
|
|
|
48
50
|
import * as chai from 'chai';
|
|
49
51
|
import * as chaiAsPromised from 'chai-as-promised';
|
|
50
52
|
import * as sinonChai from 'sinon-chai';
|
|
51
|
-
import { afterEach } from 'vitest';
|
|
52
|
-
import { cleanup } from '@testing-library/react';
|
|
53
53
|
|
|
54
54
|
chai.should();
|
|
55
55
|
chai.use(sinonChai.default);
|
|
56
56
|
chai.use(chaiAsPromised.default);
|
|
57
|
+
```
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
Only a project with mounted specs adds the Testing Library import and cleanup to the setup file. Leave both out of a suite that runs view-model and static-markup specs in Node:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { afterEach } from 'vitest';
|
|
63
|
+
import { cleanup } from '@testing-library/react';
|
|
64
|
+
|
|
65
|
+
afterEach(() => cleanup());
|
|
59
66
|
```
|
|
60
67
|
|
|
61
68
|
Vitest can define its own spy assertions under the same names on the shared chai as getter-only properties, which sinon-chai cannot overwrite. If `chai.use(sinonChai.default)` throws, delete those names first:
|
|
@@ -74,6 +81,17 @@ Vitest `test` options that Cratis frontends use:
|
|
|
74
81
|
- Use the Node environment for view-model and static-markup specs. Mounted specs need jsdom: set `environment: 'jsdom'` for a DOM-only project or add `// @vitest-environment jsdom` at the top of each mounted spec. Keep both discovery globs either way.
|
|
75
82
|
- `isolate: false` and `fileParallelism: false`. Spec files share module state, so caches and prototype stubs carry from one file to the next unless you reset them (see Isolation and reset).
|
|
76
83
|
|
|
84
|
+
Where the runner lives:
|
|
85
|
+
|
|
86
|
+
- **First frontend spec in a templated app.** The `cratis` template ships no spec runner: no runner packages, no `test` section and no `test` script. With the first frontend spec add the dev dependencies above (typings included; leave out the Testing Library and jsdom packages until there is a mounted spec), the globals typings entry in `compilerOptions.types` of `.frontend/tsconfig.json`, the setup file, a `test` section in the existing Vite configuration under `.frontend/` and a script `"test": "vitest run --config .frontend/vite.config.ts"`. Keep one Vite configuration for build and specs; import `defineConfig` from `vitest/config` in it so `test` is typed.
|
|
87
|
+
- **Globs follow the configuration's root.** That configuration sets `root` to `.frontend/`, while specs sit beside the code in the project folder above it. Patterns resolve against that root, so a pattern without `../` only reaches files under `.frontend/`. Prefix each pattern that targets files above it with `../`: `include: ['../**/for_*/when_*/**/*.{ts,tsx}', '../**/for_*/**/when_*.{ts,tsx}']`.
|
|
88
|
+
- **Co-located project (backend and frontend in one folder).** Setting `exclude` replaces Vitest's defaults, which keep dependencies and version-control folders out at any depth. Keep those exclusions recursive across the scanned tree and add the project's own: `exclude: ['../**/node_modules/**', '../**/.git/**', '../**/given/**', '../bin/**', '../obj/**', '../wwwroot/**']`. A `'../node_modules/**'` pattern covers only the top-level folder, so `for_*/when_*` files in a nested dependency would be collected. `bin` and `obj` are the backend's build output and `wwwroot` is the served frontend output; none of them holds specs to run.
|
|
89
|
+
- **Several applications in one repository (edge case).** The workspace root owns the runner packages, one shared setup file and the shared scripts, for example `"g:test": "cd $INIT_CWD && vitest run --config .frontend/vite.config.ts"`. Each application keeps its own `.frontend/vite.config.ts`, points `test.setupFiles` at the shared setup file and declares `"test": "yarn g:test"`. Do not copy the setup file into each application.
|
|
90
|
+
|
|
91
|
+
When a component mixes rendering with wiring and you want to specify its initial app-owned markup, consider extracting the rendering. One component binds the queries, commands and dialogs and passes data and callbacks down; the other takes only data and callbacks as props. Render the second one with props in a spec under `for_<Component>/` (see Static markup in [Rendering specs](typescript-rendering.md)); it needs no proxy stubs. A component that already takes only props needs no split, and provider-driven behavior stays in mounted specs.
|
|
92
|
+
|
|
93
|
+
Under `isolate: false` the spec files in one worker share a module registry. Unless that registry is reset between files, a module evaluated by an earlier file stays cached, so a later file's `vi.mock` of it may not apply and which version a spec gets depends on load order. In such a project do not use `vi.mock` on a module that other spec files import for real. If a project that disables isolation mocks modules, call `vi.resetModules()` in the setup file, which runs before each spec file, so cached modules do not carry across files; spec files then add no `vi.resetModules()` of their own. Register a mock in the setup file only when it is meant to be shared by the whole suite. With Vitest's default isolation each spec file gets its own module registry: keep `vi.mock` local to the file and add no reset.
|
|
94
|
+
|
|
77
95
|
Run the affected specs with the app's non-watch test command (for Vitest, `vitest run` with the spec path filter). Also run the project's non-fixing lint and type check, for example its `lint:ci` script and `tsc --noEmit -p <spec-tsconfig>` when it has a standalone spec config. Use the workspace check for project references, and ensure it includes the spec files.
|
|
78
96
|
|
|
79
97
|
Cratis exports no `given` for UI specs. Add one to the app, for example `given.ts` at the frontend root:
|
|
@@ -63,7 +63,7 @@ The syntax for every item is in your language reference.
|
|
|
63
63
|
|
|
64
64
|
### Runner and discovery
|
|
65
65
|
|
|
66
|
-
- **Package or workspace test project**: use the owning configuration so the existing environment and setup apply.
|
|
66
|
+
- **Package or workspace test project**: use the owning configuration so the existing environment and setup apply; in a workspace, run the owning package's test script from its folder when that script starts the runner, or the configured root runner with a project or path filter when the package has none. Read the script before passing it a filter: only a script that forwards its arguments to the runner accepts one.
|
|
67
67
|
- **Global or imported suite functions**: match neighboring specs; binding these functions is independent of file discovery.
|
|
68
68
|
- **Include and exclude patterns**: use the configured single-file form for one outcome or a directory for several; check extensions, suffixes, and fixture exclusions separately.
|
|
69
69
|
- **Environment**: use the project's default; select a file-level environment only when that file needs browser facilities.
|
|
@@ -72,6 +72,7 @@ The syntax for every item is in your language reference.
|
|
|
72
72
|
- **Spec type configuration**: include the declarations for the assertions and any globals the project uses; runtime setup alone does not declare types.
|
|
73
73
|
- **File isolation**: keep files isolated when mocking imports, so one file cannot depend on a module evaluation from another.
|
|
74
74
|
- **Focused run**: select the owning project and the file or folder; check the collected cases when filtering by name.
|
|
75
|
+
- **Coverage exclusions**: keep spec folders, build output, and declaration files out of the coverage report.
|
|
75
76
|
|
|
76
77
|
### Structure
|
|
77
78
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
## Contents
|
|
4
4
|
|
|
5
5
|
- Runner setup
|
|
6
|
+
- Running in a workspace
|
|
6
7
|
- The given helper
|
|
7
8
|
- Worked example
|
|
8
9
|
- Given context lifetime
|
|
@@ -82,6 +83,45 @@ const standardDecorators = {
|
|
|
82
83
|
|
|
83
84
|
Run `yarn vitest run <file-or-folder>` using the owning configuration. In a workspace, select the owning project with `--project <name>` where needed. Confirm the expected cases are listed and pass. If the run is empty, check the configuration and project, the file argument and `include`/`exclude`, and any `-t` name filter independently.
|
|
84
85
|
|
|
86
|
+
## Running in a workspace
|
|
87
|
+
|
|
88
|
+
When the owning package has a `test` script, run it from that package's folder: `yarn test`. Read the script first. When it starts Vitest, it applies that package's runner configuration, so its include patterns, environment and setup file are in effect. When it also passes its arguments on to Vitest, as a script ending in `vitest run` does, `yarn test for_ReminderPlanner` focuses the run on one spec folder. A script that starts another runner, or that ends in a fixed file list or a chained command, does not take a Vitest filter: use that runner's own filter syntax, or call Vitest directly with the owning configuration. When the package has no `test` script and the root configuration covers it, run the root runner with a path or project filter instead, from the workspace root: `yarn vitest run <package-folder>`, or `yarn vitest run --project <name>` when the root configuration defines projects. Either way, confirm the run lists a nonzero number of cases.
|
|
89
|
+
|
|
90
|
+
In a Yarn workspace, the root `package.json` commonly holds the runner commands once, and each package's `test` script forwards to them:
|
|
91
|
+
|
|
92
|
+
| Root script | Runs | Package script that forwards to it |
|
|
93
|
+
| --- | --- | --- |
|
|
94
|
+
| `g:test` | Vitest once, in the folder the command was started from | `"test": "yarn g:test"` |
|
|
95
|
+
| `g:test:watch` | Vitest in watch mode, in the same folder | `"test:watch": "yarn g:test:watch"` |
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"scripts": {
|
|
100
|
+
"g:test": "cd $INIT_CWD && vitest run",
|
|
101
|
+
"g:test:watch": "cd $INIT_CWD && vitest --watch"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`$INIT_CWD` is the folder the command was started from, so each package runs with its own configuration. If Vitest does not discover a package's configuration by itself, for example when it sits in a subfolder such as `.frontend`, pass `--config` in whichever script launches Vitest, root or package: `vitest run --config .frontend/vite.config.ts`. That path is resolved from the package folder. Use the scripts the workspace already has and add these only when a workspace has none.
|
|
107
|
+
|
|
108
|
+
- **Whole workspace:** when the root has a `test` script that runs every package's `test` script, use it before finishing, not to prove one new spec.
|
|
109
|
+
- **Anti-pattern:** starting Vitest for one package's specs without loading the configuration that owns them. Its include patterns and setup file do not apply, and the run can collect zero cases. From the workspace root this is fine when the root configuration covers the package, or when the package's configuration is passed explicitly: `yarn vitest run --config <package-folder>/.frontend/vite.config.ts`.
|
|
110
|
+
|
|
111
|
+
For coverage, install the coverage provider package for the runner (`@vitest/coverage-v8` for the `v8` provider), add `--coverage` to the same Vitest invocation that discovers the specs (`yarn test --coverage` when the package script forwards its arguments to Vitest, `yarn vitest run <package-folder> --coverage` from the workspace root otherwise), and keep spec folders, build output and declaration files out of the report. Merge `coverage` into the `test` block of the existing configuration, beside its `include`, `exclude` and other settings; this fragment shows only the added part:
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
test: {
|
|
115
|
+
// existing include, exclude, setupFiles …
|
|
116
|
+
coverage: {
|
|
117
|
+
provider: 'v8',
|
|
118
|
+
exclude: ['**/for_*/**', '**/dist/**', '**/*.d.ts']
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Add the package's other output folders, such as a web root the frontend builds into. `coverage.exclude` only shapes the report. Spec collection is unchanged: `test.include` selects the candidate files and `test.exclude` removes matches from them.
|
|
124
|
+
|
|
85
125
|
## The given helper
|
|
86
126
|
|
|
87
127
|
In an Arc Node server package, import the published helper: `import { given } from '@cratis/arc.testing';`. Elsewhere, import the local helper the adjacent specs import. When the package has none, add this plain helper beside the package's sources:
|
|
@@ -256,6 +256,12 @@ Programmatic planning in your language reference.
|
|
|
256
256
|
- Source-plan options - preserve identity, placement and scaffold profile; compose shared UI only over installed proxies.
|
|
257
257
|
- Strict and gap policies - enforce acceptance; never treat a gap option as permission to omit behavior.
|
|
258
258
|
|
|
259
|
+
### Renderer conformance tests
|
|
260
|
+
|
|
261
|
+
Testing your own renderer's round trip? Gate it on the semantic loss ledger in the renderer
|
|
262
|
+
repository's non-packable specification project, referencing the source adapter's published
|
|
263
|
+
package; read [semantic conformance](references/semantic-conformance.md).
|
|
264
|
+
|
|
259
265
|
## Where hand-written code goes
|
|
260
266
|
|
|
261
267
|
Everything hand-written for a rendered application goes in `Customizations/` at the application root.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Gate a renderer's round trip with the semantic loss ledger
|
|
2
|
+
|
|
3
|
+
`Cratis.Screenplay.Conformance` is a source-only test-support package. The round trip lives in the
|
|
4
|
+
renderer repository, in a specification project that is never packed and that references the source
|
|
5
|
+
adapter's published package with `PrivateAssets`. Adapter repositories do not host it. The package
|
|
6
|
+
compiles into the test project (C# 12+, .NET 10+) and adds no runtime assembly. Use the renderer's Screenplay version and add `-preview` only when that version has
|
|
7
|
+
no prerelease suffix: `X.Y.Z` becomes `X.Y.Z-preview`, while an already suffixed version is used as is.
|
|
8
|
+
|
|
9
|
+
```xml
|
|
10
|
+
<PackageReference Include="Cratis.Screenplay.Conformance" Version="X.Y.Z-preview" PrivateAssets="all" />
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The test owns the ledger file, the round trips and the eligible fixture set; the package only
|
|
14
|
+
compares and reconciles.
|
|
15
|
+
|
|
16
|
+
## Gate on the whole verdict
|
|
17
|
+
|
|
18
|
+
```csharp
|
|
19
|
+
using var stream = File.OpenRead("semantic-loss-ledger.json");
|
|
20
|
+
var ledger = SemanticLossLedger.Load(stream);
|
|
21
|
+
var verdict = ledger.Reconcile(observations, requireCompleteRun: true, eligibleFixtures);
|
|
22
|
+
Assert.True(verdict.IsClean, string.Join("\n", verdict.Findings));
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- `IsClean` is true only when `Findings` is empty. `Findings` combines every list: `Malformed`,
|
|
26
|
+
`Unledgered`, `Stale`, `Unexplained`, `Uncited`, `OverBudget`, `Vacuous`, `Orphans`,
|
|
27
|
+
`IneligibleExclusions`, `ObsoleteExclusions` and `Unobserved`. Checking one list, or counting
|
|
28
|
+
differences, lets the others pass.
|
|
29
|
+
- Choose the eligible fixture set before rendering, never from the fixtures that happened to render.
|
|
30
|
+
Pass that set unchanged: do not add the ledger's exclusions to it, and do not drop eligible
|
|
31
|
+
fixtures the ledger excludes. Leave excluded fixtures out of the observations. Observing an
|
|
32
|
+
excluded fixture fails any run; excluding a fixture that is not eligible fails a complete run. The
|
|
33
|
+
parameter is optional in the signature, but a complete run without it fails.
|
|
34
|
+
- A complete run must observe every eligible fixture the ledger does not exclude, observe at least
|
|
35
|
+
`minimumFixtureCount` fixtures and compare at least one recovered model.
|
|
36
|
+
|
|
37
|
+
## Keep the ledger honest
|
|
38
|
+
|
|
39
|
+
- Each loss names `fixture`, `change` (`missing`, `unexpected`, `changed`, `uncompilable` or
|
|
40
|
+
`diagnostic`) and `direction` (`render` or `adapter`), plus exactly one of `issue`
|
|
41
|
+
(`owner/repo#123`) or a nonempty `byDesign` reason. `missing`, `unexpected` and `changed` also need
|
|
42
|
+
the exact `path`. `diagnostics` lists the codes the loss cites; leaving it out means empty.
|
|
43
|
+
Wildcard paths and malformed entries never reconcile clean.
|
|
44
|
+
- A loss with empty or missing `diagnostics` is silent. It must carry an `issue`, never `byDesign`.
|
|
45
|
+
To accept it by design, cite a diagnostic code that explains it. Use an existing code if one
|
|
46
|
+
applies; otherwise make the renderer or adapter emit one.
|
|
47
|
+
- A `diagnostic` entry matches only through its codes: it must cite at least one code that occurred
|
|
48
|
+
in the fixture for its direction, or it is stale. An `issue` alone does not reconcile it.
|
|
49
|
+
- Every cited code must occur in the same fixture for the entry's direction. An `uncompilable` entry
|
|
50
|
+
may also cite codes from compiling the recovered source.
|
|
51
|
+
- Every renderer or adapter warning or error must be cited by an entry for the same fixture and
|
|
52
|
+
direction. Informational diagnostics and recovery compiler codes need no citation.
|
|
53
|
+
- Entry, by-design and exclusion counts may not exceed the ledger's `budget`.
|
|
54
|
+
- An entry for an observed fixture that matches nothing is stale: remove it once the loss is fixed.
|
|
55
|
+
An entry for a fixture the run did not observe is an orphan in a complete run. A partial run does
|
|
56
|
+
not report it as orphan or stale, but it still counts toward the budget and must still be well
|
|
57
|
+
formed and not a silent `byDesign` loss. Do not delete entries for fixtures you skipped while
|
|
58
|
+
debugging.
|
|
59
|
+
|
|
60
|
+
## Debug one fixture
|
|
61
|
+
|
|
62
|
+
Use `requireCompleteRun: false` in a separate local test. A partial run skips the minimum and the
|
|
63
|
+
eligible set, but it must still execute at least one fixture. Keep CI on the complete run, and never
|
|
64
|
+
lower `minimumFixtureCount` to make a local run pass.
|