@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
|
@@ -28,7 +28,7 @@ Append `TicketOpened("Replace valve")` on source `t1`; after processing, `store.
|
|
|
28
28
|
|
|
29
29
|
## Event and property operations
|
|
30
30
|
|
|
31
|
-
-
|
|
31
|
+
- Put `@Join` on a Kotlin property, not with `@field:`, which the reader misses. A join needs the team ID already stored on the ticket. `TicketOpened` above carries none, so declare `@EventType data class TicketAssigned(val teamId: String)`, add `@FromEvent(TicketAssigned::class)` and `val teamId: String = ""` to `Ticket` (matching names auto-map) and append it on the ticket's source. Then `@Join(TeamNamed::class, on = "teamId", eventPropertyName = "name") val teamName: String = ""` follows the stored team ID. `on` names the read-model property that holds the joined source's ID; Chronicle matches it against the joined event's event source ID, so the event payload need not repeat that ID. Every `@Join` for one event type shares a single `on`, taken from the first mapping, so give them all the same `on`. `on` and `eventPropertyName` both default to the annotated property's own name; set `eventPropertyName` whenever the event field you want has a different name. If the defaulted name is missing from the event, registration throws `InvalidPropertyForType`; if the event has a field with that name, that field is mapped without error. Fluent equivalent: `builder.join(TeamNamed::class) { it.on("teamId").set<String>("teamName").toProperty("name") }`; `on`, `set` and `setOnce` also accept property references such as `it.on(Ticket::teamId)`.
|
|
32
32
|
- `@RemovedWith(TicketClosed::class)` deletes by key; `@RemovedWithJoin(TeamDeleted::class)` deletes by join. Fluent `removedWith` accepts `usingKey` and `usingParentKey`; `removedWithJoin` accepts `usingKey`.
|
|
33
33
|
- `@SetValue(TicketClosed::class, "closed")` assigns a literal (write numeric and boolean constants as text); `clear = true` instead of a value clears a nullable field. `@SetFromContext(TicketOpened::class, "occurred")` copies context. Add `setOnce = true` to `SetFrom` or `SetFromContext` for first nonempty assignment.
|
|
34
34
|
- In a `from` block use `it.set(Ticket::id).toEventSourceId()`; other assignment sources include `toValue("open")`, `toProperty("subject")`, `toEventContextProperty("occurred")`, and `toCausedBy(CausedByProperty.SUBJECT)` (`NAME` and `USER_NAME` are for display). Use `setOnce` instead of `set` for first assignment.
|
|
@@ -54,6 +54,7 @@ With `val rm = store.readModels`, use suspend reads in a coroutine:
|
|
|
54
54
|
- `rm.materialized.getInstances(Ticket::class, skip = 50)` fetches stored rows (defaults: skip 0, take 50). `rm.materialized.observeInstances(Ticket::class).collect { page -> ... }` emits windows including the initial page; `rm.watch(Ticket::class).collect { changes -> ... }` emits changesets, not initial rows. Cancel the collecting job when done. `IReadModelReactor` handlers such as `fun modified(ticket: Ticket)` consume these changesets, not materialized page differences.
|
|
55
55
|
- For externally queried records `rm.release(ticket, subject)` or `rm.releaseMany(tickets)` returns released values; authorize first.
|
|
56
56
|
- `store.projections.query("from TicketOpened\n set title to subject")` previews a declaration against the event log without registering it. Supply `eventSequenceId` for another sequence. Match `ProjectionQueryResult.Projected` (`entries` JSON or `instancesOf(Ticket::class)`) vs `Invalid` (`errors` with line, column and message). Register graphs and query the graph sink instead. In text, set `automap` or `no automap` in a join’s `with` block to override its scope. Keep the declaration as the source of truth; code generation loses the override.
|
|
57
|
+
- This client has no observer-completion wait. To read a change just appended, use a `@Passive` read model, which is computed from the events on each read, or let the consumer observe the stored view (`rm.materialized.observeInstances`, `rm.watch`). Never sleep for a fixed delay and assume the view has caught up.
|
|
57
58
|
- Inspect `store.observers.getAll()` and `store.failedPartitions.getFor("OpenTickets")` when a view lags. `store.observers.fastForward("OpenTickets")` intentionally abandons backlog; do not use it to repair a mapping.
|
|
58
59
|
|
|
59
60
|
## Definition errors
|
|
@@ -62,8 +63,8 @@ Thrown while the definition is built or registered; fix the declaration.
|
|
|
62
63
|
|
|
63
64
|
| Exception | Cause |
|
|
64
65
|
| --- | --- |
|
|
65
|
-
| `InvalidPropertyForType` | A model-bound
|
|
66
|
-
| `UnknownReadModelProperty` | A builder call names a property the target type does not have |
|
|
66
|
+
| `InvalidPropertyForType` | A validated model-bound path names an event or event-context property whose first path segment (compared case-insensitively) does not exist, including a name defaulted from the annotated property (such as `@Join` without `eventPropertyName`). Not checked: `@Join`'s `on` (a read-model property), `@SetFrom` without an event type, and the payload `property` of `@FromEvery` or `@FromAll` |
|
|
67
|
+
| `UnknownReadModelProperty` | A builder call names a property the target type does not have, or `@ChildrenFrom`'s `orderBy` or `orderByDescending` names a property the child type does not have |
|
|
67
68
|
| `ChildrenOrderingAlreadyDefined`, `ConflictingChildrenOrdering` | A child collection given more than one ordering |
|
|
68
69
|
| `VariantMustDeclareEntersOnEvent` | A variant without the event that activates it |
|
|
69
70
|
| `GlobalHandlerPropertyNotOnVariant` | A shared (global) handler maps a property one variant lacks |
|
|
@@ -17,7 +17,7 @@ Unless noted, imports come from `@cratis/chronicle`. Names in the examples (`Ord
|
|
|
17
17
|
|
|
18
18
|
## Default path
|
|
19
19
|
|
|
20
|
-
Install `@cratis/chronicle`, `@cratis/fundamentals` and `reflect-metadata` in the Node service. Import `reflect-metadata` first in the entry point. Use
|
|
20
|
+
Install `@cratis/chronicle`, `@cratis/fundamentals` and `reflect-metadata` in the Node service. Import `reflect-metadata` first in the entry point. Use the project's single decorator mode: Chronicle supports both, one mode applies to the whole project, and standard decorators are the default. In standard mode, declare event and read-model members as public fields with `@field(Type)`; a field whose default value is a string, number, boolean or class instance is inferred; a field without a default, or with `null` or a plain object as default, needs `@field`, and an array needs its element type (`@field(Array, { genericArguments: [Item] })`). Use legacy mode only when types rely on constructor parameter properties, and then enable `experimentalDecorators` and `emitDecoratorMetadata` together; in legacy mode member types are resolved from the emitted metadata, and `@field(Type)` also works. In standard mode a model-bound read model whose mappings are all on properties registers on import only with a class-level mapping decorator such as `@fromEvent(...)`; otherwise match its module with a discovery pattern, or register the class explicitly before `getEventStore(...)`. Export decorated artifacts from modules loaded before store discovery. For example, with a local development kernel and compiled modules under `dist`:
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
23
|
import 'reflect-metadata';
|
|
@@ -218,6 +218,8 @@ if (!completion.isSuccess) throw new Error('Observer did not complete');
|
|
|
218
218
|
const order = await store.readModels.findInstanceById(Order, orderId);
|
|
219
219
|
```
|
|
220
220
|
|
|
221
|
+
In an Arc application these are different tools (see `cratis-arc-expose-query`). `ChronicleReadConsistency.Immediate` is a read mode only for passive model-bound projections; it is rejected for active ones. A command's `completionTimeoutMs` opts it into waiting for observer completion after the append; the wait also blocks on observers that do not handle the appended events.
|
|
222
|
+
|
|
221
223
|
For a readiness barrier, start consuming the watcher, await `watcher.subscribed` before appending and `watcher.dispose()` in `finally`. `resume: true` reconnects but does not replay missed updates; registering an `onResubscribed` callback also enables resume. `maxBuffered` sets a fail-on-overflow limit rather than default backpressure.
|
|
222
224
|
|
|
223
225
|
## Operate
|
|
@@ -55,11 +55,12 @@ A stored or up-to-date view, a validator over such a view, a reactor, and a posi
|
|
|
55
55
|
- **Stream type / stream ID** restrict the guard to the relevant stream dimensions; event source and stream identity are not interchangeable.
|
|
56
56
|
- **Event types** restrict the guard to the finite set affecting the decision; omitting a relevant type permits stale decisions.
|
|
57
57
|
- **Source-bound operations** reuse a scope for writes to the same source when the SDK offers that shorthand.
|
|
58
|
-
- **Batch scopes** carry checks for several dependencies on one append. Keep source labels and filters consistent; do not discard one of two conflicting guards to make the batch pass.
|
|
58
|
+
- **Batch scopes** carry checks for several dependencies on one append. Keep source labels and filters consistent; do not discard one of two conflicting guards to make the batch pass. Without idempotency keys, every active guard is checked against the state before the batch; if any fails, no event in the batch is appended. Unchecked scopes are skipped. A batch carrying idempotency keys checks only labels that still have new events to write: it drops guards on read-only dependencies and on labels whose events were already appended. Do not use idempotency keys when the decision depends on such a guard.
|
|
59
59
|
- **Tail resolution / routing-derived scope** computes a boundary for the selected dimensions when constructing an optimistic write; a policy applied only at append time does not guard an earlier application read.
|
|
60
60
|
- **Declared dimensions:** where the SDK derives a scope from a registered declaration (see your language reference), a stream's declared concurrency dimensions replace its source's dimensions; they are not added to them. A stream that declares none uses the source's, so a stream cannot opt out; an append without a stream uses the source's. A declared set that omits the `EventSourceId` dimension spans every instance with that route. The scopes are asymmetric: an append scoped to the whole source checks events in all of its streams, but an append scoped to one stream does not check the others. Any derived guard covers only the window from tail lookup to append.
|
|
61
61
|
- **Strategy and first-append policy** choose derived, unchecked or custom behavior for writes without explicit scopes; verify whether an empty scope is checked before relying on a first-write race being detected.
|
|
62
62
|
- **No check** is for unconditional writes, never a fallback for a failed guard.
|
|
63
|
+
- **Revised and redacted history:** a revision or redaction rewrites existing events without appending one. No position moves, so a plain explicit scope does not notice it. The constraint indexes a revision affects are rebuilt from the changed content. Do not assume the same of redaction: a redacted closing or reopening event can leave existing closures as they were. Neither certifies that an earlier application read is still current. A decision read detects it only where the SDK and kernel carry a history-change marker: the C# client does when the kernel reports one, the Go client does not. Use a decision read when the rule must hold against changed history. The marker covers the whole event sequence, so an unrelated revision can also refuse the decision. Without it, pause the affected writers, let in-flight decisions finish, change the history, then resume with fresh reads.
|
|
63
64
|
- **Incomplete-explicit-scope switch** (C# only) decides whether an explicit scope that narrows history but carries no position expects absence or goes unchecked. Keep it expecting absence.
|
|
64
65
|
- **Route/stream-mismatch switch** (C# only) decides whether a definition-linked explicit scope may differ from the append's stream. Keep it strict; express a separate dependency as its own labelled guard.
|
|
65
66
|
|
|
@@ -75,4 +76,5 @@ A stored or up-to-date view, a validator over such a view, a reactor, and a posi
|
|
|
75
76
|
- **Strict unit lifecycle policy** (C# only) rejects staging during or after completion on every unit, not only enforced ones; use it when helpers might stage late.
|
|
76
77
|
- **Validate-only completion** checks the enrolled guards even without staged events where supported; do not report an unchecked no-op as validated.
|
|
77
78
|
- **Early request completion** obtains the owner's commit result before sending a response when middleware would otherwise complete too late.
|
|
79
|
+
- **Check-performed flag:** where the SDK reports it, an append result says whether concurrency checking ran. On a single append it means the scope was compared. An unchecked success (no scope, an explicit no-check, an unchecked first write, a skipped incomplete scope) otherwise looks like a passing check and proves nothing about contention. On a batch the flag is set only when every scope sent was checked, so unset can mean some were checked and others skipped. A batch carrying idempotency keys first drops the guards described under batch scopes. It then sets the flag when, on any append attempt it made, every remaining scope was checkable, even if that attempt failed its check and wrote nothing. Set therefore proves neither that events were written nor that every dependency was checked. Require the flag in contention tests and wherever correctness depends on the guard.
|
|
78
80
|
- **Conflict inspection** maps violated guards back to affected reads. Distinguish stale state from business refusals, constraints, infrastructure failures and unknown outcomes.
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Attach the predicate used by an explicit decision
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Build the scope from the position the decision used
|
|
6
|
+
- Read the result
|
|
7
|
+
- Inspect a scope and a position
|
|
8
|
+
- Refusals before sending
|
|
9
|
+
- Derive a scope only for writes without an earlier decision
|
|
10
|
+
|
|
11
|
+
## Build the scope from the position the decision used
|
|
12
|
+
|
|
3
13
|
Prefer the decision token: it captures both the fold's position and its filters. When you own a different, equally consistent read, import `Cratis.Chronicle.EventSequences.Concurrency` and build its predicate. Here `observed` is the position used by that read, **not** a tail fetched after deciding.
|
|
4
14
|
|
|
5
15
|
```csharp
|
|
@@ -24,12 +34,39 @@ Import `Cratis.Chronicle.Events` for `GetEventType()`.
|
|
|
24
34
|
- Add `.WithEventSourceType(sourceType)`, `.WithEventStreamType(streamType)` or `.WithEventStreamId(streamId)` only for dimensions that bounded the read; omitting a dimension broadens the predicate. `ForEventSource<Trip>(stream: "Departures", streamId: streamId)` uses an `IEventSource` definition to set source type and resolve the declared stream, **not** the source ID.
|
|
25
35
|
- `WithEventType(typeof(SeatReserved))` and `WithEventType(eventType)` accept runtime types and Chronicle event types; `WithEventTypes(watched)` adds a collection. Without a type restriction all matching types count. Never omit a type that can change the rule.
|
|
26
36
|
- For several operations on one source, import `Cratis.Chronicle.EventSequences.Operations` and use `await eventStore.EventLog.ForEventSourceId(source, s => s.WithConcurrencyScope(scope).Append(new SeatReserved())).Perform();`. The configuration overload, e.g. `WithConcurrencyScope(b => b.WithEventSourceId(source).ExpectingNoMatchingEvent())`, builds the scope inline.
|
|
27
|
-
- For a mixed batch use `await eventStore.EventLog.AppendMany(events, concurrencyScopes: new Dictionary<EventSourceId, ConcurrencyScope> { [source] = scope, [other] = otherScope });`. Match the label to the scope's explicit source ID. An independent guard (a label without appended events) must identify its own protected history explicitly. For multiple predicates under one label pass the ordered `IEnumerable<KeyValuePair<EventSourceId, ConcurrencyScope>>` overload with `correlationId` and `tags`.
|
|
37
|
+
- For a mixed batch use `await eventStore.EventLog.AppendMany(events, concurrencyScopes: new Dictionary<EventSourceId, ConcurrencyScope> { [source] = scope, [other] = otherScope });`. Match the label to the scope's explicit source ID. An independent guard (a label without appended events) must identify its own protected history explicitly. For multiple predicates under one label pass the ordered `IEnumerable<KeyValuePair<EventSourceId, ConcurrencyScope>>` overload with `correlationId` and `tags`. With no explicit scope for a label, the client resolves each distinct route (declared dimensions, stream type, stream ID and source type) through the strategy. A route can resolve to no checked guard, for example an empty matching history under default settings. Equal resolved predicates share the earliest expected position, even when they come from different routes; different predicates keep separate guards, and the client never widens them into a whole-source check. In a batch without idempotency keys, several guards under one label, derived or explicit, need a kernel that advertises scope conjunctions. Otherwise the client throws `IncompatibleConcurrencyScopesForEventSource` before sending, and nothing is appended. Upgrade the kernel, or deliberately pass one explicit scope that covers the whole decision and accept broader conflicts. A batch in which any event carries an idempotency key refuses several distinct guards under one label even on a capable kernel, and writes nothing. It also checks only labels that still have new events to write, so it drops independent guards and guards on labels whose events were already appended. Do not use idempotency keys when the decision depends on such a guard. Do not split the batch: separate appends no longer protect the decision atomically. Do not overwrite a guard in a dictionary. Inspect `AppendManyResult.ConcurrencyViolations` (single append: `AppendResult.ConcurrencyViolation`) separately from constraint violations and unknown outcomes.
|
|
38
|
+
|
|
39
|
+
## Read the result
|
|
40
|
+
|
|
41
|
+
Check `HasConcurrencyViolations` on every append. A single append exposes `ConcurrencyViolation`; a batch exposes `ConcurrencyViolations`.
|
|
42
|
+
|
|
43
|
+
- A `ConcurrencyViolation` carries `EventSourceId`, `ExpectedEventSequenceNumber` and `ActualEventSequenceNumber`. When the kernel reports them it also carries `ConflictingEventTypeId` and `ConflictingEventSequenceNumber` (the first matching event after the expected position; both stay empty when that event could not be looked up), `Scope` (the predicate and expected position that failed) and `ScopeIndex`. All four are optional diagnostics and can be absent; a single-scope append can omit `Scope` and `ScopeIndex`. `ScopeIndex` counts the scopes the client sent after merging duplicates and resolving derived ones, not the list you passed: identify the failed guard by `Scope`. A violation caused by revised or redacted history rather than by a new event has equal expected and actual positions and no conflicting event. Log the violation, then read again and make a new decision; never resend the stale events.
|
|
44
|
+
- `ConcurrencyCheckPerformed` on a single append is true only when its scope was actually compared against the event store. It is false for `ConcurrencyScope.None`, when no scope was supplied or resolved, for an unchecked first append into a scope, and for an incomplete scope that was skipped. A success with false proves nothing about contention. Assert true in contention tests and whenever correctness depends on the guard running.
|
|
45
|
+
- On a batch the flag is true only when every scope sent was checked. False can therefore mean that some scopes were checked and others skipped: make every scope checkable rather than reading false as "nothing ran". A batch carrying idempotency keys is different. It first drops the guards on read-only labels and on labels already appended. It then reports true when, on any append attempt it made, every remaining scope was checkable; one unchecked remaining scope keeps that attempt false. An attempt that failed its check and wrote nothing still counts. True there proves neither that events were written nor that every dependency was checked.
|
|
46
|
+
|
|
47
|
+
## Inspect a scope and a position
|
|
48
|
+
|
|
49
|
+
- `scope.ExpectsNoMatchingEvent` is true when the scope asserts absence, which is what `.ExpectingNoMatchingEvent()` builds.
|
|
50
|
+
- `scope.IsIncomplete` is true when the scope is neither `NotSet` nor `None` and carries neither a position nor an absence expectation. An incomplete explicit scope that narrows history is treated as expecting absence unless `SkipIncompleteExplicitScopes` is on; one with no narrowing at all is sent unchecked.
|
|
51
|
+
- `EventSequenceNumber.First` is position zero, a real position. A tail lookup over empty matching history returns `EventSequenceNumber.Unavailable` (`IsUnavailable`); `IsActualValue` is true only for a real position. Express absence with `.ExpectingNoMatchingEvent()`, never with `First` or `Unavailable`.
|
|
52
|
+
|
|
53
|
+
## Refusals before sending
|
|
54
|
+
|
|
55
|
+
The client throws these while building or validating the append. Nothing is sent and nothing is appended. Fix the scope; do not drop a guard to make the append pass.
|
|
56
|
+
|
|
57
|
+
| Exception | Cause | Fix |
|
|
58
|
+
| --- | --- | --- |
|
|
59
|
+
| `ConcurrencyScopeLabelMustBeSpecified` | An event target or a scope label is unspecified, empty or whitespace | Give every event and every scope a real source ID |
|
|
60
|
+
| `ConcurrencyScopeEventSourceIdDoesNotMatchLabel` | A scope narrows by a source ID other than the label it is passed under | Label the scope with the source ID it narrows by |
|
|
61
|
+
| `IndependentConcurrencyScopeMustBeExplicit` | A label without appended events has a scope that is `NotSet` or incomplete | Give that scope a position or `.ExpectingNoMatchingEvent()` |
|
|
62
|
+
| `DuplicateConcurrencyScopeForEventSourceId` | One label carries contradictory scopes: the same predicate with two different positions, or `None` or `NotSet` mixed with another scope | Keep one scope per predicate; do not mix unchecked and checked scopes under a label |
|
|
63
|
+
| `IncompatibleConcurrencyScopesForEventSource` | Several distinct guards under one label on a kernel that does not advertise scope conjunctions | Upgrade the kernel, or pass one explicit scope that covers the whole decision; do not split the batch |
|
|
64
|
+
| `ConcurrencyScopeStreamDoesNotMatchAppend` | A definition-linked scope (`ForEventSource<T>(stream: ...)`) names another stream of the same definition than the single append is routed to | Guard the append's own stream. To guard another stream of the same source as well, use the ordered `AppendMany` overload and pass that stream's scope under the append's source label, not under a separate label. Pass the write-side scope explicitly beside it: an explicit scope for a label replaces the derived one |
|
|
28
65
|
|
|
29
66
|
## Derive a scope only for writes without an earlier decision
|
|
30
67
|
|
|
31
68
|
`ConcurrencyOptions.DefaultStrategy` defaults to `typeof(OptimisticConcurrencyStrategy)`. The strategy's `GetScope(source, eventTypes: watched)` reads the tail with the same filters it puts on the predicate. Its `GetScope(dimensions, source, ...)` overload applies the definition's concurrency dimensions, so a guard need not be per source. `[EventStream("Stream", Concurrency = ConcurrencyDimensions.EventSourceId | ConcurrencyDimensions.EventStreamType | ConcurrencyDimensions.EventStreamId)]` replaces the `[EventSource(..., Concurrency = ...)]` dimensions for appends through that stream; include `EventSourceId` when the rule is per instance. A strategy evaluated at append time cannot protect an earlier read.
|
|
32
69
|
|
|
33
|
-
- Set `options.ConcurrencyOptions.CheckFirstAppendIntoAScope = true` to have the optimistic strategy expect absence on an empty filtered tail. By default it skips the first check. An explicit absence expectation does not depend on this option.
|
|
34
|
-
- For a custom strategy set `DefaultStrategy = typeof(MyStrategy)` implementing `IConcurrencyScopeStrategy
|
|
35
|
-
- Keep `SkipIncompleteExplicitScopes` false: a narrowed explicit scope missing a position otherwise becomes unchecked rather than expecting absence. Keep `AllowRouteScopeStreamMismatch` false: a definition-linked explicit scope must match a single append's stream.
|
|
70
|
+
- Set `options.ConcurrencyOptions.CheckFirstAppendIntoAScope = true` to have the optimistic strategy expect absence on an empty filtered tail. By default it skips the first check. Do not design on an unchecked first append: turn the option on, or pass `ConcurrencyScope.None` where an unchecked write is intended. An explicit absence expectation does not depend on this option.
|
|
71
|
+
- For a custom strategy set `DefaultStrategy = typeof(MyStrategy)` implementing `IConcurrencyScopeStrategy` (assigning any other type throws `TypeIsNotAConcurrencyStrategy` at configuration); do not substitute custom strategy guards for enforced read protection. Return `ConcurrencyScope.None` only when an unchecked write is intended.
|
|
72
|
+
- Keep `SkipIncompleteExplicitScopes` false: a narrowed explicit scope missing a position otherwise becomes unchecked rather than expecting absence. Keep `AllowRouteScopeStreamMismatch` false: a definition-linked explicit scope must match a single append's stream. Instead of weakening route validation, pass a dependency on another source as a labelled independent condition, and one on another stream of the same source under that source's label in the ordered batch overload.
|
|
@@ -59,6 +59,7 @@ public class ReserveSeatValidator : CommandValidator<ReserveSeat>
|
|
|
59
59
|
|
|
60
60
|
- Inject the decision model into the command path; an earlier display read does not guard a later append.
|
|
61
61
|
- Treat a concurrency refusal as a stale decision; read and decide again rather than resending the event.
|
|
62
|
+
- Treat a passing validate-only call (`{url}/validate`) as form feedback. Under `On` it runs the validators against fresh reads, except for advisory ones; under `Off` or `Measure`, and for advisory reads, a validator can see stored state that lags. Either way nothing is guarded or written, so it does not promise that executing the command commits.
|
|
62
63
|
|
|
63
64
|
## Check the capacity rule
|
|
64
65
|
|
|
@@ -88,7 +89,7 @@ Return both events in one `IEnumerable<EventForEventSourceId>` batch: `SeatReser
|
|
|
88
89
|
|
|
89
90
|
- Prefer an injected model: use the command's source key, `[LookUpBy(nameof(Property))]` for another command property, or `[LookUpBy<CallerSubject>]` in `Handle` for the authenticated subject.
|
|
90
91
|
- For a key on another protected model in the same member, use `[LookUpBy("order", nameof(OrderSummary.CustomerId))]`. The property must match the target key type; both reads are guarded under `On`.
|
|
91
|
-
- For keys injection can't express (such as a service-computed hash), compute the key in `Handle` under `On` and await the injected `IDecisionReads.Get<T>(key
|
|
92
|
+
- For keys injection can't express (such as a service-computed hash, or a key only an application service can supply), compute the key in `Handle` under `On` and await the injected `IDecisionReads`. Use `Get<T>(key)` for a source-scoped model. For a per-stream model, use `Get<T>(eventSourceId, eventStreamType, eventStreamId, eventSourceType)`, always passing the declaration's event source type and stream type for an `[EventStream<TSource>]` model (an omitted or different value is refused with `StreamScopeDoesNotMatchReadModel`); a key-only read of a per-stream model is refused with `ReadModelRequiresStreamScope`. Keep the reader in `Handle`; never move it into `Provide()` to silence `ARCCHR0040`. `ARCCHR0040` is Info only: it has no code fix and changes no runtime behaviour. Suppress it only around that declaration (`#pragma warning disable ARCCHR0040` … `restore`), with a concrete reason and a link to the issue tracking the missing binding; never project-wide. Suppression does not waive concurrency, authorization or acquisition-failure handling.
|
|
92
93
|
|
|
93
94
|
A null or blank secondary scalar key gives a nullable model parameter `null` without a read or guard. A valid key with no instance still keeps its guard: if no matching event exists yet, the first matching append by someone else refuses this one. For required keys, reject blanks before invocation if you need a field message: acquisition can fail before validator rules run.
|
|
94
95
|
|
|
@@ -116,7 +117,12 @@ The full pattern, other routes and failures are in the `cratis-arc-declare-comma
|
|
|
116
117
|
|
|
117
118
|
## Failures that mean the command is wired wrong
|
|
118
119
|
|
|
119
|
-
|
|
120
|
+
Tell the two kinds of refusal apart first:
|
|
121
|
+
|
|
122
|
+
- **A stale or incomplete read** arrives as `ReadChanged` (a guarded read was no longer current at commit: a competing write, or a revision or redaction of the sequence's history) or `ReadIncomplete` (the fold did not reach a consistent position, with or without a competing write; Chronicle attempts it up to three times). Both are a `400` validation result with reason `concurrencyViolation`. `ReadIncomplete` always carries its name as detail; `ReadChanged` carries it only under `On`. Nothing was written and the command is never re-run for you: keep the input, read fresh state and resubmit deliberately.
|
|
123
|
+
- **A wiring defect** is every failure in the table below. It is thrown as an exception and, with the default HTTP mapping, surfaces as a server error (`500`) that no retry fixes. An exception response mapping can change the status, not the cause. Change the code; never catch and retry it.
|
|
124
|
+
|
|
125
|
+
The failures below are code defects, not competing writes. Most are raised under `On`; a row says so where another mode applies.
|
|
120
126
|
|
|
121
127
|
| Failure | Cause | Fix |
|
|
122
128
|
| --- | --- | --- |
|
|
@@ -124,10 +130,22 @@ Under `On` these are code defects, not competing writes. Fix the command; never
|
|
|
124
130
|
| `ImmediateAppendWhileReadsAreProtected` | The command appended directly instead of through its commit | Return the event from `Handle`, or append through `IEventLog.Transactional` |
|
|
125
131
|
| `ReadOfSourceWithStagedEvents` | A source was read after events for it were staged; the read cannot see them | Decide once in the outer command and pass the value down |
|
|
126
132
|
| `ReadAfterProtectedCommit` | A read ran after an aggregate `Commit()` | Read before committing; return the commit result last |
|
|
127
|
-
| `ReadAndAggregateOnSameSource` | A read model and an aggregate
|
|
128
|
-
| `DecisionReadConflictsWithConcurrencyScope` |
|
|
133
|
+
| `ReadAndAggregateOnSameSource` | A protected read model and an aggregate use the same event source ID label at runtime, even if their stream or source types differ. Under `On`, analyzer `ARCCHR0033` warns earlier, but only when an automatically injected aggregate and read-model parameter statically resolve to the same key; the runtime check is authoritative | Decide from the aggregate's state, or mark a read that does not decide `[Unprotected("why")]`. A protected read of a different event source ID may stay beside the aggregate |
|
|
134
|
+
| `DecisionReadConflictsWithConcurrencyScope` | Without enforcement (`Off` or `Measure`), one source has both a decision read and an explicit concurrency scope. Under `On` a scope that covers the read is accepted instead (see "Which scope guards the append?") | Remove the explicit scope, or do not decision-read that source |
|
|
129
135
|
| `DeclaredRoutingNotCoveredByExplicitScope` | An explicit scope is narrower than the concurrency the event source declares | Widen the scope or remove the declared concurrency |
|
|
130
136
|
| `DecisionReadRequiresUnitOfWork` | A decision read ran with no ambient unit of work | Read inside the command or an owned unit |
|
|
137
|
+
| `ProtectedUnitOfWorkRequiresOwner` | Command code called `Commit()`, `Rollback()` or `Dispose()` on the unit of work. Arc owns the command's unit and is the only one allowed to complete it, so that a decision cannot be committed half-guarded | Return the events from `Handle` and let Arc commit; never complete the unit yourself |
|
|
138
|
+
| `ReadModelInjectedOutsideDecision` | Under `On`, a read model was resolved through dependency injection anywhere other than `Handle` or a validator constructor, for example in a command filter or a service. A declared per-stream model and a type marked `[Unprotected]` are not refused there | Take the model as a parameter of `Handle` or of the `CommandValidator<T>` constructor and move the rule there. If it is only context, mark the read-model type `[Unprotected("why")]` |
|
|
139
|
+
| `ReadModelStreamNotOnCommandRoute` | A per-stream model parameter whose declared source or stream is not the command's route, or the command has no explicit stream ID. Refused in every mode, not only `On` | Route the command to the model's source and stream with an explicit stream ID, or read another stream explicitly through `IDecisionReads` directly in `Handle`, with a reasoned `ARCCHR0040` suppression as described under the lookup keys above |
|
|
140
|
+
| `ConcurrentNestedCommandsUnderReadProtection` | A nested command started while another nested command of the same outer command was still running, and one of the commands involved has read protection `On` | Await nested commands one after another |
|
|
141
|
+
| `NestedEarlyCompletionUnderReadProtection` | A nested command committed the outer command's unit (an aggregate `Commit()`) | Commit in the outer command |
|
|
142
|
+
| `CommandCannotBeBothProtectedAndUnprotected` | `[ProtectedDecision]` and `[Unprotected]` on one command | Keep one |
|
|
143
|
+
| `ConflictingReadProtection` | `[ReadProtection]` with `On` or `Measure` and `[Unprotected]` on one command | Keep one |
|
|
144
|
+
| `ConflictingContributionsOnLabel`, `ConflictingExplicitScopes` | Two explicit or aggregate guards on one event source contradict each other: the same predicate with two expectations, or a no-check scope mixed with a checked one | Reconcile them into one expectation per predicate, or remove the no-check scope. Guards with distinct predicates may share a source; do not drop an independent guard |
|
|
145
|
+
| `ReservedConcurrencyScopeLabel` | A scope label starts with `$read-protection/` | Use another label |
|
|
146
|
+
| `ReadProtectionRequiresTheDefaultConcurrencyStrategy` | A custom concurrency strategy is configured and the commit appends an event to a source that a protected read also guards. A protected read of a source the commit does not write to does not trigger it | Use the default strategy for commits that write to a source they read under protection |
|
|
147
|
+
| `ReadDependencyTargetMismatch` | A guard belongs to another event store, namespace or event sequence than the unit that commits | Read and write in the same store, namespace and sequence |
|
|
148
|
+
| `SourceLessReadNotSupported` | A read with no event source | Read a source-keyed model |
|
|
131
149
|
|
|
132
150
|
## Related skills
|
|
133
151
|
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Read and stage the Elixir decision in the same process
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Admission and stream reads
|
|
6
|
+
- Detached evidence and ownership
|
|
7
|
+
- Explicit append predicates
|
|
8
|
+
- Not supported in this SDK
|
|
9
|
+
|
|
3
10
|
Start the configured `Cratis.Chronicle.Client` against the target store, with the event modules registered and `read_models: [Bay]`. Names are illustrative. Let `Bay` project `BayAssigned` and remove the instance on `BayReleased`, both keyed by bay source ID. Use a binary ID and the same client, namespace and event log throughout.
|
|
4
11
|
|
|
5
12
|
```elixir
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# Guard a decision in Go
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Guard a decision made from source history
|
|
6
|
+
- Model reads on a preflight-admitted deployment only
|
|
7
|
+
- Arc command decisions
|
|
8
|
+
- Diagnose refusal versus conflict
|
|
9
|
+
- Not supported in this SDK
|
|
10
|
+
|
|
11
|
+
The Go client's model-based decision reader requires a successful preflight with an exact server **and** protocol match, and a model shape that passes admission. The match is an allowlist of exact versions, not a minimum: a newer kernel is refused as well. A read can fail in three distinct ways. Model shape admission runs first, locally and without contacting the server: an inadmissible model returns a `*readmodels.DecisionReadRefused` carrying the model and a reason. An admitted model then needs the connection: a failed preflight returns its own compatibility or transport error. When preflight succeeds but the server and protocol pair is not on the allowlist, the error wraps `chronicle.ErrUnsupported`. Match each with `errors.As` or `errors.Is`; do not treat them as one condition. The current kernel is outside that allowlist. Send the intent to a compatible writer that both decides and commits, or use an explicit history-based guard if it covers every fact. `WithSkipCompatibilityCheck` does not enable model reads. An Arc command reads through the same reader, so the same admission applies there. Names below are illustrative; SDK subpackages are under `github.com/cratis/chronicle.go` (root import `chronicle`).
|
|
4
12
|
|
|
5
13
|
## Guard a decision made from source history
|
|
6
14
|
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Guard the Java append with the history actually read
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- One bay, two events that determine occupancy
|
|
6
|
+
- Select only dimensions the decision actually used
|
|
7
|
+
- Share a guard or check several sources atomically
|
|
8
|
+
- Routing-derived guards are for writes without earlier decision evidence
|
|
9
|
+
- Not supported in this SDK
|
|
10
|
+
|
|
3
11
|
Use the Chronicle JVM client with a connected `EventStore` in the intended namespace. Register the `@EventType` classes before reading or appending. Use the blocking facade from `io.cratis.chronicle.java` in the command owner. It does not turn a read-model lookup into a protected read. `BlockingEventStore.getEventLog()` already returns a `BlockingEventSequence`; wrap only a suspending store's log yourself. The static bridges below take the suspending sequence, so pass `log.unwrap()` when you hold the blocking one.
|
|
4
12
|
|
|
5
13
|
## One bay, two events that determine occupancy
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Guard an append with the history used by a Kotlin decision
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Default: read, decide, append with an explicit predicate
|
|
6
|
+
- Several events or dependencies
|
|
7
|
+
- Routing-derived checks
|
|
8
|
+
- Staging a guarded append in a unit of work
|
|
9
|
+
- Inspecting the result
|
|
10
|
+
- Not supported in this SDK
|
|
11
|
+
|
|
3
12
|
Use the connected store's `eventLog` (or the same `IEventSequence` for both operations) from a suspending command. Register the event types in that store. Names are illustrative.
|
|
4
13
|
|
|
5
14
|
## Default: read, decide, append with an explicit predicate
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Guard the history used by a Node command
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Read, decide and append
|
|
6
|
+
- Guard more than one dependency
|
|
7
|
+
- Choose a policy only for writes without explicit evidence
|
|
8
|
+
- Not supported in this SDK
|
|
9
|
+
|
|
3
10
|
## Read, decide and append
|
|
4
11
|
|
|
5
12
|
Use `@cratis/chronicle` on the server. Obtain the event log from the command's configured client, store and namespace. The example assumes registered `@eventType()` classes `BayClaimed` and `BayReleased`; these are the only events that change occupancy, and each is routed to the affected bay. Names are illustrative.
|
|
@@ -31,6 +31,6 @@ Names are illustrative. To protect a technician's contact number:
|
|
|
31
31
|
- **Managed query:** use a supported releasing query after authorization; verify both storage and query output because release passes unprotected plaintext through.
|
|
32
32
|
- **Explicit release:** for raw storage, cached instances or watch results that have not been released, use the SDK's release operation with intact ownership metadata; use collection release for multiple instances where available. Never log the result.
|
|
33
33
|
- **Subject erasure:** delete the subject key in the approved namespace. For an application store this fences the subject across registered non-system stores there, deletes the key, evicts cached keys and removes associated uniqueness claims; it does not delete the documents. Resolve incomplete coverage or partial failures and retry.
|
|
34
|
-
- **Erasure-aware event read:** when an empty value must be distinguished from an erased field, opt into erased property paths where available, outside command decision logic. Empty values alone prove nothing: wrong-key decryption can also empty a property, and transport or key-store failures can fail the read.
|
|
34
|
+
- **Erasure-aware event read:** when an empty value must be distinguished from an erased field, opt into erased property paths where available, outside command decision logic. Empty values alone prove nothing: wrong-key decryption can also empty a property, and transport or key-store failures can fail the read. A path is listed only when its value is recognized as ciphertext, the key it needs is deleted or fenced (the key revision recorded in the value, or the subject's current key when the value records none) **and** the subject's erasure was recorded; values not recognized as ciphertext, decryptable values, missing keys without a recorded erasure and other release failures are never listed. A newer live key does not stop a value with a recorded revision from being listed, but a value without one is tried against that newer key and can fail the read instead. Recognition is by shape only (the legacy format is any Base64 value of a fixed decoded length), and nothing is decrypted once the key is gone, so a listed path proves neither that the value was encrypted nor that the ciphertext was intact. An unlisted path or an empty list therefore proves nothing: the list is not an erasure audit and cannot certify that nothing is left to erase. The paths describe only the returned current content, not the separately stored original, revision-history or per-generation content. A server without this read fails the call rather than returning an empty list; treat that as a failed read.
|
|
35
35
|
- **New lifecycle:** only after separate approval, allow a new key for future personal data. The fence otherwise refuses provisioning; the new key cannot unlock old ciphertext.
|
|
36
36
|
- **Redaction and retention:** key erasure empties only values that were marked personal when they were written. To remove the content of particular recorded events (selected event types for a source, or plaintext written before marking), redact those events with a reason that contains no personal data; `cratis-chronicle-record-event` owns the call and its limits. Redaction keeps the event's position and replaces its content with a marker; routing identifiers, tags and subject remain; the marker keeps the original Occurred, CorrelationId and CausedBy (causation types only, without property values), and the event's own context records the redaction. Copies outside the sequence are untouched. Every reducer or reactor that derived state from those types should also handle the marker (`EventRedacted` in C#) to remove or sanitize that state. Redaction is not a substitute for subject erasure. Omit causation property values on new writes if they should not be retained; deleting a key does not scrub existing causation metadata. Erasure also leaves the acting identity's display name in event metadata: renaming an identity corrects a name, appends no event and erases nothing, so keep personal data out of identity names that must be erasable. Plan separately for historical plaintext, other namespaces, downstream recipients, exports, backups and recoverable key copies.
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Protect technician contact details in C#
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Classify the event and its destination
|
|
6
|
+
- Supply policy when annotations are unavailable
|
|
7
|
+
- Query after authorization
|
|
8
|
+
- Erase and verify under the provisioning fence
|
|
9
|
+
- Not supported in this SDK
|
|
10
|
+
|
|
3
11
|
Use the `Cratis.Chronicle` client with an `IEventStore` bound to the intended store and namespace. Register events and projections through normal client discovery. The examples use opaque IDs; never put a contact number in a route, reason, schema annotation or log.
|
|
4
12
|
|
|
5
13
|
## Classify the event and its destination
|
|
@@ -29,9 +37,10 @@ Here an order owns the history, but the technician owns the contact data. `[Subj
|
|
|
29
37
|
|
|
30
38
|
- Mark a class (concept or value object) only if every use is personal. Otherwise mark just the personal property or constructor parameter. Mark destinations separately, including reducer result types. Inspect both registered schemas and test a synthetic value at rest and after release.
|
|
31
39
|
- Marking a nested member protects that member. Marking a collection property (e.g. `[PII] string[] ContactNumbers`) protects the whole collection, precluding element indexing; erasure empties it. To retain other members, mark the personal members of a concrete item type instead.
|
|
40
|
+
- Edge case, dictionaries and polymorphic values: protection follows the members the registered schema declares and classifies, so prefer a concrete value object with declared members for personal data. A dictionary is protected in one of two ways: classifying the dictionary property itself protects the whole dictionary as one value, with no separate classification of its entries, while an unclassified dictionary property protects individual entry values only if the registered schema classifies the value type (for example a `[PII]` concept as the value). A polymorphic value may lack the declared members needed to classify its personal fields, and a schema reference that cannot be resolved contributes no classification of its own: only a classification declared on the referring property still applies. Inspect the registered schema before relying on any of these.
|
|
32
41
|
- Details default to empty and document purpose, not key selection. Nonempty resolved `[ComplianceDetails]` takes precedence; otherwise the first nonempty PII details on the property, matching parameter, declaring type or property type win, in that order.
|
|
33
42
|
- `[PII(SpecialCategory = SpecialCategory.Health)]` classifies Article 9 data. Alternatives are `RacialOrEthnicOrigin`, `PoliticalOpinions`, `ReligiousOrPhilosophicalBeliefs`, `TradeUnionMembership`, `Genetic`, `Biometric`, `SexLifeOrSexualOrientation`; default `None`. `[PII(Criminal = true)]` classifies conviction/offense data; `[PII(OperationalSecret = true)]` classifies personal data that is also a secret. Both flags default to false. These flags are not emitted as schema metadata and add no protection layer.
|
|
34
|
-
- For a **non-personal** secret use `[Encrypted]` on a property, parameter or class instead. Its default `EncryptionScope.Subject` uses a separate non-erasable-by-PII key; `[Encrypted(EncryptionScope.Namespace, details: "Authenticate the dispatch integration")]` shares a key within the store namespace; `EncryptionScope.Global` shares across the installation. Details default to empty. Never combine with PII on the same value.
|
|
43
|
+
- For a **non-personal** secret use `[Encrypted]` (`Cratis.Chronicle.ProtectedValues`, like `EncryptionScope`) on a property, parameter or class instead. Its default `EncryptionScope.Subject` uses a separate non-erasable-by-PII key; `[Encrypted(EncryptionScope.Namespace, details: "Authenticate the dispatch integration")]` shares a key within the store namespace; `EncryptionScope.Global` shares across the installation. Details default to empty. Never combine with PII on the same value.
|
|
35
44
|
- Adding protection metadata to an existing generation protects future writes only. Removing or changing existing protection metadata in place is refused. Review earlier plaintext and other writers before rollout.
|
|
36
45
|
|
|
37
46
|
## Supply policy when annotations are unavailable
|
|
@@ -51,7 +60,7 @@ public sealed class PagerPolicy : ICanProvideComplianceMetadataForProperty
|
|
|
51
60
|
|
|
52
61
|
For an always-personal external concept implement `ICanProvideComplianceMetadataForType` instead (`bool CanProvide(Type type) => type == typeof(ExternalPagerNumber);`, `ComplianceMetadata Provide(Type type) => new(ComplianceMetadataType.PII, "Reach the technician");`). Verify the generated schema rather than assuming a provider was discovered.
|
|
53
62
|
|
|
54
|
-
Confidentiality has its own pair of discovered providers, for a non-personal secret on a type you cannot mark `[Encrypted]`: `ICanProvideSecurityMetadataForType` and `ICanProvideSecurityMetadataForProperty` (`Cratis.Chronicle.Confidentiality`), with the same `CanProvide`/`Provide` shape, returning `new SecurityMetadata(SecurityMetadataType.EncryptedSubject, "Authenticate the dispatch integration")`. `EncryptedNamespace` and `EncryptedGlobal` select the wider key scopes. Never let a compliance provider and a security provider both classify the same value.
|
|
63
|
+
Confidentiality has its own pair of discovered providers, for a non-personal secret on a type you cannot mark `[Encrypted]`: `ICanProvideSecurityMetadataForType` and `ICanProvideSecurityMetadataForProperty` (`Cratis.Chronicle.Confidentiality`, with `SecurityMetadata` and `SecurityMetadataType`; `[Encrypted]` is not there), with the same `CanProvide`/`Provide` shape, returning `new SecurityMetadata(SecurityMetadataType.EncryptedSubject, "Authenticate the dispatch integration")`. `EncryptedNamespace` and `EncryptedGlobal` select the wider key scopes. Never let a compliance provider and a security provider both classify the same value.
|
|
55
64
|
|
|
56
65
|
## Query after authorization
|
|
57
66
|
|
|
@@ -78,7 +87,23 @@ var history = await eventStore.EventLog.GetFromSequenceNumberWithErasedPropertie
|
|
|
78
87
|
var erasedPaths = history.SelectMany(entry => entry.Context.ErasedProperties);
|
|
79
88
|
```
|
|
80
89
|
|
|
81
|
-
Check the expected field paths on the affected event and query the view afresh; confirm the control still releases. The read optionally takes `filterEventTypes` as well as `eventSourceId`; omit the source only when the wider read is intended. Erasure fences new provisioning, removes the key, evicts cached keys and removes associated uniqueness claims across registered non-system stores in the namespace for an application store. Discovery and permission must cover the targets.
|
|
90
|
+
Check the expected field paths on the affected event and query the view afresh; confirm the control still releases. The read optionally takes `filterEventTypes` as well as `eventSourceId`; omit the source only when the wider read is intended. Erasure fences new provisioning, removes the key, evicts cached keys and removes associated uniqueness claims across registered non-system stores in the namespace for an application store. Discovery and permission must cover the targets. `DeleteEncryptionKeyFor` throws when any erasure step fails. A call that returns means the configured key storage completed its erasure operations without a reported failure; it is not by itself proof of a confirmed erasure, because a storage backend without fencing guarantees (a standalone MongoDB server, for example) erases without the confirmation step. Where confirmation matters, run key storage on a backend that provides it (a MongoDB replica set) and verify the result as described here. The kernel collects the failures of an erasure that started but did not complete in every event store as `EncryptionKeyErasureIncomplete`; the call can also fail before any deletion, when permission or coverage of the target stores is not established, or with a single refusal outside that collection. Treat every failed call as an unconfirmed erasure, whatever its cause: resolve the cause and repeat the same call. Do not report document deletion or coverage of forwarded copies, other namespaces or recoverable backups.
|
|
91
|
+
|
|
92
|
+
After erasure the stored event remains in the log and is still returned by reads. Each protection boundary whose key was erased comes back as the JSON default of its schema type:
|
|
93
|
+
|
|
94
|
+
| Protection boundary | Released JSON |
|
|
95
|
+
| --- | --- |
|
|
96
|
+
| String | empty string |
|
|
97
|
+
| Non-nullable number or boolean | `0` or `false` |
|
|
98
|
+
| Nullable number or boolean | `null` |
|
|
99
|
+
| Collection protected as a whole | empty collection |
|
|
100
|
+
| Object protected as a whole | empty object |
|
|
101
|
+
|
|
102
|
+
The boundary is where the classification sits, not the C# type. A value object classified on its members keeps its outer shape, and each classified member follows its own row; only a container protected as one value is emptied. These are JSON defaults, not typed values, so a typed read of an erased event can throw, and not only for containers: a scalar whose C# type has no representation for the default fails too. A protected `Guid`, date or other formatted value is a JSON string and comes back as `""`, which the .NET deserializer rejects, and an emptied object or collection may not fit its C# type. The erased-properties read materializes typed `Content` the same way, so it can throw on the same event. Prefer `string` or string-backed concepts for protected members, and test a typed read of an erased event for every protected member type. An ordinary read cannot tell these from genuine values, so never treat a `0`, `false` or empty value on a protected member as a business fact. Where the difference matters, use the erased-properties read above.
|
|
103
|
+
|
|
104
|
+
`ErasedProperties` is also available directly on each returned `AppendedEvent`. Paths use JSON/schema names, dotted members and bracketed indices, such as `profile.name` or `contacts[0].email`; a protected whole container reports only its boundary (`contacts`). Dictionary keys are not escaped, so a path such as `contacts.work.email` can mean a literal `work.email` key rather than nested members; do not treat paths as unambiguous field addresses, and treat them as potentially sensitive because they can contain dictionary keys. `Content` still holds the released defaults with no markers. The paths describe the current `Content` only, never `OriginalContent`. On a server without this read the call throws an `RpcException` (`StatusCode.Unimplemented`) instead of returning an empty list.
|
|
105
|
+
|
|
106
|
+
While the subject is fenced, appending a protected personal value for it is refused; the kernel names this refusal `EncryptionKeyErased`. No replacement key is created and nothing is stored blank. Both failure names are kernel names used in the product documentation; the C# client has no exception types for them and kernel logs are not promised to carry them, so do not catch by type or match on message text. A fence refusal normally returns an unsuccessful result (`IsSuccess` false, the kernel's message in `Errors`), but an unsuccessful result or an exception does not by itself prove a refusal. `result.Errors.Contains(AppendError.AppendOutcomeUnknown)`, a timeout or a dropped connection means the append may have committed, and it may still be executing after the caller has given up. Reading the event source's events for the attempt's correlation ID can confirm a commit, but a read that finds nothing is not proof that nothing was or will be written, so retrying on a negative read alone can duplicate the event. Make the attempt repeatable instead: append with `EventLog.AppendOnce(eventSourceId, @event, idempotencyKey, ...)`, keep the `IdempotencyKey` chosen for the original attempt, and retry with that same key. A repeat of an append that did commit writes nothing and reports it through `result.Outcome` (`AppendOutcome.AlreadyAppended`; `result.WasAlreadyAppended`). `AppendOnce` throws `IdempotentAppendsNotSupported` before sending anything when the key cannot be honored. The refusal message contains the subject identifier, so keep it out of user-facing responses.
|
|
82
107
|
|
|
83
108
|
Only after independent approval for **future** personal data: `await eventStore.PII.AllowNewEncryptionKeyFor(technicianId.ToString());`. Never do this automatically on refusal to provision. A new key cannot release earlier ciphertext.
|
|
84
109
|
|
|
@@ -39,11 +39,11 @@ C#-only: derived publication, the output sequence override, keyed append-once, n
|
|
|
39
39
|
- **Namespace and history:** Matching namespace names are case-insensitive; forwarding does not create a missing source namespace. A fresh subscription reads retained history from the beginning; an existing checkpoint resumes even after a disconnect.
|
|
40
40
|
- **Metadata and protection:** Forwarding preserves event-source identity, stream route, tags and subject. A missing target subject key may be copied if permitted; an erased subject's blocked key is not restored. Handle downstream copies separately from namespace-wide key erasure.
|
|
41
41
|
- **Recovery:** Replay the inbox observer to reprocess existing rows. Replay the source forwarding observer only to deliver retained publications again: this can append additional inbox rows. Make downstream effects tolerate repeats.
|
|
42
|
-
- **Across separate kernels (federation):** an operator binds the logical source name to the producing kernel and the producer grants the stores, namespaces and event types that may be read. Application code does not change: the same origin declarations and subscriptions decide what arrives. Setup is in `cratis-chronicle-deploy-kernel`.
|
|
42
|
+
- **Across separate kernels (federation):** an operator binds the logical source name to the producing kernel and the producer grants the stores, namespaces and event types that may be read. Application code does not change: the same origin declarations and subscriptions decide what arrives. Setup is in `cratis-chronicle-deploy-kernel`. Only public types cross a link. Among requested, granted events, the producer withholds the whole event when its registered schema carries compliance metadata (such as a personal-data marking) anywhere it can reach, or when it cannot determine that, such as through an unresolved dynamic reference: it skips the event, counts it in a metric and moves past it. It does not inspect payloads, so it neither detects unmarked personal data nor withholds values marked only for encryption. Keep personal data and secrets out of a type meant for another kernel; record them in a private event. Subject keys and erasure never cross a link; the key copy under metadata applies only within one kernel.
|
|
43
43
|
|
|
44
44
|
## Kernel-run integrations with systems outside Chronicle
|
|
45
45
|
|
|
46
|
-
Use
|
|
46
|
+
Use webhooks, external services and HTTP captures only when the other side is not a Chronicle store; a public-events capture is the exception: it reads this store's own inbox, where another Chronicle store's events arrive, and calls no external service. They are edge cases next to the outbox and inbox above. For webhooks, external services and HTTP captures the kernel, not the application, makes the calls, so the target must be reachable from the kernel and allowed by the kernel's destination policy (`cratis-chronicle-deploy-kernel`, webhooks reference). The application only registers the definition; a completed registration proves neither delivery nor that the definition changed. Read the stored definition back, then verify an actual delivery. What each SDK can register is in its integrations reference, linked from `references/<language>.md`.
|
|
47
47
|
|
|
48
48
|
| Integration | What it is | What to know |
|
|
49
49
|
|---|---|---|
|
|
@@ -58,7 +58,7 @@ Use these only when the other side is not a Chronicle store. They are edge cases
|
|
|
58
58
|
- The status code selects the recovery: 5xx, 408, 429 and connection failures are retried with backoff; 429 or 503 with `Retry-After` defers the partition without spending a retry; 410 parks the partition until an operator acts; any other 4xx pauses the whole webhook as a configuration problem. A receiver that is warming up answers 503 with `Retry-After`, never 400 or 404.
|
|
59
59
|
- One observer ID is served either by a webhook or by connected clients, never both. Registration is refused while a client serves that ID in any namespace; some SDKs report the refusal only as a warning.
|
|
60
60
|
- Registration replaces the whole definition. Header values and credentials are never returned on read, so never register a definition that was read back.
|
|
61
|
-
- Signing is off by default. With signing on, the receiver verifies each request against the event store's public signing keys, on the raw body, and accepts every key the store currently lists so that a key rotation does not reject deliveries. Signing does not replace authorization.
|
|
61
|
+
- Signing is off by default. With signing on, the receiver verifies each request against the event store's public signing keys, on the raw body, and accepts every key the store currently lists so that a key rotation does not reject deliveries. Signing does not replace authorization. A receiver that is not .NET verifies by hand: read [webhook signature wire format](references/webhook-signature-wire-format.md) for the headers, signed message, key format and rotation.
|
|
62
62
|
- A webhook is replayable unless registered otherwise; a replay sends stored events again under the same sequence numbers.
|
|
63
63
|
- Events are released from personal-data protection before delivery: the receiver gets plaintext, and erasing a subject later does not reach what the receiver stored.
|
|
64
64
|
|
|
@@ -70,8 +70,9 @@ Use these only when the other side is not a Chronicle store. They are edge cases
|
|
|
70
70
|
|
|
71
71
|
**Capture**
|
|
72
72
|
|
|
73
|
-
- Two sources run: polling an HTTP external service on an interval, and reading another store's public events from the inbox to produce this store's own
|
|
74
|
-
- A capture names a key that identifies an item, and append rules that choose the event to append when
|
|
75
|
-
- The kernel parses a textual capture declaration; SDK builders produce that declaration. Validate before starting: a declaration can
|
|
73
|
+
- Two sources run: polling an HTTP external service on an interval, and reading another store's public events from the inbox to produce this store's own non-public events.
|
|
74
|
+
- A capture names a key that identifies an item, and append rules that choose the event to append and the values to copy into it. Every `append` needs a `when`; without one the declaration does not compile. The engine runs `when added`, `when removed`, `when <property>` (it changed), `when <p1> or <p2>`, `when <p1> and <p2>` and `when <property> from <old> to <new>` (a value transition). Only `when added` matches the first observation of a key; the property, `or`, `and` and transition rules match only changes to an item already seen. `when removed` fires only for an HTTP capture, when an item leaves the polled result; a public-events capture accepts it but never fires it. Register the appended event types first, and for an HTTP capture the external service too.
|
|
75
|
+
- The kernel parses a textual capture declaration; SDK builders produce that declaration. Validate before starting: compiling checks structure only, so a declaration can compile and still not run. Validation reports webhook or message-topic sources, `map` (value mapping), nested or child scopes, and a backtick expression condition (``when `expr` ``) as unsupported.
|
|
76
|
+
- A public-events capture reads the inbox of one origin. Every `from` type must be registered as public with an origin, and all must share that origin; split types from different stores into separate captures. Do not set `poll` on this source: the declaration does not compile. Appended types must be registered, not public, and not also listed in `from`: a capture does not publish. `key $eventSourceId` groups incoming events by event source; each event's properties are merged into the state kept for its key, and the rules compare against that. Assignments can read `$.path`, `$context.<property>` (for example `occurred`) and `$eventSourceId`; here `$.path` reads the merged state, so it can return a field kept from an earlier event. An HTTP capture cannot read `$context` or `$eventSourceId`.
|
|
76
77
|
- Saving does not start a capture, and a capture with any validation message is not started. A started capture cannot be changed: saving over it is refused, so stop it, save, then start it again, on redeploy too.
|
|
77
78
|
- The two sources run differently. A public-events capture subscribes to the inbox in every namespace, including ones added later, and appends in the namespace the event arrived in. An HTTP capture runs one poller for the whole event store and appends to the default namespace only. Stopping ends the subscription or the poller. Deleting also removes its progress and the state it remembered; events it appended remain.
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Publish a parcel clearance with C#
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Declare and publish the contract
|
|
6
|
+
- Receive and verify
|
|
7
|
+
- Publish only changes to state
|
|
8
|
+
- Manage a filtered route explicitly
|
|
9
|
+
- Consumers that are not Chronicle stores
|
|
10
|
+
- Not supported in this SDK
|
|
11
|
+
|
|
3
12
|
Names are illustrative. Use `Cratis.Chronicle` in both services; in ASP.NET Core use the Chronicle ASP.NET Core integration (`builder.AddCratisChronicle(...)` before building, `app.UseCratisChronicle()` after). Configure the producer for `dispatch` and consumer for `tracking` on the same kernel, with a matching namespace. Use the scoped `IEventStore` of each host. Share the public record, not the producer's internal events. Examples use `Cratis.Chronicle`, `.Events`, `.EventSequences`, `.Reactors`, `.Projections`, `.Reducers`, `.Registrations`, `.Observation` and `.Sinks` under that namespace.
|
|
4
13
|
|
|
5
14
|
## Declare and publish the contract
|
|
@@ -16,6 +25,38 @@ public record ParcelInspected(string Lane, string InternalNote);
|
|
|
16
25
|
|
|
17
26
|
Verify visibility and origin in the Workbench Event Types view. `[EventStore]` makes the shared type public in both stores. For a contracts-only assembly, `[assembly: EventStore("dispatch")]` supplies the default origin; a type declaration overrides it. Keep private records out of that assembly. Without origin or `[Public]`, .NET registers the type private. Use `[Public]` alone when visibility, not origin-based routing, is wanted. For plain types configure `options.ExplicitArtifacts.RegisterEventType<ParcelCleared>(e => e.WithId("parcel-cleared").ForEventStore("dispatch"))` before creating the store; `e.Public()` or `e.Private()` sets visibility explicitly. Do not contradict attribute declarations. Foreign ownership alone is not eligibility for an event-target publisher in the receiving store.
|
|
18
27
|
|
|
28
|
+
Lay the contracts project out by producing slice, one event per file: `<Service>.Contracts/<Slice>/<Event>.cs`, here `Dispatch.Contracts/Clearance/ParcelCleared.cs` in namespace `Dispatch.Contracts.Clearance`. The project references `Cratis.Chronicle` and nothing of the service; the producer and every consumer reference it. Give contract events scalar fields (`string`, `Guid`, `DateTimeOffset`) rather than the producer's concept types, so the contract carries none of its domain model. Declare the store name once, as a constant the assembly attribute and the producer's `options.EventStore` both use. These are three separate files.
|
|
29
|
+
|
|
30
|
+
`Dispatch.Contracts/DispatchEventStore.cs`:
|
|
31
|
+
|
|
32
|
+
```csharp
|
|
33
|
+
[assembly: EventStore(Dispatch.Contracts.DispatchEventStore.Name)]
|
|
34
|
+
|
|
35
|
+
namespace Dispatch.Contracts;
|
|
36
|
+
|
|
37
|
+
public static class DispatchEventStore
|
|
38
|
+
{
|
|
39
|
+
public const string Name = "dispatch";
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`Dispatch.Contracts/Clearance/ParcelCleared.cs`:
|
|
44
|
+
|
|
45
|
+
```csharp
|
|
46
|
+
namespace Dispatch.Contracts.Clearance;
|
|
47
|
+
|
|
48
|
+
[EventType("parcel-cleared")]
|
|
49
|
+
public record ParcelCleared(string Lane);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The Dispatch service's `Program.cs`:
|
|
53
|
+
|
|
54
|
+
```csharp
|
|
55
|
+
builder.AddCratisChronicle(options => options.EventStore = Dispatch.Contracts.DispatchEventStore.Name);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
In this layout remove the type-level `[EventStore("dispatch")]` shown on `ParcelCleared` in the first example: it would override the assembly default and repeat the store name as a second literal.
|
|
59
|
+
|
|
19
60
|
Record the inspection on `producer.EventLog`. Publish once per clearance, not once per distinct lane. Persist a unique publication ID per occurrence before attempting the append; reuse it and identical inputs on retry.
|
|
20
61
|
|
|
21
62
|
```csharp
|
package/package/corpus/skills/cratis-chronicle-publish-contract/references/elixir-integrations.md
CHANGED
|
@@ -91,14 +91,14 @@ end
|
|
|
91
91
|
| --- | --- |
|
|
92
92
|
| `use ... Capture, name:, id:, start:` | `name` defaults to the module's last segment; `id` defaults to a stable id derived from the module name, so a redeploy addresses the same capture; `start: true` asks the kernel to start it after saving (default `false`: saved but stopped) |
|
|
93
93
|
| `api_source(service_name, route:, poll:)` | Poll a registered external service |
|
|
94
|
-
| `events_source([EventModule, ...])` | Capture from another store's public events arriving in
|
|
94
|
+
| `events_source([EventModule, ...])` | Capture from another store's public events arriving in this store's inbox; use `key("$eventSourceId")`. Takes no poll interval, and every appended event must be a registered, non-public event type of this store, different from the source events |
|
|
95
95
|
| `webhook_source(path)` | Inbound webhook path. Not runnable, see the kernel limitation below |
|
|
96
96
|
| `key(path)` | Required. Property that identifies an item and is used to detect change |
|
|
97
|
-
| `append Event, when: condition do set(:field, expression) end` | Append `Event` when the condition matches. `set` targets a field of the event struct; the expression is `"$.path"` (a
|
|
97
|
+
| `append Event, when: condition do set(:field, expression) end` | Append `Event` when the condition matches. `set` targets a field of the event struct; the expression is `"$.path"` (a property of the current item; with `events_source`, of the state merged from every event for the key so far) and, with `events_source` only, `"$eventSourceId"` or `"$context.<property>"` |
|
|
98
98
|
| `map do ... end` | Not runnable. `rename(target, source)`, `template(target, "Hello, ${name}")`, `translate(target, source, [{"from", "to"}])`, `split(source, by: ",", into: [:a, :b])` |
|
|
99
99
|
| `nested :path do ... end`, `children :path, identified_by: :key do ... end` | Not runnable. Scopes holding their own `map` and `append` blocks |
|
|
100
100
|
|
|
101
|
-
`when:` conditions: `"property"` (it changed), `{:any, [...]}`, `{:all, [...]}`, `{:transition, property, from, to}`, `:added`, `:removed`, `{:expression, "..."}` (raw declaration text; not runnable).
|
|
101
|
+
`when:` conditions: `"property"` (it changed), `{:any, [...]}`, `{:all, [...]}`, `{:transition, property, from, to}`, `:added`, `:removed`, `{:expression, "..."}` (raw declaration text; not runnable). Only `:added` matches the first observation of a key; `"property"`, `:any`, `:all` and `:transition` match only changes to an item already seen.
|
|
102
102
|
|
|
103
103
|
Rules that fail at compile time: exactly one source (`MissingCaptureSourceConfiguration`); a `key` (`MissingCaptureKey`); a `when:` on every `append` (`MissingAppendCondition`); `set` on a field the event struct lacks (`TargetPropertyMustBeAProperty`); and an appended event type whose **id** does not start with an uppercase letter or contains anything but letters, digits and underscores (`ArgumentError`). Declare such an event with an id like `"InvoiceStatusChanged"`, not `"invoice-status-changed"`.
|
|
104
104
|
|