@cratis/pi 8.0.2 → 8.1.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 +9 -102
- package/package/corpus/harnesses/copilot/instructions/authoring-skills.instructions.md +3 -5
- package/package/corpus/harnesses/copilot/instructions/browser.instructions.md +8 -49
- package/package/corpus/harnesses/copilot/instructions/code-health.instructions.md +1 -1
- package/package/corpus/harnesses/copilot/instructions/code-quality.csharp.instructions.md +3 -84
- package/package/corpus/harnesses/copilot/instructions/code-quality.instructions.md +6 -51
- package/package/corpus/harnesses/copilot/instructions/code-quality.typescript.instructions.md +4 -81
- package/package/corpus/harnesses/copilot/instructions/codescene.instructions.md +5 -54
- package/package/corpus/harnesses/copilot/instructions/components.instructions.md +1 -1
- package/package/corpus/harnesses/copilot/instructions/cratis-folder-is-configuration.instructions.md +5 -22
- package/package/corpus/harnesses/copilot/instructions/csharp.instructions.md +7 -315
- package/package/corpus/harnesses/copilot/instructions/dialogs.instructions.md +1 -1
- package/package/corpus/harnesses/copilot/instructions/discoverability.instructions.md +3 -25
- package/package/corpus/harnesses/copilot/instructions/documentation-structure-and-formatting.instructions.md +5 -151
- package/package/corpus/harnesses/copilot/instructions/documentation.instructions.md +5 -104
- package/package/corpus/harnesses/copilot/instructions/editing-cratis-docs.instructions.md +5 -63
- package/package/corpus/harnesses/copilot/instructions/efcore.instructions.md +8 -55
- package/package/corpus/harnesses/copilot/instructions/efcore.specs.instructions.md +3 -33
- package/package/corpus/harnesses/copilot/instructions/elixir.instructions.md +6 -79
- package/package/corpus/harnesses/copilot/instructions/exit-codes-and-wrappers.instructions.md +4 -27
- package/package/corpus/harnesses/copilot/instructions/framework-dotnet.instructions.md +4 -6
- package/package/corpus/harnesses/copilot/instructions/framework.instructions.md +0 -2
- package/package/corpus/harnesses/copilot/instructions/frontend-quality.instructions.md +0 -1
- package/package/corpus/harnesses/copilot/instructions/frontend-testing.instructions.md +1 -1
- package/package/corpus/harnesses/copilot/instructions/github-actions.instructions.md +7 -138
- package/package/corpus/harnesses/copilot/instructions/glossary.instructions.md +19 -19
- package/package/corpus/harnesses/copilot/instructions/go-engineering.instructions.md +1 -4
- package/package/corpus/harnesses/copilot/instructions/go.instructions.md +2 -7
- package/package/corpus/harnesses/copilot/instructions/guards-and-fuses.instructions.md +5 -6
- package/package/corpus/harnesses/copilot/instructions/java.instructions.md +7 -129
- package/package/corpus/harnesses/copilot/instructions/kotlin.instructions.md +8 -165
- package/package/corpus/harnesses/copilot/instructions/orleans.instructions.md +5 -98
- package/package/corpus/harnesses/copilot/instructions/profiles.instructions.md +9 -63
- package/package/corpus/harnesses/copilot/instructions/scripting.instructions.md +1 -1
- package/package/corpus/harnesses/copilot/instructions/specs.csharp.instructions.md +8 -148
- package/package/corpus/harnesses/copilot/instructions/specs.elixir.instructions.md +4 -37
- package/package/corpus/harnesses/copilot/instructions/specs.typescript.instructions.md +3 -1
- package/package/corpus/harnesses/copilot/instructions/storybook.instructions.md +7 -70
- package/package/corpus/harnesses/copilot/instructions/typescript.instructions.md +8 -98
- package/package/corpus/harnesses/copilot/instructions/writing-correct-examples.instructions.md +3 -47
- package/package/corpus/harnesses/copilot/instructions/writing-cratis-docs.instructions.md +3 -65
- package/package/corpus/hooks/README.md +4 -7
- package/package/corpus/hooks/scripts/quality-gates.json +3 -5
- package/package/corpus/rules/ai-distribution.md +9 -102
- package/package/corpus/rules/authoring-skills.md +3 -5
- package/package/corpus/rules/browser.md +8 -49
- package/package/corpus/rules/code-health-policy.txt +4 -24
- package/package/corpus/rules/code-health.md +1 -1
- package/package/corpus/rules/code-quality.csharp.md +3 -84
- package/package/corpus/rules/code-quality.md +6 -51
- package/package/corpus/rules/code-quality.typescript.md +4 -81
- package/package/corpus/rules/codescene.md +5 -54
- package/package/corpus/rules/components.md +1 -1
- package/package/corpus/rules/cratis-folder-is-configuration.md +5 -22
- package/package/corpus/rules/csharp.md +7 -315
- package/package/corpus/rules/dialogs.md +1 -1
- package/package/corpus/rules/discoverability.md +3 -25
- package/package/corpus/rules/documentation-structure-and-formatting.md +5 -151
- package/package/corpus/rules/documentation.md +5 -104
- package/package/corpus/rules/editing-cratis-docs.md +5 -63
- package/package/corpus/rules/efcore.md +8 -55
- package/package/corpus/rules/efcore.specs.md +3 -33
- package/package/corpus/rules/elixir.md +6 -79
- package/package/corpus/rules/exit-codes-and-wrappers.md +4 -27
- package/package/corpus/rules/framework-dotnet.md +4 -6
- package/package/corpus/rules/framework.md +0 -2
- package/package/corpus/rules/frontend-quality.md +0 -1
- package/package/corpus/rules/frontend-testing.md +1 -1
- package/package/corpus/rules/general.md +2 -2
- package/package/corpus/rules/github-actions.md +7 -138
- package/package/corpus/rules/glossary.md +19 -19
- package/package/corpus/rules/go-engineering.md +1 -4
- package/package/corpus/rules/go.md +2 -7
- package/package/corpus/rules/guards-and-fuses.md +5 -6
- package/package/corpus/rules/java.md +7 -129
- package/package/corpus/rules/kotlin.md +8 -165
- package/package/corpus/rules/orleans.md +5 -98
- package/package/corpus/rules/profiles.md +9 -63
- package/package/corpus/rules/scripting.md +1 -1
- package/package/corpus/rules/specs.csharp.md +8 -148
- package/package/corpus/rules/specs.elixir.md +4 -37
- package/package/corpus/rules/specs.typescript.md +3 -1
- package/package/corpus/rules/storybook.md +7 -70
- package/package/corpus/rules/typescript.md +8 -98
- package/package/corpus/rules/writing-correct-examples.md +3 -47
- package/package/corpus/rules/writing-cratis-docs.md +3 -65
- package/package/corpus/skills/cratis-application-growth/SKILL.md +7 -54
- package/package/corpus/skills/cratis-application-growth/references/move-and-untangle.md +49 -0
- package/package/corpus/skills/cratis-application-growth/references/rename-window.md +12 -14
- package/package/corpus/skills/cratis-application-growth/references/stages.md +2 -2
- package/package/corpus/skills/cratis-arc-authorize-request/SKILL.md +2 -2
- package/package/corpus/skills/cratis-arc-authorize-request/references/csharp.md +3 -3
- package/package/corpus/skills/cratis-arc-authorize-request/references/kotlin.md +2 -2
- package/package/corpus/skills/cratis-arc-code-analysis-typescript/SKILL.md +10 -43
- package/package/corpus/skills/cratis-arc-code-analysis-typescript/references/rule-fixes.md +40 -0
- package/package/corpus/skills/cratis-arc-connect-storage/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-connect-storage/references/csharp.md +1 -1
- package/package/corpus/skills/cratis-arc-declare-command/references/csharp.md +4 -4
- package/package/corpus/skills/cratis-arc-declare-command/references/go.md +1 -1
- package/package/corpus/skills/cratis-arc-declare-command/references/kotlin.md +6 -7
- package/package/corpus/skills/cratis-arc-declare-operation/SKILL.md +2 -8
- package/package/corpus/skills/cratis-arc-declare-operation/references/csharp.md +1 -1
- 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 +1 -1
- package/package/corpus/skills/cratis-arc-expose-mcp-operation/SKILL.md +6 -12
- package/package/corpus/skills/cratis-arc-expose-mcp-operation/references/custom-exposure-and-audit.md +4 -0
- package/package/corpus/skills/cratis-arc-expose-query/SKILL.md +2 -2
- package/package/corpus/skills/cratis-arc-expose-query/references/csharp.md +11 -4
- package/package/corpus/skills/cratis-arc-expose-query/references/typescript.md +1 -1
- package/package/corpus/skills/cratis-arc-generate-proxies/SKILL.md +2 -2
- package/package/corpus/skills/cratis-arc-generate-proxies/references/csharp.md +1 -1
- package/package/corpus/skills/cratis-arc-generate-proxies/references/go.md +19 -2
- package/package/corpus/skills/cratis-arc-generate-proxies/references/typescript.md +1 -1
- package/package/corpus/skills/cratis-arc-host-application/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-host-application/references/csharp.md +1 -2
- package/package/corpus/skills/cratis-arc-host-application/references/elixir.md +2 -2
- package/package/corpus/skills/cratis-arc-host-application/references/go.md +5 -1
- package/package/corpus/skills/cratis-arc-host-application/references/java.md +1 -1
- package/package/corpus/skills/cratis-arc-host-application/references/kotlin.md +1 -1
- package/package/corpus/skills/cratis-arc-host-application/references/typescript.md +1 -1
- package/package/corpus/skills/cratis-arc-identity-and-tenancy-kotlin/SKILL.md +4 -7
- package/package/corpus/skills/cratis-arc-invoke-command/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-invoke-command/references/csharp.md +4 -4
- package/package/corpus/skills/cratis-arc-invoke-command/references/typescript.md +1 -1
- package/package/corpus/skills/cratis-arc-isolate-tenant/SKILL.md +2 -2
- package/package/corpus/skills/cratis-arc-isolate-tenant/references/csharp.md +2 -2
- package/package/corpus/skills/cratis-arc-isolate-tenant/references/elixir.md +1 -1
- package/package/corpus/skills/cratis-arc-isolate-tenant/references/java.md +1 -1
- package/package/corpus/skills/cratis-arc-isolate-tenant/references/kotlin.md +1 -1
- package/package/corpus/skills/cratis-arc-isolate-tenant/references/typescript.md +4 -2
- package/package/corpus/skills/cratis-arc-migrate-relational-schema/SKILL.md +6 -6
- package/package/corpus/skills/cratis-arc-page-query/SKILL.md +3 -3
- package/package/corpus/skills/cratis-arc-page-query/references/csharp.md +10 -6
- package/package/corpus/skills/cratis-arc-page-query/references/elixir.md +2 -2
- package/package/corpus/skills/cratis-arc-page-query/references/java.md +1 -1
- package/package/corpus/skills/cratis-arc-page-query/references/kotlin.md +1 -1
- package/package/corpus/skills/cratis-arc-react-bind-slice/SKILL.md +2 -2
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/csharp.md +1 -1
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/kotlin.md +1 -1
- package/package/corpus/skills/cratis-arc-react-separate-view-model/SKILL.md +7 -3
- package/package/corpus/skills/cratis-arc-react-separate-view-model/references/react-routing-and-messaging.md +1 -1
- package/package/corpus/skills/cratis-arc-select-backend-sdk/SKILL.md +2 -2
- package/package/corpus/skills/cratis-arc-select-backend-sdk/references/elixir.md +2 -4
- package/package/corpus/skills/cratis-arc-select-backend-sdk/references/go.md +2 -2
- package/package/corpus/skills/cratis-arc-select-backend-sdk/references/java.md +1 -1
- package/package/corpus/skills/cratis-arc-select-backend-sdk/references/kotlin.md +2 -2
- package/package/corpus/skills/cratis-arc-select-backend-sdk/references/typescript.md +1 -3
- package/package/corpus/skills/cratis-arc-spring-data-kotlin/SKILL.md +13 -51
- package/package/corpus/skills/cratis-arc-spring-data-kotlin/references/read-model-naming.md +9 -1
- package/package/corpus/skills/cratis-arc-spring-data-kotlin/references/storage-boundaries.md +40 -0
- package/package/corpus/skills/cratis-arc-storage-typescript/SKILL.md +19 -64
- package/package/corpus/skills/cratis-arc-storage-typescript/references/drizzle.md +62 -0
- package/package/corpus/skills/cratis-arc-tenancy-typescript/SKILL.md +24 -55
- package/package/corpus/skills/cratis-arc-tenancy-typescript/references/tenant-selection.md +49 -0
- package/package/corpus/skills/cratis-arc-testing-kotlin/SKILL.md +13 -31
- package/package/corpus/skills/cratis-arc-testing-kotlin/references/jvm-scenario-variants.md +25 -0
- package/package/corpus/skills/cratis-arc-testing-typescript/SKILL.md +24 -62
- package/package/corpus/skills/cratis-arc-testing-typescript/references/hosts-and-runners.md +51 -0
- package/package/corpus/skills/cratis-arc-validate-command/SKILL.md +4 -4
- package/package/corpus/skills/cratis-arc-validate-command/references/csharp.md +10 -12
- package/package/corpus/skills/cratis-arc-validate-command/references/elixir.md +16 -3
- package/package/corpus/skills/cratis-arc-validate-command/references/go.md +19 -2
- package/package/corpus/skills/cratis-arc-validate-command/references/java.md +20 -7
- package/package/corpus/skills/cratis-arc-validate-command/references/kotlin.md +22 -2
- package/package/corpus/skills/cratis-arc-validate-command/references/python.md +8 -2
- package/package/corpus/skills/cratis-arc-validate-command/references/typescript.md +22 -2
- package/package/corpus/skills/cratis-arc-validation-kotlin/SKILL.md +22 -248
- package/package/corpus/skills/cratis-arc-validation-kotlin/references/feature-filters.md +55 -0
- package/package/corpus/skills/cratis-arc-validation-kotlin/references/model-validation.md +72 -0
- package/package/corpus/skills/cratis-arc-validation-kotlin/references/server-validators.md +86 -0
- package/package/corpus/skills/cratis-arc-validation-typescript/SKILL.md +27 -275
- package/package/corpus/skills/cratis-arc-validation-typescript/references/models-and-queries.md +63 -0
- package/package/corpus/skills/cratis-arc-validation-typescript/references/rules-and-checks.md +46 -0
- package/package/corpus/skills/cratis-arc-validation-typescript/references/server-decisions.md +114 -0
- package/package/corpus/skills/cratis-chronicle-cli-operations/SKILL.md +15 -255
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/command-effects.md +13 -6
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/inspection.md +75 -0
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/project-tooling.md +78 -13
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/recovery-and-comparison.md +16 -14
- package/package/corpus/skills/cratis-chronicle-connect-application/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-connect-application/references/csharp.md +10 -6
- package/package/corpus/skills/cratis-chronicle-connect-application/references/elixir.md +1 -1
- package/package/corpus/skills/cratis-chronicle-constrain-append/SKILL.md +2 -2
- package/package/corpus/skills/cratis-chronicle-constrain-append/references/csharp.md +8 -8
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/SKILL.md +10 -8
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/storage.md +8 -4
- package/package/corpus/skills/cratis-chronicle-evolve-event/SKILL.md +4 -4
- package/package/corpus/skills/cratis-chronicle-evolve-event/references/csharp.md +2 -2
- package/package/corpus/skills/cratis-chronicle-evolve-event/references/deployed-readers.md +21 -8
- package/package/corpus/skills/cratis-chronicle-evolve-event/references/elixir.md +1 -1
- package/package/corpus/skills/cratis-chronicle-inspect-observer/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-inspect-observer/references/csharp.md +5 -7
- package/package/corpus/skills/cratis-chronicle-inspect-observer/references/elixir.md +3 -3
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/SKILL.md +10 -80
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/blocked-tools.md +2 -2
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/deployment.md +9 -24
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/observational-tools.md +10 -0
- package/package/corpus/skills/cratis-chronicle-project-view/SKILL.md +2 -2
- package/package/corpus/skills/cratis-chronicle-project-view/references/csharp.md +7 -6
- package/package/corpus/skills/cratis-chronicle-project-view/references/elixir.md +2 -2
- package/package/corpus/skills/cratis-chronicle-project-view/references/go.md +6 -0
- package/package/corpus/skills/cratis-chronicle-project-view/references/java.md +6 -0
- package/package/corpus/skills/cratis-chronicle-project-view/references/kotlin.md +6 -0
- package/package/corpus/skills/cratis-chronicle-project-view/references/typescript.md +11 -5
- package/package/corpus/skills/cratis-chronicle-protect-decision/SKILL.md +2 -2
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp.md +4 -4
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/elixir.md +2 -2
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/go.md +3 -1
- 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 +1 -1
- package/package/corpus/skills/cratis-chronicle-publish-contract/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-publish-contract/references/csharp.md +51 -40
- package/package/corpus/skills/cratis-chronicle-publish-contract/references/elixir.md +1 -1
- package/package/corpus/skills/cratis-chronicle-react-to-fact/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/{occurrences.md → csharp-occurrences.md} +2 -2
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp.md +5 -6
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/go.md +1 -1
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/java.md +1 -1
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/kotlin.md +1 -1
- package/package/corpus/skills/cratis-chronicle-record-event/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-record-event/references/csharp.md +21 -19
- package/package/corpus/skills/cratis-chronicle-record-event/references/elixir.md +3 -3
- package/package/corpus/skills/cratis-chronicle-record-event/references/go.md +1 -1
- package/package/corpus/skills/cratis-chronicle-record-event/references/java.md +3 -4
- package/package/corpus/skills/cratis-chronicle-record-event/references/kotlin.md +3 -4
- package/package/corpus/skills/cratis-chronicle-record-event/references/typescript.md +2 -2
- package/package/corpus/skills/cratis-chronicle-reduce-state/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-reduce-state/references/csharp.md +7 -2
- package/package/corpus/skills/cratis-chronicle-reduce-state/references/typescript.md +1 -1
- package/package/corpus/skills/cratis-chronicle-select-client/SKILL.md +4 -4
- package/package/corpus/skills/cratis-chronicle-select-client/references/csharp.md +3 -3
- package/package/corpus/skills/cratis-chronicle-select-client/references/elixir.md +2 -6
- package/package/corpus/skills/cratis-chronicle-select-client/references/go.md +2 -2
- package/package/corpus/skills/cratis-chronicle-select-client/references/java.md +1 -1
- package/package/corpus/skills/cratis-chronicle-select-client/references/kotlin.md +1 -5
- package/package/corpus/skills/cratis-chronicle-select-client/references/python.md +3 -3
- package/package/corpus/skills/cratis-chronicle-select-client/references/typescript.md +2 -2
- package/package/corpus/skills/cratis-chronicle-web-workbench/SKILL.md +12 -201
- package/package/corpus/skills/cratis-chronicle-web-workbench/references/hosting.md +67 -0
- package/package/corpus/skills/cratis-chronicle-web-workbench/references/operations.md +88 -0
- package/package/corpus/skills/cratis-ci-pipeline-performance/SKILL.md +8 -4
- package/package/corpus/skills/cratis-ci-pipeline-performance/references/build-once-and-shard.md +13 -11
- package/package/corpus/skills/cratis-ci-pipeline-performance/references/caching.md +2 -2
- package/package/corpus/skills/cratis-ci-pipeline-performance/references/flaky-and-hung-jobs.md +6 -4
- package/package/corpus/skills/cratis-ci-pipeline-performance/references/required-checks-and-path-filters.md +20 -61
- package/package/corpus/skills/cratis-ci-pipeline-performance/references/security-and-pinning.md +1 -1
- package/package/corpus/skills/cratis-cli-terminal-workbench/SKILL.md +15 -26
- package/package/corpus/skills/cratis-code-review/SKILL.md +7 -6
- package/package/corpus/skills/cratis-commits-and-pull-requests/SKILL.md +1 -1
- package/package/corpus/skills/cratis-commits-and-pull-requests/references/pr-description.md +1 -1
- package/package/corpus/skills/cratis-components-accessibility/SKILL.md +14 -206
- package/package/corpus/skills/cratis-components-accessibility/references/control-labels.md +29 -0
- package/package/corpus/skills/cratis-components-accessibility/references/focus-and-announcements.md +8 -0
- package/package/corpus/skills/cratis-components-build-canvas/SKILL.md +7 -7
- package/package/corpus/skills/cratis-components-build-canvas/references/pixi-items.md +1 -1
- package/package/corpus/skills/cratis-components-choose-control/SKILL.md +7 -8
- package/package/corpus/skills/cratis-components-choose-control/references/collections.md +2 -2
- package/package/corpus/skills/cratis-components-choose-control/references/inputs.md +1 -1
- package/package/corpus/skills/cratis-components-compose-toolbar/SKILL.md +22 -27
- package/package/corpus/skills/cratis-components-compose-toolbar/references/contributed-tools.md +5 -0
- package/package/corpus/skills/cratis-components-coordinate-feedback/SKILL.md +19 -25
- package/package/corpus/skills/cratis-components-display-list/SKILL.md +26 -19
- package/package/corpus/skills/cratis-components-display-list/references/server-query.md +3 -3
- package/package/corpus/skills/cratis-components-edit-schema-data/SKILL.md +15 -12
- package/package/corpus/skills/cratis-components-edit-schema-data/references/controlled-editor.md +3 -3
- package/package/corpus/skills/cratis-components-explore-data/SKILL.md +7 -7
- package/package/corpus/skills/cratis-components-host-chat/SKILL.md +7 -7
- package/package/corpus/skills/cratis-components-submit-form/SKILL.md +9 -15
- package/package/corpus/skills/cratis-components-submit-form/references/confirmation.md +5 -5
- package/package/corpus/skills/cratis-components-submit-form/references/wizard.md +3 -3
- package/package/corpus/skills/cratis-components-theme-application/SKILL.md +7 -51
- package/package/corpus/skills/cratis-components-theme-application/references/palette.md +49 -0
- package/package/corpus/skills/cratis-components-theme-application/references/renderer-adapters.md +4 -2
- package/package/corpus/skills/cratis-content-length/SKILL.md +34 -46
- package/package/corpus/skills/cratis-content-length/references/length-evidence.md +26 -127
- package/package/corpus/skills/cratis-developer-marketing/SKILL.md +15 -27
- package/package/corpus/skills/cratis-developer-marketing/references/measurement.md +3 -19
- package/package/corpus/skills/cratis-developer-marketing/references/playbook-evidence.md +29 -224
- package/package/corpus/skills/cratis-discoverability/SKILL.md +11 -4
- package/package/corpus/skills/cratis-discoverability/references/package-metadata.md +2 -2
- package/package/corpus/skills/cratis-documentation-writing/SKILL.md +4 -3
- package/package/corpus/skills/cratis-engineering-ci-gates/SKILL.md +13 -129
- package/package/corpus/skills/cratis-engineering-ci-gates/references/gate-operation.md +132 -0
- package/package/corpus/skills/cratis-engineering-consolidation-guard/SKILL.md +11 -100
- package/package/corpus/skills/cratis-engineering-consolidation-guard/references/ci-required-check.md +55 -40
- package/package/corpus/skills/cratis-engineering-consolidation-guard/references/source-verification.md +68 -0
- package/package/corpus/skills/cratis-engineering-consolidation-guard/references/verification-details.md +38 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/SKILL.md +14 -65
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/exceptions-logging-and-di.md +40 -174
- package/package/corpus/skills/cratis-engineering-decision-record/SKILL.md +8 -52
- package/package/corpus/skills/cratis-engineering-decision-record/references/decision-pitfalls.md +29 -0
- package/package/corpus/skills/cratis-engineering-decision-record/references/decision-scope.md +20 -0
- package/package/corpus/skills/cratis-engineering-decision-record/references/record-format.md +3 -4
- package/package/corpus/skills/cratis-engineering-docs-authoring/SKILL.md +7 -12
- package/package/corpus/skills/cratis-engineering-docs-authoring/references/site-format.md +5 -4
- package/package/corpus/skills/cratis-engineering-effect-boundaries/SKILL.md +6 -40
- package/package/corpus/skills/cratis-engineering-effect-boundaries/references/failure-archetypes.md +18 -151
- package/package/corpus/skills/cratis-engineering-inherited-work/SKILL.md +5 -21
- package/package/corpus/skills/cratis-engineering-inherited-work/references/continue-inherited-work.md +19 -0
- package/package/corpus/skills/cratis-engineering-issue-design-note/SKILL.md +3 -66
- package/package/corpus/skills/cratis-engineering-issue-design-note/references/design-note-format.md +68 -0
- package/package/corpus/skills/cratis-engineering-issue-hygiene/SKILL.md +2 -84
- package/package/corpus/skills/cratis-engineering-issue-hygiene/references/issue-disposition.md +87 -0
- package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/SKILL.md +15 -263
- package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/references/dependency-map.md +3 -3
- package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/references/docker-images.md +28 -6
- package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/references/dotnet-nuget.md +18 -14
- package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/references/helper-runbook.md +231 -0
- package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/references/other-environments.md +2 -3
- package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/references/worked-examples.md +62 -77
- package/package/corpus/skills/cratis-engineering-post-mortem/SKILL.md +6 -39
- package/package/corpus/skills/cratis-engineering-post-mortem/references/proportionate-follow-up.md +36 -0
- package/package/corpus/skills/cratis-engineering-regression-cluster/SKILL.md +4 -4
- package/package/corpus/skills/cratis-engineering-release-trains/SKILL.md +8 -134
- package/package/corpus/skills/cratis-engineering-release-trains/references/candidate-assembly.md +139 -0
- package/package/corpus/skills/cratis-engineering-review-rounds/SKILL.md +3 -100
- package/package/corpus/skills/cratis-engineering-review-rounds/references/round-handoffs.md +109 -0
- package/package/corpus/skills/cratis-environments-and-secrets/SKILL.md +1 -5
- package/package/corpus/skills/cratis-environments-and-secrets/references/environment-file.md +1 -3
- package/package/corpus/skills/cratis-event-model-diagram/SKILL.md +11 -116
- package/package/corpus/skills/cratis-event-model-diagram/references/frame-patterns.md +93 -0
- package/package/corpus/skills/cratis-fundamentals-concept-go/SKILL.md +4 -15
- package/package/corpus/skills/cratis-fundamentals-name-value/SKILL.md +8 -8
- package/package/corpus/skills/cratis-fundamentals-name-value/references/csharp.md +4 -4
- package/package/corpus/skills/cratis-fundamentals-name-value/references/elixir.md +1 -1
- package/package/corpus/skills/cratis-fundamentals-name-value/references/go.md +1 -1
- package/package/corpus/skills/cratis-fundamentals-name-value/references/java.md +5 -5
- package/package/corpus/skills/cratis-fundamentals-name-value/references/kotlin.md +15 -2
- package/package/corpus/skills/cratis-fundamentals-name-value/references/python.md +1 -1
- package/package/corpus/skills/cratis-fundamentals-name-value/references/typescript.md +1 -1
- package/package/corpus/skills/cratis-fundamentals-telemetry/SKILL.md +10 -27
- package/package/corpus/skills/cratis-fundamentals-telemetry/references/otlp-export.md +16 -0
- package/package/corpus/skills/cratis-fundamentals-type-discovery/SKILL.md +26 -188
- package/package/corpus/skills/cratis-fundamentals-type-discovery/references/diagnostics.md +14 -0
- package/package/corpus/skills/cratis-governed-release-methodology/SKILL.md +7 -5
- package/package/corpus/skills/cratis-lens-browser-extension/SKILL.md +23 -157
- package/package/corpus/skills/cratis-lens-browser-extension/references/troubleshooting.md +139 -0
- package/package/corpus/skills/cratis-llm-friendly-documentation/SKILL.md +7 -5
- package/package/corpus/skills/cratis-modeling-design-event-model/SKILL.md +2 -4
- package/package/corpus/skills/cratis-modeling-design-event-model/references/model-first.md +7 -0
- package/package/corpus/skills/cratis-modeling-discover-timeline/SKILL.md +2 -2
- package/package/corpus/skills/cratis-modeling-discover-timeline/references/group-and-document-intake.md +1 -1
- package/package/corpus/skills/cratis-modeling-review-event-model/SKILL.md +2 -2
- package/package/corpus/skills/cratis-modeling-review-event-model/references/implementation-findings.md +2 -2
- package/package/corpus/skills/cratis-modeling-trace-existing-behavior/SKILL.md +5 -23
- package/package/corpus/skills/cratis-modeling-trace-existing-behavior/references/compare-evidence.md +20 -0
- package/package/corpus/skills/cratis-modeling-trace-existing-behavior/references/recovery-inputs.md +3 -3
- package/package/corpus/skills/cratis-multi-service-local-orchestration/SKILL.md +8 -63
- package/package/corpus/skills/cratis-multi-service-local-orchestration/references/aspire.md +52 -0
- package/package/corpus/skills/cratis-observability/SKILL.md +1 -1
- package/package/corpus/skills/cratis-observability/references/arc-and-chronicle-signals.md +9 -23
- package/package/corpus/skills/cratis-observability/references/chronicle-kernel-export.md +3 -14
- package/package/corpus/skills/cratis-observability/references/csharp.md +4 -6
- package/package/corpus/skills/cratis-observability/references/elixir.md +1 -1
- package/package/corpus/skills/cratis-observability/references/troubleshooting.md +4 -5
- package/package/corpus/skills/cratis-onboarding-runtime/SKILL.md +1 -4
- package/package/corpus/skills/cratis-onboarding-runtime/references/default-offering.md +0 -3
- package/package/corpus/skills/cratis-onboarding-runtime/references/sign-up-review.md +0 -4
- package/package/corpus/skills/cratis-orchestration-lanes/SKILL.md +7 -49
- package/package/corpus/skills/cratis-orchestration-lanes/references/escalation.md +22 -0
- package/package/corpus/skills/cratis-orchestration-lanes/references/inbox-and-handover.md +4 -4
- package/package/corpus/skills/cratis-orchestration-lanes/references/placeholders.md +1 -1
- package/package/corpus/skills/cratis-orchestration-lanes/references/roles.md +12 -0
- package/package/corpus/skills/cratis-orchestration-lanes/references/roll-call.md +12 -0
- package/package/corpus/skills/cratis-orchestration-lanes/references/worktrees.md +10 -0
- package/package/corpus/skills/cratis-orchestration-merge-gates/SKILL.md +14 -13
- package/package/corpus/skills/cratis-orchestration-merge-gates/references/merge-queue.md +51 -26
- package/package/corpus/skills/cratis-orchestration-merge-gates/references/unattended-guards.md +8 -14
- package/package/corpus/skills/cratis-orleans-jobs/SKILL.md +9 -65
- package/package/corpus/skills/cratis-orleans-jobs/references/activation-callbacks.md +5 -0
- package/package/corpus/skills/cratis-orleans-jobs/references/lifecycle-and-placement.md +11 -7
- package/package/corpus/skills/cratis-orleans-jobs/references/state-machines.md +1 -1
- package/package/corpus/skills/cratis-orleans-jobs/references/step-planning.md +27 -0
- package/package/corpus/skills/cratis-orleans-jobs/references/storage-and-options.md +35 -0
- package/package/corpus/skills/cratis-performance-review/SKILL.md +6 -76
- package/package/corpus/skills/cratis-performance-review/references/review-checklist.md +79 -0
- package/package/corpus/skills/cratis-platform-configure-environment/SKILL.md +19 -16
- package/package/corpus/skills/cratis-platform-contribute-change/SKILL.md +2 -2
- package/package/corpus/skills/cratis-platform-deliver-slice/SKILL.md +5 -5
- package/package/corpus/skills/cratis-platform-deliver-slice/references/coordinate-slices.md +1 -1
- package/package/corpus/skills/cratis-platform-diagnose-slice/SKILL.md +2 -3
- package/package/corpus/skills/cratis-platform-prepare-release-pr/SKILL.md +2 -2
- package/package/corpus/skills/cratis-platform-start-application/SKILL.md +10 -8
- package/package/corpus/skills/cratis-platform-start-application/references/csharp.md +6 -6
- package/package/corpus/skills/cratis-platform-start-application/references/java.md +4 -4
- package/package/corpus/skills/cratis-platform-start-application/references/kotlin.md +4 -4
- package/package/corpus/skills/cratis-platform-verify-service-handoff/SKILL.md +3 -3
- package/package/corpus/skills/cratis-release-notes/SKILL.md +9 -133
- package/package/corpus/skills/cratis-release-notes/references/channel-guidance.md +59 -0
- package/package/corpus/skills/cratis-release-notes/references/publish-repair.md +64 -0
- package/package/corpus/skills/cratis-rtk/SKILL.md +12 -18
- package/package/corpus/skills/cratis-screenplay-accept-model/SKILL.md +3 -3
- package/package/corpus/skills/cratis-screenplay-accept-model/references/capability-consumption.md +1 -1
- package/package/corpus/skills/cratis-screenplay-accept-model/references/coverage-obligations.md +1 -1
- package/package/corpus/skills/cratis-screenplay-authentication-and-onboarding/SKILL.md +25 -59
- package/package/corpus/skills/cratis-screenplay-authentication-and-onboarding/references/onboarding-directives.md +11 -10
- package/package/corpus/skills/cratis-screenplay-author-extension/SKILL.md +9 -6
- package/package/corpus/skills/cratis-screenplay-author-extension/references/consume.md +3 -3
- package/package/corpus/skills/cratis-screenplay-author-extension/references/stage-candidate.md +8 -0
- package/package/corpus/skills/cratis-screenplay-availability/SKILL.md +20 -167
- package/package/corpus/skills/cratis-screenplay-availability/references/complete-example.md +23 -47
- package/package/corpus/skills/cratis-screenplay-availability/references/review-checks.md +9 -10
- package/package/corpus/skills/cratis-screenplay-availability/references/runtime-ownership.md +26 -23
- package/package/corpus/skills/cratis-screenplay-declare-slice/SKILL.md +6 -14
- package/package/corpus/skills/cratis-screenplay-declare-slice/references/projection-replay.md +2 -2
- package/package/corpus/skills/cratis-screenplay-declare-slice/references/read-identity.md +1 -1
- package/package/corpus/skills/cratis-screenplay-edit-workspace/SKILL.md +7 -9
- package/package/corpus/skills/cratis-screenplay-edit-workspace/references/model-notes.md +1 -1
- package/package/corpus/skills/cratis-screenplay-handoff-slice/SKILL.md +10 -14
- package/package/corpus/skills/cratis-screenplay-model-automation/SKILL.md +1 -1
- package/package/corpus/skills/cratis-screenplay-model-automation/references/reaction-boundaries.md +1 -1
- package/package/corpus/skills/cratis-screenplay-model-interaction/SKILL.md +6 -31
- package/package/corpus/skills/cratis-screenplay-model-interaction/references/shell-and-data.md +22 -0
- package/package/corpus/skills/cratis-screenplay-model-translation/SKILL.md +5 -5
- package/package/corpus/skills/cratis-screenplay-onboard-workspace/SKILL.md +5 -5
- package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/version-migration.md +4 -4
- package/package/corpus/skills/cratis-screenplay-recover-intent/SKILL.md +2 -2
- package/package/corpus/skills/cratis-screenplay-recover-intent/references/csharp.md +2 -2
- package/package/corpus/skills/cratis-screenplay-recover-intent/references/ground-truth-benchmark.md +1 -1
- package/package/corpus/skills/cratis-screenplay-specify-outcome/SKILL.md +4 -75
- package/package/corpus/skills/cratis-screenplay-specify-outcome/references/host-body-execution.md +0 -2
- package/package/corpus/skills/cratis-screenplay-specify-outcome/references/observable-result.md +85 -1
- package/package/corpus/skills/cratis-screenplay-specify-outcome/references/query-rejections.md +1 -1
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +15 -133
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md +5 -5
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/chronicle-boundaries.md +4 -12
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/consistency-and-concurrency.md +28 -57
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/evolution-example.md +4 -5
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/evolution.md +13 -20
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/multi-service-models.md +1 -1
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/neighbouring-skills.md +1 -1
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/read-model-keys.md +3 -5
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-id-rules.md +2 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-patterns.md +5 -5
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/streams-example.md +82 -71
- package/package/corpus/skills/cratis-security-review/SKILL.md +4 -73
- package/package/corpus/skills/cratis-security-review/references/arc-boundaries.md +24 -13
- package/package/corpus/skills/cratis-security-review/references/review-checklist.md +74 -0
- package/package/corpus/skills/cratis-session-handoff/SKILL.md +7 -32
- package/package/corpus/skills/cratis-session-handoff/references/handoff-template.md +2 -2
- package/package/corpus/skills/cratis-session-handoff/references/session-hygiene.md +20 -0
- package/package/corpus/skills/cratis-showrunner-herald/SKILL.md +9 -17
- package/package/corpus/skills/cratis-showrunner-herald/references/options.md +2 -2
- package/package/corpus/skills/cratis-showrunner-herald/references/templates-and-images.md +16 -10
- package/package/corpus/skills/cratis-social-feed-post/SKILL.md +9 -162
- package/package/corpus/skills/cratis-social-feed-post/references/asset-and-formatting.md +37 -0
- package/package/corpus/skills/cratis-social-feed-post/references/editorial-checks.md +40 -0
- package/package/corpus/skills/cratis-social-feed-post/references/engagement-evidence.md +39 -150
- package/package/corpus/skills/cratis-social-feed-post/references/linkedin-media.md +24 -0
- package/package/corpus/skills/cratis-social-feed-post/references/other-channels.md +23 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/SKILL.md +5 -5
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-command-results.md +2 -2
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-query-scenario.md +13 -5
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp.md +7 -4
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/elixir.md +1 -1
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/go.md +20 -4
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/typescript.md +1 -1
- package/package/corpus/skills/cratis-specifications-isolate-behavior/SKILL.md +2 -2
- package/package/corpus/skills/cratis-specifications-observe-ui/SKILL.md +5 -5
- package/package/corpus/skills/cratis-specifications-test-application-ui/SKILL.md +2 -2
- package/package/corpus/skills/cratis-specifications-test-application-ui/references/typescript-command-results.md +2 -2
- package/package/corpus/skills/cratis-specifications-test-typescript-behavior/SKILL.md +2 -2
- package/package/corpus/skills/cratis-stage-render-slice/SKILL.md +10 -9
- package/package/corpus/skills/cratis-stage-run-sandbox/SKILL.md +3 -3
- package/package/corpus/skills/cratis-stage-run-sandbox/references/semantic-spec-runner.md +7 -6
- package/package/corpus/skills/cratis-studio-mcp-safety-guidance/SKILL.md +4 -6
- package/package/corpus/skills/cratis-technical-examples/SKILL.md +10 -106
- package/package/corpus/skills/cratis-technical-examples/references/csharp-package-checks.md +1 -1
- package/package/corpus/skills/cratis-technical-examples/references/source-and-format.md +42 -0
- package/package/corpus/skills/cratis-technical-examples/references/typescript-package-checks.md +2 -2
- package/package/corpus/skills/cratis-technical-examples/references/verification-scope.md +37 -0
- package/package/corpus/skills/cratis-ux-review/SKILL.md +8 -40
- package/package/corpus/skills/cratis-ux-review/references/capture-contract.md +24 -0
- package/package/corpus/skills/cratis-ux-review/references/checklist.md +1 -1
- package/package/corpus/skills/cratis-ux-review/references/report-template.md +2 -1
- package/package/corpus/skills/cratis-writing-voice-and-cadence/SKILL.md +19 -132
- package/package/corpus/skills/cratis-writing-voice-and-cadence/references/ai-tells.md +24 -97
- package/package/corpus/skills/cratis-writing-voice-and-cadence/references/author-and-batch.md +23 -0
- package/package/corpus/skills/cratis-writing-voice-and-cadence/references/documentation-evidence.md +25 -0
- package/package/corpus/skills/cratis-writing-voice-and-cadence/references/interpretation.md +17 -0
- package/package/corpus/skills/cratis-writing-voice-and-cadence/references/stock-constructions.md +23 -0
- package/package/corpus/skills/cratis-writing-voice-and-cadence/references/voice-guidance.md +8 -29
- package/package.json +1 -1
- /package/package/corpus/skills/cratis-chronicle-protect-decision/references/{standalone.md → csharp-standalone.md} +0 -0
- /package/package/corpus/skills/cratis-engineering-post-mortem/references/{examples/silent-backup-failure.md → silent-backup-failure.md} +0 -0
- /package/package/corpus/skills/cratis-engineering-post-mortem/references/{examples/unintended-release-regression.md → unintended-release-regression.md} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cratis-arc-spring-data-kotlin
|
|
3
|
-
description: Use when wiring Spring Data JPA or MongoDB persistence, current-state injection or storage-backed observations in an Arc Kotlin application (Kotlin only). Not for
|
|
3
|
+
description: Use when wiring Spring Data JPA or MongoDB persistence, current-state injection or storage-backed observations in an Arc Kotlin application (Kotlin only). Not for building a Chronicle projection (use cratis-chronicle-project-view).
|
|
4
4
|
license: MIT
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -9,18 +9,15 @@ license: MIT
|
|
|
9
9
|
|
|
10
10
|
# Use Spring Data with Arc in Kotlin
|
|
11
11
|
|
|
12
|
-
This is a Kotlin-only recipe.
|
|
13
|
-
|
|
14
|
-
For Java MongoDB observations, subscribe to the `Flow.Publisher` returned by `MongoObservations.observe(queries, TaskView.class, criteria)` instead of using Kotlin flow extensions.
|
|
15
|
-
|
|
16
12
|
Keep Spring Data responsible for persistence and Arc responsible for the
|
|
17
13
|
model-bound command/query pipeline. Repository injection alone does not isolate
|
|
18
14
|
tenants or turn a repository into an observable source.
|
|
19
15
|
|
|
20
16
|
## Install
|
|
21
17
|
|
|
22
|
-
Add `io.cratis:arc-spring-data-jpa
|
|
23
|
-
`io.cratis:arc-spring-data-mongodb
|
|
18
|
+
Start with the application’s existing store. Add `io.cratis:arc-spring-data-jpa`
|
|
19
|
+
for a relational store or `io.cratis:arc-spring-data-mongodb` for documents.
|
|
20
|
+
Both include the Arc Spring Boot
|
|
24
21
|
starter and corresponding Spring Data starter. Spring owns repository discovery,
|
|
25
22
|
datasource/entity manager, Mongo client and their standard configuration.
|
|
26
23
|
|
|
@@ -50,15 +47,15 @@ data class TaskView(@Id val id: String = "", val title: String = "") {
|
|
|
50
47
|
interface TaskViewRepository : JpaRepository<TaskView, String>
|
|
51
48
|
```
|
|
52
49
|
|
|
53
|
-
|
|
54
|
-
application query
|
|
50
|
+
Choose `MongoRepository` when the model is a MongoDB document. The same
|
|
51
|
+
`@FromServices` pattern works with repository fragments or application query services.
|
|
55
52
|
Protect the query with the application's authorization policy; mapping does
|
|
56
53
|
not make it safe to expose anonymously.
|
|
57
54
|
|
|
58
55
|
A query can declare exact non-null Spring Data Commons `Pageable` and `Sort`.
|
|
59
56
|
KSP binds them from the captured `QueryRequest`, not thread-local request scope.
|
|
60
57
|
Such queries must return exact `org.springframework.data.domain.Page<T>`;
|
|
61
|
-
Arc normalizes it into `QueryPage<T>` before
|
|
58
|
+
Arc normalizes it into `QueryPage<T>` before rendering, preserving pre-page
|
|
62
59
|
total count. Page size zero means unpaged; blank sort field means unsorted.
|
|
63
60
|
Do not confuse Spring Data `Page<T>` with a nonexistent Arc `Page<T>`.
|
|
64
61
|
|
|
@@ -102,46 +99,11 @@ MongoDB change streams require a replica set or sharded cluster; invalidations
|
|
|
102
99
|
cause a fresh filtered snapshot so rows that stop matching disappear. JPA
|
|
103
100
|
observations are **in-process only**: publish committed changes through
|
|
104
101
|
`DatabaseChangePublisher`. There is no silent polling or cross-process JPA
|
|
105
|
-
notification.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
first. Then select certified isolated stores:
|
|
111
|
-
|
|
112
|
-
- JPA: an application `JpaPersistenceUnitResolver` returns a `JpaPersistenceUnit`
|
|
113
|
-
certified for the requested tenant/namespace and mapped type.
|
|
114
|
-
- Mongo: a `TenantAwareMongoOperationsResolver` returns `TenantMongoOperations`
|
|
115
|
-
for the exact tenant. Unknown tenants throw; mismatched certificates fail,
|
|
116
|
-
never fall back to a default database.
|
|
117
|
-
- `TenantContextMongoAccess.operations()` resolves the ambient tenant on **each
|
|
118
|
-
call**, not at construction. Establish `withTenant` explicitly; the command
|
|
119
|
-
pipeline does not create this ambient scope for you. The auto-configured access has no fallback tenant.
|
|
120
|
-
|
|
121
|
-
Plain injected repositories are not automatically routed by tenant. Native
|
|
122
|
-
collection access uses Arc's `NamingPolicy`, while Spring Data operations respect
|
|
123
|
-
`@Document`; choose deliberately. When changing a Chronicle projection’s collection name, verify that the projection writes to the same collection the Spring Data query reads.
|
|
124
|
-
|
|
125
|
-
Concept persistence needs store-specific converters: JPA attribute converters
|
|
126
|
-
(or embedded ids for composite identity), Mongo concrete scalar read/write pairs.
|
|
127
|
-
Do not persist a generic `ConceptAs` wrapper as an arbitrary object or assume a
|
|
128
|
-
JSON converter also handles BSON/JPA. Read the tagged `concepts-jpa.mdx` and
|
|
129
|
-
`concepts-mongodb.mdx` guides for the actual identifier type and converter registration.
|
|
130
|
-
|
|
131
|
-
## Transactions are explicit, thread-bound opt-ins
|
|
132
|
-
|
|
133
|
-
`cratis.arc.spring-data.jpa.command-transactions-enabled` and
|
|
134
|
-
`cratis.arc.spring-data.mongodb.command-transactions-enabled` default to false.
|
|
135
|
-
Enable only for a verified fixed store and identity-aligned transaction manager.
|
|
136
|
-
Dynamic tenant stores are not auto-enrolled. Even enabled, command persistence
|
|
137
|
-
must not suspend or switch threads: imperative Spring transactions are not
|
|
138
|
-
coroutine-safe. They commit only a successful final `CommandResult` and roll
|
|
139
|
-
back failures when completing on the opening thread.
|
|
140
|
-
|
|
141
|
-
There is **no distributed transaction** across JPA, MongoDB and Chronicle.
|
|
142
|
-
Chronicle completion follows local scopes, but a local store may already commit
|
|
143
|
-
before another store or Chronicle fails. Define reconciliation for partial or
|
|
144
|
-
indeterminate outcomes rather than claiming atomic cross-store success.
|
|
102
|
+
notification. In Java, subscribe to the `Flow.Publisher` from
|
|
103
|
+
`MongoObservations.observe(queries, TaskView.class, criteria)` for the same MongoDB snapshot pattern.
|
|
104
|
+
A tenant label on a JPA notification is not storage isolation.
|
|
105
|
+
|
|
106
|
+
Read [storage boundaries](references/storage-boundaries.md) when selecting a tenant’s store, persisting concepts, or enabling command transactions.
|
|
145
107
|
|
|
146
108
|
## Verify
|
|
147
109
|
|
|
@@ -153,6 +115,6 @@ indeterminate outcomes rather than claiming atomic cross-store success.
|
|
|
153
115
|
- For JPA, verify committed notifications, rollback suppression and the intended
|
|
154
116
|
in-process boundary; test thread affinity before enabling transactions.
|
|
155
117
|
|
|
156
|
-
|
|
118
|
+
For query transport, use `cratis-arc-expose-query`. For the Chronicle JVM client, use the `cratis-chronicle-select-client` skill (in `cratis/chronicle`); this skill covers Spring Data observation.
|
|
157
119
|
|
|
158
120
|
For an existing projection, read [how to change collection names safely](references/read-model-naming.md).
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
# Switch collections without stranding existing projections
|
|
2
2
|
|
|
3
|
-
Check the writer
|
|
3
|
+
Check the writer’s naming policy and compare it with the collection selected by
|
|
4
|
+
Spring Data `@Document`. A native tenant-bound collection uses the kernel-aligned
|
|
5
|
+
naming policy; the mapped Spring Data access uses the document mapping. For
|
|
6
|
+
example, the native policy pluralizes `Person` as `People`.
|
|
7
|
+
|
|
8
|
+
When renaming a live projection collection, rebuild or replay into the new
|
|
9
|
+
collection. Compare a known tenant’s existing reads before switching the reader
|
|
10
|
+
or retiring the old collection. A mapping change does not move stored data; an
|
|
11
|
+
empty test database cannot prove continuity for an existing projection.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Choose isolated stores or opt into command transactions
|
|
2
|
+
|
|
3
|
+
## Tenant-bound storage and concepts
|
|
4
|
+
|
|
5
|
+
Resolve/authenticate the tenant using `cratis-arc-identity-and-tenancy-kotlin`
|
|
6
|
+
first. Then select certified isolated stores:
|
|
7
|
+
|
|
8
|
+
- JPA: an application `JpaPersistenceUnitResolver` returns a `JpaPersistenceUnit`
|
|
9
|
+
certified for the requested tenant/namespace and mapped type.
|
|
10
|
+
- Mongo: a `TenantAwareMongoOperationsResolver` returns `TenantMongoOperations`
|
|
11
|
+
for the exact tenant. Unknown tenants throw; mismatched certificates fail,
|
|
12
|
+
never fall back to a default database.
|
|
13
|
+
- `TenantContextMongoAccess.operations()` resolves the ambient tenant on **each
|
|
14
|
+
call**, not at construction. Establish `withTenant` explicitly; the command
|
|
15
|
+
pipeline does not create this ambient scope for you. The auto-configured access has no fallback tenant.
|
|
16
|
+
|
|
17
|
+
Plain injected repositories are not automatically routed by tenant. Native
|
|
18
|
+
collection access uses Arc's `NamingPolicy`, while Spring Data operations respect
|
|
19
|
+
`@Document`; choose deliberately. When changing a Chronicle projection’s collection name, verify that the projection writes to the same collection the Spring Data query reads.
|
|
20
|
+
|
|
21
|
+
Concept persistence needs store-specific converters: JPA attribute converters
|
|
22
|
+
(or embedded ids for composite identity), Mongo concrete scalar read/write pairs.
|
|
23
|
+
Do not persist a generic `ConceptAs` wrapper as an arbitrary object or assume a
|
|
24
|
+
JSON converter also handles BSON/JPA. Use the Arc Kotlin guides “Map JPA concepts” and “Map MongoDB concepts”
|
|
25
|
+
for identifier mapping and converter registration.
|
|
26
|
+
|
|
27
|
+
## Transactions are explicit, thread-bound opt-ins
|
|
28
|
+
|
|
29
|
+
`cratis.arc.spring-data.jpa.command-transactions-enabled` and
|
|
30
|
+
`cratis.arc.spring-data.mongodb.command-transactions-enabled` default to false.
|
|
31
|
+
Enable only for a verified fixed store and identity-aligned transaction manager.
|
|
32
|
+
Dynamic tenant stores are not auto-enrolled. Even enabled, command persistence
|
|
33
|
+
must not suspend or switch threads: imperative Spring transactions are not
|
|
34
|
+
coroutine-safe. They commit only a successful final `CommandResult` and roll
|
|
35
|
+
back failures when completing on the opening thread.
|
|
36
|
+
|
|
37
|
+
There is **no distributed transaction** across JPA, MongoDB and Chronicle.
|
|
38
|
+
Chronicle completion follows local scopes, but a local store may already commit
|
|
39
|
+
before another store or Chronicle fails. Define reconciliation for partial or
|
|
40
|
+
indeterminate outcomes rather than claiming atomic cross-store success.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cratis-arc-storage-typescript
|
|
3
|
-
description: Use when an Arc Node.js server must read or observe read models in MongoDB or a SQL database through Drizzle. Not for
|
|
3
|
+
description: Use when an Arc Node.js server must read or observe read models in MongoDB or a SQL database through Drizzle. Not for defining a query (use cratis-arc-expose-query).
|
|
4
4
|
license: MIT
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -16,17 +16,22 @@ need the model's `@field` declarations.
|
|
|
16
16
|
| `@cratis/arc.mongodb` | `withMongoDB` | `mongodb@^6.21.0` | documents, change-stream observation |
|
|
17
17
|
| `@cratis/arc.drizzle` | `withDrizzle` | `drizzle-orm` `^0.45.0`, `rxjs` | PostgreSQL, MySQL, SQLite tables |
|
|
18
18
|
|
|
19
|
-
For query methods and argument binding, use
|
|
19
|
+
For query methods and argument binding, use `cratis-arc-expose-query`.
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## Query the existing store
|
|
22
|
+
|
|
23
|
+
Use MongoDB for a document read model. Choose [SQL with Drizzle](references/drizzle.md) when the model lives in a SQL table.
|
|
24
|
+
|
|
25
|
+
This excerpt assumes an Arc application `builder`, a MongoDB `client`, and
|
|
26
|
+
a tenancy setup that supplies a tenant. Use `default` for the base database.
|
|
22
27
|
|
|
23
28
|
```typescript
|
|
24
29
|
import { field, Guid } from '@cratis/fundamentals';
|
|
25
|
-
import {
|
|
30
|
+
import { query, queryOptions, readModel, service, type QueryOptions } from '@cratis/arc.core';
|
|
26
31
|
import { mongoCollection, type MongoCollection } from '@cratis/arc.mongodb';
|
|
27
32
|
|
|
28
33
|
export class TaskRecord {
|
|
29
|
-
@field(Guid)
|
|
34
|
+
@field(Guid) id!: Guid;
|
|
30
35
|
@field(String) title!: string;
|
|
31
36
|
}
|
|
32
37
|
const tasks = mongoCollection(TaskRecord);
|
|
@@ -38,12 +43,13 @@ export class TaskQueries {
|
|
|
38
43
|
return items.queryPage({}, options);
|
|
39
44
|
}
|
|
40
45
|
}
|
|
41
|
-
|
|
46
|
+
builder.add(TaskQueries).withMongoDB({ client, database: 'tasks', readModels: [TaskRecord] });
|
|
42
47
|
```
|
|
43
48
|
|
|
44
49
|
- `@key()` marks the field stored as `_id`; without it a field named `id` is
|
|
45
|
-
used
|
|
46
|
-
|
|
50
|
+
used (or `_id`). Multiple explicit keys are rejected. With conventions
|
|
51
|
+
enabled a key is required and only `@field` properties are mapped.
|
|
52
|
+
Use `ignoreConventions` only when deliberately opting out of BSON mapping.
|
|
47
53
|
- List every injected model in `readModels`. `mongoCollection(Type)` resolves to
|
|
48
54
|
the collection in the current tenant's database.
|
|
49
55
|
- Options: `client` or `server` (URI), `database` (default; other tenants use
|
|
@@ -80,59 +86,6 @@ export class TaskQueries {
|
|
|
80
86
|
because the watcher never silently skips an interval. It is not a durable
|
|
81
87
|
event consumer.
|
|
82
88
|
|
|
83
|
-
## SQL with Drizzle
|
|
84
|
-
|
|
85
|
-
```typescript
|
|
86
|
-
import { sqliteTable, text } from 'drizzle-orm/sqlite-core';
|
|
87
|
-
import { DrizzleDialect, drizzleReadModel, guidCodec, sqliteColumn, type DrizzleReadModels } from '@cratis/arc.drizzle';
|
|
88
|
-
|
|
89
|
-
export const tasks = sqliteTable('tasks', {
|
|
90
|
-
id: sqliteColumn(guidCodec(DrizzleDialect.SQLite))('id').primaryKey(),
|
|
91
|
-
title: text('title').notNull()
|
|
92
|
-
});
|
|
93
|
-
export class TaskRecord {
|
|
94
|
-
@field(Guid) @key() id!: Guid;
|
|
95
|
-
@field(String) title!: string;
|
|
96
|
-
}
|
|
97
|
-
@readModel()
|
|
98
|
-
export class TaskQueries {
|
|
99
|
-
@query(service(drizzleReadModel(TaskRecord)), queryOptions())
|
|
100
|
-
static page(rows: DrizzleReadModels<TaskRecord>, options: QueryOptions) {
|
|
101
|
-
return rows.queryPage(undefined, options);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
// builder.add(TaskQueries).withDrizzle({ dialect: DrizzleDialect.SQLite, database,
|
|
105
|
-
// readModels: [{ type: TaskRecord, table: tasks }] });
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
- Each `@field` needs a column under the **same property key** of the Drizzle
|
|
109
|
-
table object (the SQL column name is yours); the table needs a primary key.
|
|
110
|
-
Registration fails otherwise. Columns not on the model are never selected.
|
|
111
|
-
- Options: `dialect` (`DrizzleDialect.PostgreSQL | MySQL | SQLite`), `database`
|
|
112
|
-
(default tenant only), `databaseFactory(tenant, context)` (sync or async; the
|
|
113
|
-
application caches and disposes), `readModels`, `maxPageSize`, `observation`.
|
|
114
|
-
With neither a factory nor a matching `database`, access fails with
|
|
115
|
-
`A tenant is required for Drizzle access`.
|
|
116
|
-
- **Codecs** map Arc types to columns: `guidCodec(dialect)` (`uuid`, `char(36)`,
|
|
117
|
-
`text`), `conceptCodec(Concept, ConceptCodecKind.String | Number, dialect)`,
|
|
118
|
-
`dateOnlyCodec`, `timeOnlyCodec`, `timeSpanCodec`, `jsonCodec(dialect,
|
|
119
|
-
validate)`, wrapped by `pgColumn`, `mysqlColumn` or `sqliteColumn`. A concept
|
|
120
|
-
class declares `static readonly valueType` because generics are erased.
|
|
121
|
-
- **Schema.** Arc checks table against model at startup and never creates,
|
|
122
|
-
alters or migrates the database. Add the column to the table, the model and a
|
|
123
|
-
migration together (for example a drizzle-kit migration you own).
|
|
124
|
-
- **Writes** go through `drizzleDatabase<TDatabase>()` injected into `handle()`;
|
|
125
|
-
`database.native` is the Drizzle database. `queryPage` pushes count, sort,
|
|
126
|
-
limit and offset into SQL.
|
|
127
|
-
- **Observation is opt-in.** `DrizzleObservation.InProcess` sees only writes
|
|
128
|
-
announced with `database.notifyChanged(table)` in this process.
|
|
129
|
-
`DrizzleObservation.PostgreSQLNotify` sees committed changes from any process:
|
|
130
|
-
install the trigger SQL from `postgresqlChangeTrigger(table, { schema })` in an
|
|
131
|
-
application migration and pass a listener factory returning a **new, dedicated**
|
|
132
|
-
`pg.Client` through `nodePostgresListener` (`pg` `^8`). Arc does not create
|
|
133
|
-
database objects at runtime. NOTIFY is not a durable log: states during a
|
|
134
|
-
disconnect are not replayed.
|
|
135
|
-
|
|
136
89
|
## Pitfalls
|
|
137
90
|
|
|
138
91
|
- A singleton holding a collection or connection keeps the first tenant; keep
|
|
@@ -143,6 +96,8 @@ export class TaskQueries {
|
|
|
143
96
|
|
|
144
97
|
## Verify
|
|
145
98
|
|
|
146
|
-
Run
|
|
147
|
-
|
|
148
|
-
|
|
99
|
+
Run a query against the real store with records in two tenants. Verify the
|
|
100
|
+
result contains only the selected tenant’s rows and reports the total before
|
|
101
|
+
paging. For an observation, write a matching row and check the replacement
|
|
102
|
+
snapshot; MongoDB needs a replica set or sharded cluster. Use
|
|
103
|
+
`cratis-arc-testing-typescript` for query shape, not as proof of isolation.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Query and observe a SQL read model
|
|
2
|
+
|
|
3
|
+
## SQL with Drizzle
|
|
4
|
+
|
|
5
|
+
This excerpt assumes an Arc application `builder` and your initialized Drizzle SQLite `database` for the default tenant.
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { field, Guid } from '@cratis/fundamentals';
|
|
9
|
+
import { query, queryOptions, readModel, service, type QueryOptions } from '@cratis/arc.core';
|
|
10
|
+
import { sqliteTable, text } from 'drizzle-orm/sqlite-core';
|
|
11
|
+
import { DrizzleDialect, drizzleReadModel, guidCodec, sqliteColumn, type DrizzleReadModels } from '@cratis/arc.drizzle';
|
|
12
|
+
|
|
13
|
+
export const tasks = sqliteTable('tasks', {
|
|
14
|
+
id: sqliteColumn(guidCodec(DrizzleDialect.SQLite))('id').primaryKey(),
|
|
15
|
+
title: text('title').notNull()
|
|
16
|
+
});
|
|
17
|
+
export class TaskRecord {
|
|
18
|
+
@field(Guid) id!: Guid;
|
|
19
|
+
@field(String) title!: string;
|
|
20
|
+
}
|
|
21
|
+
@readModel()
|
|
22
|
+
export class TaskQueries {
|
|
23
|
+
@query(service(drizzleReadModel(TaskRecord)), queryOptions())
|
|
24
|
+
static page(rows: DrizzleReadModels<TaskRecord>, options: QueryOptions) {
|
|
25
|
+
return rows.queryPage(undefined, options);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
builder.add(TaskQueries).withDrizzle({ dialect: DrizzleDialect.SQLite, database,
|
|
29
|
+
readModels: [{ type: TaskRecord, table: tasks }] });
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- Each `@field` needs a column under the **same property key** of the Drizzle
|
|
33
|
+
table object (the SQL column name is yours); the table needs a primary key.
|
|
34
|
+
Registration fails otherwise. The selection includes declared model fields
|
|
35
|
+
and primary-key columns; only declared fields materialize on the model.
|
|
36
|
+
- Options: `dialect` (`DrizzleDialect.PostgreSQL | MySQL | SQLite`), `database`
|
|
37
|
+
(default tenant only), `databaseFactory(tenant, context)` (sync or async; the
|
|
38
|
+
application caches and disposes), `readModels`, `maxPageSize`, `observation`.
|
|
39
|
+
Supply exactly one of `database` or `databaseFactory`. Access without a
|
|
40
|
+
tenant, or to a named tenant with only `database`, fails.
|
|
41
|
+
- **Codecs** map Arc types to columns: `guidCodec(dialect)` (`uuid`, `char(36)`,
|
|
42
|
+
`text`), `conceptCodec(Concept, ConceptCodecKind.String | Number, dialect)`,
|
|
43
|
+
`dateOnlyCodec`, `timeOnlyCodec`, `timeSpanCodec`, `jsonCodec(dialect,
|
|
44
|
+
validate)`, wrapped by `pgColumn`, `mysqlColumn` or `sqliteColumn`. A concept
|
|
45
|
+
class declares `static readonly valueType` because generics are erased.
|
|
46
|
+
- **Schema.** Arc checks table against model at startup and never creates,
|
|
47
|
+
alters or migrates the database. Add the column to the table, the model and a
|
|
48
|
+
migration together (for example a drizzle-kit migration you own).
|
|
49
|
+
- **Writes** go through `drizzleDatabase<TDatabase>()` injected into `handle()`;
|
|
50
|
+
`database.native` is the Drizzle database. `queryPage` pushes count, sort,
|
|
51
|
+
limit and offset into SQL.
|
|
52
|
+
- **Observation is opt-in.** `DrizzleObservation.InProcess` sees only writes
|
|
53
|
+
announced with `database.notifyChanged(table)` in this process.
|
|
54
|
+
`{ mode: DrizzleObservation.PostgreSQLNotify, listener }` sees committed changes
|
|
55
|
+
from any process. Install the trigger SQL in an application migration. For a
|
|
56
|
+
plain `pgTable`, call `postgresqlChangeTrigger(table, { schema: 'public' })`
|
|
57
|
+
if the table is in `public`; otherwise pass its actual schema. For a table
|
|
58
|
+
declared with `pgSchema`, call `postgresqlChangeTrigger(table)`.
|
|
59
|
+
Use `nodePostgresListener` (`pg` `^8`) with a **new, unconnected, dedicated**
|
|
60
|
+
`pg.Client` per listener. Route the listener and reader to the same tenant
|
|
61
|
+
database. Arc does not install the trigger at runtime, and NOTIFY does not
|
|
62
|
+
replay changes that happened during a disconnect.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cratis-arc-tenancy-typescript
|
|
3
|
-
description: Use when
|
|
3
|
+
description: Use when tuning tenant selection or storage routing for an Arc Node.js server, including claim-based or custom resolution and long-lived execution. Not for the basic tenant membership check (use cratis-arc-isolate-tenant).
|
|
4
4
|
license: MIT
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -20,67 +20,37 @@ None replaces another. A database per tenant does not stop a caller from naming
|
|
|
20
20
|
someone else's tenant in a header. The package is `@cratis/arc.core`
|
|
21
21
|
(`ArcApplication`, `TenantResolverType`).
|
|
22
22
|
|
|
23
|
-
##
|
|
23
|
+
## Resolve a verified tenant
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
| `tenancy: { resolverType }` | One .NET-compatible source (defaults to `header` once `tenancy` is present); never combine with `sources` |
|
|
31
|
-
|
|
32
|
-
Built-in sources (`TenantResolverType`):
|
|
33
|
-
|
|
34
|
-
| Source | Option (default) | Reads |
|
|
35
|
-
| --- | --- | --- |
|
|
36
|
-
| `header` | `httpHeader` (`x-cratis-tenant-id`) | request header |
|
|
37
|
-
| `query` | `queryParameter` (`tenantId`) | query string |
|
|
38
|
-
| `claim` | `claimType` (`tenant_id`) | own string claim of an authenticated principal |
|
|
39
|
-
| `fixed` | `fixedTenantId` (`development`) | configured deployment value |
|
|
40
|
-
| `development` | `fixedTenantId` (`development`) | same fixed source; does **not** check the environment |
|
|
41
|
-
| `subdomain` | `baseDomain` (required) | the adapter's verified `native.authority`, never raw `Host`/`X-Forwarded-Host` |
|
|
42
|
-
|
|
43
|
-
Shared options: `required` (unresolved tenant answers 400) and
|
|
44
|
-
`membershipClaim` (a comma-separated own claim of an authenticated principal
|
|
45
|
-
must include the selected tenant, else 403). Tenant IDs are lowercased and must
|
|
46
|
-
be DNS labels (letters, digits, hyphens, at most 63 characters); an invalid
|
|
47
|
-
selected ID answers 400. A single-tenant app uses
|
|
48
|
-
`{ resolverType: TenantResolverType.Fixed, fixedTenantId: 'default' }`.
|
|
25
|
+
When the identity provider assigns one active tenant and callers cannot switch
|
|
26
|
+
it, select a tenant claim from verified authentication. If callers switch
|
|
27
|
+
tenants, keep Arc’s default header selector and use the membership check in
|
|
28
|
+
the `cratis-arc-isolate-tenant` skill (installed with `cratis/arc/server-typescript`).
|
|
29
|
+
In either tenant-only host, require a selection and verify membership. In this excerpt, `verifiedHandlers` holds the app’s authentication handlers:
|
|
49
30
|
|
|
50
31
|
```typescript
|
|
32
|
+
import { ArcApplication, TenantResolverType } from '@cratis/arc.core';
|
|
33
|
+
|
|
51
34
|
const builder = ArcApplication.createBuilder({
|
|
52
|
-
authentication:
|
|
53
|
-
tenancy: {
|
|
54
|
-
sources: [TenantResolverType.Claim, TenantResolverType.Header],
|
|
55
|
-
claimType: 'tenant', membershipClaim: 'tenants', required: true
|
|
56
|
-
}
|
|
35
|
+
authentication: verifiedHandlers,
|
|
36
|
+
tenancy: { resolverType: TenantResolverType.Claim, membershipClaim: 'tenants', required: true }
|
|
57
37
|
});
|
|
58
38
|
```
|
|
59
39
|
|
|
60
|
-
|
|
61
|
-
400
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
`appsettings.json`; `sources` and `resolve` are code-only.
|
|
65
|
-
|
|
66
|
-
## Prove membership
|
|
40
|
+
With `tenant_id: 'acme'` and `tenants: 'acme, other'`, the execution receives
|
|
41
|
+
`acme`. No tenant is 400; a selected tenant absent from `tenants` is 403. The
|
|
42
|
+
built-in resolver normalizes case and rejects malformed IDs. Without tenancy
|
|
43
|
+
options, Arc only reads the header; that is not membership enforcement.
|
|
67
44
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
derive the tenant from the principal in `tenancy.resolve` and check
|
|
71
|
-
membership there; return lowercase IDs.
|
|
72
|
-
- Enforce membership in tenancy options or authorization, never in validators:
|
|
73
|
-
a trusted direct caller can lower the blocking severity.
|
|
74
|
-
- Never use `development` or `fixed` to accept a browser-supplied tenant.
|
|
75
|
-
- Treat tenant IDs as internal metadata; keep them out of public URLs and
|
|
76
|
-
error text when a customer name would reveal who else uses the system.
|
|
45
|
+
Read [tenant selection](references/tenant-selection.md) when selecting a tenant
|
|
46
|
+
through deployment configuration, ordered built-in sources, or a custom resolver.
|
|
77
47
|
|
|
78
48
|
## Storage follows the tenant
|
|
79
49
|
|
|
80
50
|
| Integration | Tenant `acme` | Tenant `default` | No tenant |
|
|
81
51
|
| --- | --- | --- | --- |
|
|
82
52
|
| MongoDB, `database: 'tasks'` | database `tasks+acme` (or `databaseNameResolver`) | `tasks` | request fails |
|
|
83
|
-
| Drizzle | the connection `databaseFactory('acme', context)` returns | `databaseFactory('default', context)` or
|
|
53
|
+
| Drizzle | the connection `databaseFactory('acme', context)` returns | `databaseFactory('default', context)` or, when configured instead, `database` | request fails |
|
|
84
54
|
| Chronicle | namespace `acme` | namespace `default` | namespace `Default` |
|
|
85
55
|
|
|
86
56
|
MongoDB and Drizzle lowercase the tenant; Chronicle passes it unchanged, so
|
|
@@ -103,15 +73,15 @@ Callbacks receive the execution context (`tenantId`, `principal`,
|
|
|
103
73
|
| Direct call (job) | `tenantId` in the context you pass | that call |
|
|
104
74
|
|
|
105
75
|
Keep tenant-scoped handles (collections, connections, caches) in scoped
|
|
106
|
-
services: a singleton
|
|
107
|
-
|
|
108
|
-
|
|
76
|
+
services: a singleton can retain another request’s tenant. Background calls must supply
|
|
77
|
+
a tenant explicitly. Include it in cache keys; never log membership claims or
|
|
78
|
+
credentials.
|
|
109
79
|
|
|
110
80
|
## Specify and verify
|
|
111
81
|
|
|
112
82
|
`CommandScenario.for(...).withContext({ tenantId: 'acme', principal })` proves
|
|
113
83
|
your code uses the tenant it is given; it does not prove the resolver or storage
|
|
114
|
-
configuration. Cover
|
|
84
|
+
configuration. Cover a missing tenant, `default`, two named tenants,
|
|
115
85
|
a denied selection (403, nothing read or written), concurrent requests for two
|
|
116
86
|
tenants, long-lived work (observable queries, reactors) and direct calls.
|
|
117
87
|
`cratis-arc-testing-typescript` has the scenario setup; use `ArcScenario` with
|
|
@@ -119,7 +89,6 @@ HTTP requests to test the resolver itself.
|
|
|
119
89
|
|
|
120
90
|
## Route near misses
|
|
121
91
|
|
|
122
|
-
- Node host setup:
|
|
92
|
+
- Node host setup: `cratis-arc-select-backend-sdk`.
|
|
123
93
|
- Chronicle namespaces in .NET: the `cratis-chronicle-connect-application` skill (in `cratis/chronicle/client-dotnet`).
|
|
124
|
-
- Request authorization:
|
|
125
|
-
- C# Arc tenant resolution: the C# Arc skills.
|
|
94
|
+
- Request authorization: `cratis-arc-authorize-request`.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Choose an alternate tenant source
|
|
2
|
+
|
|
3
|
+
## Choose how the tenant is selected
|
|
4
|
+
|
|
5
|
+
| Configure | Behavior |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| nothing | Reads the `x-cratis-tenant-id` header unchanged; missing means `tenantId` is `undefined` |
|
|
8
|
+
| `tenancy: { resolve(request, principal) }` | Your resolver alone decides (may be `async`); `undefined` means no tenant; no fallback; Arc does not apply `sources`, `required`, `membershipClaim` or lowercasing to it |
|
|
9
|
+
| `tenancy: { sources: [...] }` | Ordered built-in sources, first nonempty answer wins |
|
|
10
|
+
| `tenancy: { resolverType }` | One built-in strategy (defaults to `header` once `tenancy` is present); `subdomain` falls back to the header. Never combine with `sources` |
|
|
11
|
+
|
|
12
|
+
Built-in sources (`TenantResolverType`):
|
|
13
|
+
|
|
14
|
+
| Source | Option (default) | Reads |
|
|
15
|
+
| --- | --- | --- |
|
|
16
|
+
| `header` | `httpHeader` (`x-cratis-tenant-id`) | request header |
|
|
17
|
+
| `query` | `queryParameter` (`tenantId`) | query string |
|
|
18
|
+
| `claim` | `claimType` (`tenant_id`) | own string claim of an authenticated principal |
|
|
19
|
+
| `fixed` | `fixedTenantId` (`development`) | configured deployment value |
|
|
20
|
+
| `development` | `fixedTenantId` (`development`) | same fixed source; does **not** check the environment |
|
|
21
|
+
| `subdomain` | `baseDomain` (required) | the adapter's verified `native.authority`, never raw `Host`/`X-Forwarded-Host` |
|
|
22
|
+
|
|
23
|
+
Shared options: `required` (unresolved tenant answers 400) and
|
|
24
|
+
`membershipClaim` (a comma-separated own claim of an authenticated principal
|
|
25
|
+
must include the selected tenant, else 403). Tenant IDs are lowercased and must
|
|
26
|
+
be DNS labels (letters, digits, hyphens, at most 63 characters); an invalid
|
|
27
|
+
selected ID answers 400. A single-tenant app uses
|
|
28
|
+
`{ resolverType: TenantResolverType.Fixed, fixedTenantId: 'default' }`.
|
|
29
|
+
|
|
30
|
+
Choose ordered `sources` when more than one verified selection workflow is
|
|
31
|
+
required. For example, use `[TenantResolverType.Claim, TenantResolverType.Header]`
|
|
32
|
+
with `membershipClaim` when the header is a supported fallback. A malformed
|
|
33
|
+
selected ID is rejected; selection does not continue to a later source.
|
|
34
|
+
|
|
35
|
+
`resolverType`, `httpHeader`, `baseDomain`, `queryParameter`, `claimType`, `fixedTenantId`,
|
|
36
|
+
`required` and `membershipClaim` also bind from `Cratis:Arc:Tenancy` in
|
|
37
|
+
`appsettings.json`; `sources` and `resolve` are code-only.
|
|
38
|
+
|
|
39
|
+
## Prove membership
|
|
40
|
+
|
|
41
|
+
- A header, query string or subdomain value is a request, not proof. When
|
|
42
|
+
tenants separate customers, verify membership independently. For a custom
|
|
43
|
+
`tenancy.resolve`, derive or validate the selection against verified caller
|
|
44
|
+
membership there; return lowercase IDs.
|
|
45
|
+
- Enforce membership in tenancy options or authorization, never in validators:
|
|
46
|
+
a trusted direct caller can lower the blocking severity.
|
|
47
|
+
- Never use `development` or `fixed` to accept a browser-supplied tenant.
|
|
48
|
+
- Treat tenant IDs as internal metadata; keep them out of public URLs and
|
|
49
|
+
error text when a customer name would reveal who else uses the system.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cratis-arc-testing-kotlin
|
|
3
|
-
description: Use when writing or diagnosing Kotlin or Java Arc pipeline specifications without Spring Boot or a kernel. Not for standalone Chronicle client
|
|
3
|
+
description: Use when writing or diagnosing Kotlin or Java Arc pipeline specifications without Spring Boot or a kernel. Not for choosing a standalone Chronicle client (use cratis-chronicle-select-client).
|
|
4
4
|
license: MIT
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -13,8 +13,9 @@ Use generated artifacts through the real pipelines, not hand-written handlers
|
|
|
13
13
|
that bypass KSP wiring. `arc-testing` needs neither Spring Boot nor Docker.
|
|
14
14
|
This is test support, not an alternative production host.
|
|
15
15
|
|
|
16
|
-
Add `
|
|
17
|
-
|
|
16
|
+
Add `io.cratis:arc-testing` as a Gradle test dependency. Start with
|
|
17
|
+
`CommandScenario` for command execution or validation; select a query scenario
|
|
18
|
+
only when the behavior depends on the query pipeline.
|
|
18
19
|
|
|
19
20
|
## Choose the pipeline
|
|
20
21
|
|
|
@@ -29,8 +30,8 @@ Application specs select a generated `ArcArtifactModule`. Manual
|
|
|
29
30
|
Arrange services, validators, authorization policies, filters, principal,
|
|
30
31
|
tenant and correlation id on the scenario before executing it.
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
This excerpt assumes the generated `module`, the slice’s command and response
|
|
34
|
+
types, and a fake `repository` implementing `TaskRepository`.
|
|
34
35
|
|
|
35
36
|
```kotlin
|
|
36
37
|
// Copyright (c) Cratis. All rights reserved.
|
|
@@ -90,35 +91,16 @@ empty or early. Chain `shouldHaveEmissionCount(expected)` when count matters.
|
|
|
90
91
|
`addEmissionGuard` supplies per-emission checks; assert opening rejection with
|
|
91
92
|
`shouldFail()` and terminal guard denial with `shouldTerminateUnauthorized()`.
|
|
92
93
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
establishes prior history; `chronicle().shouldHaveAppendedEvent(id, Event::class.java)`
|
|
99
|
-
checks the new append. Given events are excluded from `appendedEvents`.
|
|
100
|
-
Arrange `constraintViolation(...)` or `concurrencyViolation(...)` to reject an
|
|
101
|
-
append deterministically and assert `shouldHaveConstraintViolation(...)` or
|
|
102
|
-
`shouldHaveConcurrencyViolation(...)`. Rejected appends are not appended events.
|
|
103
|
-
This does not verify a real kernel constraint or storage integration.
|
|
104
|
-
|
|
105
|
-
## Java and verification
|
|
106
|
-
|
|
107
|
-
Use the closeable `BlockingCommandScenario` over a configured scenario for
|
|
108
|
-
ordinary Java tests; configure pins, tenant resolution and Chronicle before
|
|
109
|
-
constructing the bridge. `ChronicleCommandScenarios` exposes Kotlin extensions
|
|
110
|
-
as Java statics. For asynchronous tests use `AsyncCommandScenario`,
|
|
111
|
-
`AsyncQueryScenario`, `AsyncObservableQueryScenario` and a `JavaAsyncScope`.
|
|
112
|
-
`usingExecutor` borrows an executor; `owningExecutorService` owns shutdown.
|
|
113
|
-
Scenarios borrow the scope; close the owner after the test.
|
|
114
|
-
`collectAsync` returns a `CompletionStage` with bounded collection. Timeout
|
|
115
|
-
cancels the stage; callback-based `collect` does not deliver timeout callbacks.
|
|
116
|
-
|
|
117
|
-
- Follow the `for_`/`when_` naming conventions in `kotlin.md`/`java.md`.
|
|
94
|
+
Read [JVM scenario variants](references/jvm-scenario-variants.md) when asserting Chronicle appends without a kernel or using Java scenario bridges.
|
|
95
|
+
|
|
96
|
+
## Verify
|
|
97
|
+
|
|
98
|
+
- Follow the `for_`/`when_` naming convention.
|
|
118
99
|
- Run `./gradlew build` with warnings treated as errors and all affected specs.
|
|
119
100
|
- Verify authorization, rejection, absence and failure paths that apply, not
|
|
120
101
|
only a successful response.
|
|
121
102
|
- Run real-store integration checks separately when the behavior depends on
|
|
122
103
|
kernel constraints, persistence, transactions or change streams.
|
|
123
104
|
|
|
124
|
-
For
|
|
105
|
+
For definitions rather than tests, use `cratis-arc-declare-command`,
|
|
106
|
+
`cratis-arc-expose-query`, or `cratis-arc-validation-kotlin`.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Configure Chronicle and Java scenarios
|
|
2
|
+
|
|
3
|
+
## Chronicle integration without a kernel
|
|
4
|
+
|
|
5
|
+
Add the Chronicle starter (or `io.cratis:cratis`) alongside `arc-testing`.
|
|
6
|
+
Its `CommandScenarioExtender` is found through `ServiceLoader` and supplies
|
|
7
|
+
an in-memory event log automatically. `givenChronicle().events(id, event)`
|
|
8
|
+
establishes prior history; `chronicle().shouldHaveAppendedEvent(id, Event::class.java)`
|
|
9
|
+
checks the new append. Given events are excluded from `appendedEvents`.
|
|
10
|
+
Arrange `constraintViolation(...)` or `concurrencyViolation(...)` to reject an
|
|
11
|
+
append deterministically and assert `shouldHaveConstraintViolation(...)` or
|
|
12
|
+
`shouldHaveConcurrencyViolation(...)`. Rejected appends are not appended events.
|
|
13
|
+
This does not verify a real kernel constraint or storage integration.
|
|
14
|
+
|
|
15
|
+
## Java scenario bridges
|
|
16
|
+
|
|
17
|
+
Use the closeable `BlockingCommandScenario` over a configured scenario for
|
|
18
|
+
ordinary Java tests; configure pins, tenant resolution and Chronicle before
|
|
19
|
+
constructing the bridge. `ChronicleCommandScenarios` exposes Kotlin extensions
|
|
20
|
+
as Java statics. For asynchronous tests use `AsyncCommandScenario`,
|
|
21
|
+
`AsyncQueryScenario`, `AsyncObservableQueryScenario` and a `JavaAsyncScope`.
|
|
22
|
+
`usingExecutor` borrows an executor; `owningExecutorService` owns shutdown.
|
|
23
|
+
Scenarios borrow the scope; close the owner after the test.
|
|
24
|
+
`collectAsync` returns a `CompletionStage` with bounded collection. Timeout
|
|
25
|
+
cancels the stage; callback-based `collect` does not deliver timeout callbacks.
|