@cratis/pi 7.50.0 → 7.51.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/authoring-skills.instructions.md +93 -0
- package/package/corpus/harnesses/copilot/instructions/profiles.instructions.md +4 -0
- package/package/corpus/prompts/review-skill.prompt.md +6 -8
- package/package/corpus/rules/authoring-skills.md +92 -0
- package/package/corpus/rules/general.md +1 -0
- package/package/corpus/rules/profiles.md +4 -0
- package/package/corpus/skills/cratis-application-react-specifications/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/SKILL.md +23 -29
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authentication.md +7 -7
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authorization.md +34 -32
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authproxy.md +1 -1
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/frontend.md +2 -2
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/local-development.md +3 -3
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/observable-emission-guards.md +8 -6
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/tenancy.md +3 -3
- package/package/corpus/skills/cratis-arc-command/SKILL.md +23 -25
- package/package/corpus/skills/cratis-arc-command/references/command-result.md +1 -1
- package/package/corpus/skills/cratis-arc-command/references/decisions-and-routing.md +9 -9
- package/package/corpus/skills/cratis-arc-command/references/generated-values.md +11 -12
- package/package/corpus/skills/cratis-arc-command/references/handler-shapes.md +4 -4
- package/package/corpus/skills/cratis-arc-command/references/proxy-generation.md +3 -3
- package/package/corpus/skills/cratis-arc-command/references/read-model-injection.md +1 -3
- package/package/corpus/skills/cratis-arc-command/references/shop-generation.md +11 -14
- package/package/corpus/skills/cratis-arc-command-execution/LICENSE +6 -0
- package/package/corpus/skills/cratis-arc-command-execution/SKILL.md +17 -19
- package/package/corpus/skills/cratis-arc-command-kotlin/SKILL.md +8 -7
- package/package/corpus/skills/cratis-arc-command-kotlin/references/read-model-naming.md +2 -2
- package/package/corpus/skills/cratis-arc-command-operation/SKILL.md +14 -15
- package/package/corpus/skills/cratis-arc-command-operation/references/execution-and-recovery.md +2 -2
- package/package/corpus/skills/cratis-arc-command-operation/references/testing.md +7 -8
- package/package/corpus/skills/cratis-arc-command-typescript/SKILL.md +14 -11
- package/package/corpus/skills/cratis-arc-command-typescript/references/chronicle-events.md +7 -7
- package/package/corpus/skills/cratis-arc-command-typescript/references/command-operations.md +4 -4
- package/package/corpus/skills/cratis-arc-command-typescript/references/hosting-and-storage.md +11 -7
- package/package/corpus/skills/cratis-arc-command-typescript/references/identity-and-introspection.md +4 -2
- package/package/corpus/skills/cratis-arc-command-typescript/references/observability-and-host-scopes.md +2 -2
- package/package/corpus/skills/cratis-arc-command-typescript/references/proxy-generation.md +3 -3
- package/package/corpus/skills/cratis-arc-command-typescript/references/slice-layout.md +1 -1
- package/package/corpus/skills/cratis-arc-command-typescript/verification.json +2 -2
- package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +10 -14
- package/package/corpus/skills/cratis-arc-ef-core-migration/LICENSE +6 -0
- package/package/corpus/skills/cratis-arc-ef-core-migration/SKILL.md +9 -10
- package/package/corpus/skills/cratis-arc-go/SKILL.md +14 -15
- package/package/corpus/skills/cratis-arc-go/references/queries.md +2 -2
- package/package/corpus/skills/cratis-arc-hosting/SKILL.md +8 -8
- package/package/corpus/skills/cratis-arc-hosting/references/integrations-and-publish.md +11 -11
- package/package/corpus/skills/cratis-arc-identity-and-tenancy-kotlin/SKILL.md +3 -3
- package/package/corpus/skills/cratis-arc-observable-query-http/SKILL.md +13 -13
- package/package/corpus/skills/cratis-arc-observable-query-http/verification.json +1 -1
- package/package/corpus/skills/cratis-arc-query-kotlin/SKILL.md +2 -3
- package/package/corpus/skills/cratis-arc-query-paging/SKILL.md +11 -14
- package/package/corpus/skills/cratis-arc-query-typescript/SKILL.md +3 -3
- package/package/corpus/skills/cratis-arc-query-typescript/references/storage-observation-and-compliance.md +2 -2
- package/package/corpus/skills/cratis-arc-spring-data-kotlin/SKILL.md +3 -3
- package/package/corpus/skills/cratis-arc-testing-kotlin/SKILL.md +3 -3
- package/package/corpus/skills/cratis-arc-validation-kotlin/SKILL.md +1 -2
- package/package/corpus/skills/cratis-arc-validation-typescript/SKILL.md +4 -4
- package/package/corpus/skills/cratis-chronicle-cli-operations/SKILL.md +19 -22
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/command-effects.md +10 -10
- package/package/corpus/skills/cratis-chronicle-client-dotnet/SKILL.md +36 -36
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/additional-surfaces.md +4 -2
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/client-construction.md +1 -1
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/compatibility-check.md +13 -13
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/discovery.md +10 -10
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/hosting.md +10 -10
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/pinned-generation-delivery.md +7 -5
- package/package/corpus/skills/cratis-chronicle-client-elixir/SKILL.md +59 -64
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/append-api.md +17 -17
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/compliance.md +5 -3
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/connections.md +15 -11
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/event-sources.md +3 -1
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/pitfalls.md +4 -4
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/projections.md +8 -4
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/upgrading.md +19 -19
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/variants.md +3 -8
- package/package/corpus/skills/cratis-chronicle-client-elixir/verification.json +2 -2
- package/package/corpus/skills/cratis-chronicle-client-go/SKILL.md +16 -18
- package/package/corpus/skills/cratis-chronicle-client-go/references/projections.md +2 -2
- package/package/corpus/skills/cratis-chronicle-client-kotlin/SKILL.md +61 -58
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/connection-lifecycle.md +9 -10
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/discovery-and-registration.md +6 -6
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/event-sources.md +4 -2
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/java-api.md +4 -4
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/options.md +1 -1
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/spring-boot.md +24 -24
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/variants.md +6 -5
- package/package/corpus/skills/cratis-chronicle-client-typescript/SKILL.md +26 -20
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/read-models-and-projections.md +4 -4
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/testing.md +1 -1
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/variants.md +4 -3
- package/package/corpus/skills/cratis-chronicle-client-typescript/verification.json +2 -2
- package/package/corpus/skills/cratis-chronicle-compliance/SKILL.md +9 -9
- package/package/corpus/skills/cratis-chronicle-decision-reads/SKILL.md +11 -10
- package/package/corpus/skills/cratis-chronicle-decision-reads/references/admission-and-ownership.md +1 -1
- package/package/corpus/skills/cratis-chronicle-decision-reads/references/choosing-how-a-rule-holds.md +5 -6
- package/package/corpus/skills/cratis-chronicle-event-constraints/SKILL.md +7 -7
- package/package/corpus/skills/cratis-chronicle-event-constraints/references/closing-streams.md +1 -1
- package/package/corpus/skills/cratis-chronicle-event-specifications/SKILL.md +6 -6
- package/package/corpus/skills/cratis-chronicle-event-type-migration/SKILL.md +12 -10
- package/package/corpus/skills/cratis-chronicle-event-type-migration/references/pinned-generations.md +2 -3
- package/package/corpus/skills/cratis-chronicle-hosting/SKILL.md +7 -7
- package/package/corpus/skills/cratis-chronicle-hosting/references/operations.md +5 -5
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/SKILL.md +6 -6
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/blocked-tools.md +5 -5
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/deployment.md +9 -10
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/observational-tools.md +29 -29
- package/package/corpus/skills/cratis-chronicle-multi-tenancy/SKILL.md +9 -9
- package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +13 -14
- package/package/corpus/skills/cratis-chronicle-projection/references/fluent-builder.md +3 -5
- package/package/corpus/skills/cratis-chronicle-projection/references/model-bound-attributes.md +2 -4
- package/package/corpus/skills/cratis-chronicle-projection/references/variants.md +1 -3
- package/package/corpus/skills/cratis-chronicle-read-model/SKILL.md +16 -15
- package/package/corpus/skills/cratis-chronicle-read-model/references/queries.md +8 -8
- package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +14 -13
- package/package/corpus/skills/cratis-chronicle-web-workbench/SKILL.md +11 -12
- package/package/corpus/skills/cratis-cli-terminal-workbench/SKILL.md +6 -6
- package/package/corpus/skills/cratis-code-review/SKILL.md +13 -17
- package/package/corpus/skills/cratis-components-accessibility/SKILL.md +3 -3
- package/package/corpus/skills/cratis-components-common-controls/SKILL.md +15 -15
- package/package/corpus/skills/cratis-components-data-surfaces/SKILL.md +29 -29
- package/package/corpus/skills/cratis-components-schema-editor/SKILL.md +4 -4
- package/package/corpus/skills/cratis-components-schema-editor/references/tree-layout.md +1 -1
- package/package/corpus/skills/cratis-components-stepper-command-dialog/SKILL.md +6 -6
- package/package/corpus/skills/cratis-components-styling/LICENSE +6 -0
- package/package/corpus/skills/cratis-components-styling/SKILL.md +5 -4
- package/package/corpus/skills/cratis-components-toolbar/SKILL.md +5 -5
- package/package/corpus/skills/cratis-developer-marketing/SKILL.md +2 -2
- package/package/corpus/skills/cratis-engineering-csharp-conventions/SKILL.md +3 -3
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/exceptions-logging-and-di.md +1 -1
- package/package/corpus/skills/cratis-engineering-effect-boundaries/references/failure-archetypes.md +4 -4
- package/package/corpus/skills/cratis-fundamentals-concept/SKILL.md +19 -24
- package/package/corpus/skills/cratis-fundamentals-concept/references/shop-generation.md +10 -10
- package/package/corpus/skills/cratis-fundamentals-concept/references/typescript-concepts.md +8 -8
- package/package/corpus/skills/cratis-fundamentals-concept-go/SKILL.md +10 -11
- package/package/corpus/skills/cratis-fundamentals-telemetry/SKILL.md +18 -18
- package/package/corpus/skills/cratis-fundamentals-telemetry/verification.json +1 -1
- package/package/corpus/skills/cratis-fundamentals-type-discovery/SKILL.md +4 -4
- package/package/corpus/skills/cratis-lens-browser-extension/SKILL.md +19 -19
- package/package/corpus/skills/cratis-orleans-jobs/SKILL.md +27 -27
- package/package/corpus/skills/cratis-orleans-jobs/references/state-machines.md +12 -12
- package/package/corpus/skills/cratis-performance-review/SKILL.md +8 -10
- package/package/corpus/skills/cratis-release-notes/SKILL.md +1 -1
- package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +1 -1
- package/package/corpus/skills/cratis-security-review/SKILL.md +8 -10
- package/package/corpus/skills/cratis-security-review/references/arc-boundaries.md +18 -16
- package/package/corpus/skills/cratis-specification-by-example/SKILL.md +1 -1
- package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +26 -29
- package/package/corpus/skills/cratis-specifications-csharp/references/application-scenarios.md +8 -8
- package/package/corpus/skills/cratis-specifications-csharp/references/csharp-patterns.md +2 -2
- package/package/corpus/skills/cratis-specifications-csharp/references/integration-specs.md +6 -4
- package/package/corpus/skills/cratis-specifications-csharp/references/shared-lifecycle.md +6 -2
- package/package/corpus/skills/cratis-specifications-typescript/SKILL.md +2 -2
- package/package/corpus/skills/cratis-studio-mcp-safety-guidance/SKILL.md +4 -4
- package/package/corpus/skills/cratis-writing-voice-and-cadence/SKILL.md +1 -1
- package/package/corpus/skills/guiding-refactoring-with-code-health/SKILL.md +1 -1
- package/package/corpus/skills/prioritizing-technical-debt/SKILL.md +1 -1
- package/package/corpus/skills/risk-based-testing-with-code-health/SKILL.md +3 -3
- package/package/corpus/skills/safeguarding-ai-generated-code/SKILL.md +1 -1
- package/package.json +1 -1
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
# Grain lifecycle state machines
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Source: `Cratis/Orleans`. Use explicit states when entering/leaving a status has behavior; an enum is enough for a status with no behavior. Do not put long-running work on a grain turn just because `OnEnter` is available.
|
|
7
7
|
|
|
8
8
|
## Stored lifecycle
|
|
9
9
|
|
|
10
|
-
`StateMachine<TStoredState>` derives from a stateful grain. Override `InitialState` and `CreateStates()`; states derive `State<TStoredState>`. `AllowedTransitions` is an immutable list of target types, or override `CanTransitionTo<TTargetState>(storedState)` for a guard (`Source/Orleans/StateMachines/StateMachine.cs
|
|
10
|
+
`StateMachine<TStoredState>` derives from a stateful grain. Override `InitialState` and `CreateStates()`; states derive `State<TStoredState>`. `AllowedTransitions` is an immutable list of target types, or override `CanTransitionTo<TTargetState>(storedState)` for a guard (`Source/Orleans/StateMachines/StateMachine.cs`; `State.cs`).
|
|
11
11
|
|
|
12
12
|
Declaration excerpt for an existing grain file with `ProcessState : StateMachineState`, the existing `IProcess` grain interface, and a registered `processes` grain storage provider:
|
|
13
13
|
|
|
@@ -44,21 +44,21 @@ public class Finished : State<ProcessState>;
|
|
|
44
44
|
|
|
45
45
|
Split types into their house-style files in the consumer; the block collects declarations to show the API. Do not copy the `processes` provider name into Chronicle's kernel; use its registered constants.
|
|
46
46
|
|
|
47
|
-
A refused transition is a **no-op**, not an exception or a successful change. An unknown target throws `UnknownStateTypeInStateMachine`. The machine runs leaving hooks, `OnLeave`, entering hooks, `OnEnter`, then persistence (`StateMachine.cs
|
|
47
|
+
A refused transition is a **no-op**, not an exception or a successful change. An unknown target throws `UnknownStateTypeInStateMachine`. The machine runs leaving hooks, `OnLeave`, entering hooks, `OnEnter`, then persistence (`StateMachine.cs`). Transitions requested while entering are scheduled; transitions while leaving throw `TransitioningDuringOnLeaveIsNotSupported`.
|
|
48
48
|
|
|
49
|
-
When stored state derives `StateMachineState`, `CurrentState` stores the state's full type name; activation resolves it, enters it again, and can repeat enter effects. Renames need a stored-value migration; an unknown recorded name throws `UnknownCurrentState` (`StateMachine.cs
|
|
49
|
+
When stored state derives `StateMachineState`, `CurrentState` stores the state's full type name; activation resolves it, enters it again, and can repeat enter effects. Renames need a stored-value migration; an unknown recorded name throws `UnknownCurrentState` (`StateMachine.cs`). A self-transition with the **same state instance** skips persistence: return a new stored-state instance when a self-transition must write.
|
|
50
50
|
|
|
51
|
-
For externally owned storage, the protected constructor accepts `Orleans.Core.IStorage<TStoredState>` and reads it on activation before the activation hook. Override `ResolveActivationState()` to derive lifecycle from authoritative state instead of persisting a second status
|
|
51
|
+
For externally owned storage, the protected constructor accepts `Orleans.Core.IStorage<TStoredState>` and reads it on activation before the activation hook. Override `ResolveActivationState()` to derive lifecycle from authoritative state instead of persisting a second status.
|
|
52
52
|
|
|
53
53
|
## Lifecycle following Chronicle facts
|
|
54
54
|
|
|
55
|
-
`EventSourcedStateMachine<TModel>` from `Cratis.Orleans.Chronicle.StateMachines` uses a Chronicle read model as authoritative state. Its interface derives `IEventSourcedStateMachine` (string-keyed). There is **no grain storage provider** to configure and writes are no-ops: `ReadModelStorage<TModel>` reads Chronicle; `ResolveState(TModel?)` derives activation state (`Source/Orleans.Chronicle/StateMachines/EventSourcedStateMachine.cs
|
|
55
|
+
`EventSourcedStateMachine<TModel>` from `Cratis.Orleans.Chronicle.StateMachines` uses a Chronicle read model as authoritative state. Its interface derives `IEventSourcedStateMachine` (string-keyed). There is **no grain storage provider** to configure and writes are no-ops: `ReadModelStorage<TModel>` reads Chronicle; `ResolveState(TModel?)` derives activation state (`Source/Orleans.Chronicle/StateMachines/EventSourcedStateMachine.cs`; `ReadModelStorage.cs`).
|
|
56
56
|
|
|
57
57
|
- Define states with `CreateStates()` as above, over `TModel`.
|
|
58
|
-
- Define event transitions in `DefineTransitions(IStateMachineTransitions<TModel>)`, using `.On<TEvent>().When(model => predicate).TransitionTo<TState>()`. First applicable allowed transition wins. Make `ResolveState` agree with these transitions after restart (`EventSourcedStateMachine.cs
|
|
59
|
-
- Use model-bound projection attributes, an already-discovered projection, or `DefineProjection(IProjectionBuilderFor<TModel>)`, not competing projections. `DefineProjection` and `DefineTransitions` run at startup **without a constructor**: use only the builder, never injected services or fields (`EventSourcedStateMachine.cs
|
|
60
|
-
- Register `AddEventSourcedStateMachines()` on `ISiloBuilder` or `IServiceCollection`, beside the application's Chronicle client registration; namespace `Cratis.Orleans.Chronicle.Hosting` (`Hosting/EventSourcedStateMachinesServiceCollectionExtensions.cs
|
|
61
|
-
- Grain keys include event store, namespace and event-source ID. Use `IGrainFactory.GetEventSourcedStateMachine<TInterface>(eventStore, eventSourceId)` from `Cratis.Orleans.Chronicle.StateMachines` so tenant coordinates come from the supplied event store (`StateMachines/EventSourcedStateMachineGrainFactoryExtensions.cs
|
|
62
|
-
- Prefer passive models. For events consumed by a materialized projection, the reactor waits for its sequence position before refreshing; `ModelCatchUpTimeout` defaults to 30 seconds and expiry fails with `ModelDidNotCatchUp` (`EventSourcedStateMachineReactor.cs
|
|
58
|
+
- Define event transitions in `DefineTransitions(IStateMachineTransitions<TModel>)`, using `.On<TEvent>().When(model => predicate).TransitionTo<TState>()`. First applicable allowed transition wins. Make `ResolveState` agree with these transitions after restart (`EventSourcedStateMachine.cs`, `StateMachineTransitions.cs`).
|
|
59
|
+
- Use model-bound projection attributes, an already-discovered projection, or `DefineProjection(IProjectionBuilderFor<TModel>)`, not competing projections. `DefineProjection` and `DefineTransitions` run at startup **without a constructor**: use only the builder, never injected services or fields (`EventSourcedStateMachine.cs`).
|
|
60
|
+
- Register `AddEventSourcedStateMachines()` on `ISiloBuilder` or `IServiceCollection`, beside the application's Chronicle client registration; namespace `Cratis.Orleans.Chronicle.Hosting` (`Hosting/EventSourcedStateMachinesServiceCollectionExtensions.cs`).
|
|
61
|
+
- Grain keys include event store, namespace and event-source ID. Use `IGrainFactory.GetEventSourcedStateMachine<TInterface>(eventStore, eventSourceId)` from `Cratis.Orleans.Chronicle.StateMachines` so tenant coordinates come from the supplied event store (`StateMachines/EventSourcedStateMachineGrainFactoryExtensions.cs`).
|
|
62
|
+
- Prefer passive models. For events consumed by a materialized projection, the reactor waits for its sequence position before refreshing; `ModelCatchUpTimeout` defaults to 30 seconds and expiry fails with `ModelDidNotCatchUp` (`EventSourcedStateMachineReactor.cs`; `EventSourcedStateMachinesOptions.cs`).
|
|
63
63
|
|
|
64
|
-
This machine **follows facts**, it does not arbitrate whether a command may append one. Keep command rejection and append-time invariants at their owning boundary. Enter/model-change effects may repeat on activation, redelivery or replay: design them idempotently (`Documentation/concepts/event-sourced-state-machines.md
|
|
64
|
+
This machine **follows facts**, it does not arbitrate whether a command may append one. Keep command rejection and append-time invariants at their owning boundary. Enter/model-change effects may repeat on activation, redelivery or replay: design them idempotently (`Documentation/concepts/event-sourced-state-machines.md`). Test guards, no-op refusals, reactivation and persistence failures separately from job recovery.
|
|
@@ -18,16 +18,14 @@ storage and replay cost that never goes away.
|
|
|
18
18
|
|
|
19
19
|
## Verified product sources
|
|
20
20
|
|
|
21
|
-
| Package |
|
|
22
|
-
| --- | --- |
|
|
23
|
-
| `Cratis.Chronicle` |
|
|
24
|
-
| `Cratis.Arc.Core` |
|
|
25
|
-
| `@cratis/components` | `
|
|
21
|
+
| Package | Purpose |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| `Cratis.Chronicle` | Observers, projections, reducers, reactors, replay |
|
|
24
|
+
| `Cratis.Arc.Core` | Query return shapes and server-side paging |
|
|
25
|
+
| `@cratis/components` | `DataTable` paging surface |
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
> MongoDB observations now re-read page and total on each change; see the
|
|
30
|
-
> read-model query reference for the distinction from unpaged retained sets.
|
|
27
|
+
Paged MongoDB observations re-read page and total on each change; see the
|
|
28
|
+
read-model query reference for the distinction from unpaged retained sets.
|
|
31
29
|
|
|
32
30
|
Reverify against the owning product repository before asserting a framework
|
|
33
31
|
behavior this file does not already state.
|
|
@@ -52,7 +50,7 @@ behavior this file does not already state.
|
|
|
52
50
|
received already carries what it needs. (Reactor dispatch is by the handler's
|
|
53
51
|
first parameter type — the method name is free, so look for the event-typed
|
|
54
52
|
parameter, not for a method called `On`.)
|
|
55
|
-
- **A new projection can replay all
|
|
53
|
+
- **A new projection can replay all earlier events without failing.** Ask it
|
|
56
54
|
explicitly: at production volume, does this projection complete a full replay?
|
|
57
55
|
- **Events are small.** No large blob and no base64 payload embedded in an
|
|
58
56
|
event; put the content elsewhere and carry a reference.
|
|
@@ -23,7 +23,7 @@ observable changes from the diff, specs, linked issues/PRs, and authoritative
|
|
|
23
23
|
product source at that revision. A PR description is published verbatim as
|
|
24
24
|
release notes in a Cratis repository; follow its current template and the
|
|
25
25
|
pull-request contract, and confirm that behavior before drafting. Do not turn
|
|
26
|
-
|
|
26
|
+
a draft into a claim about shipped behavior.
|
|
27
27
|
|
|
28
28
|
For each change, ask: who uses this path, what happened before, what happens
|
|
29
29
|
now, is action required, and how would they notice? Check changed defaults,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cratis-screenplay-slice-design
|
|
3
|
-
description: "Shape Screenplay slices from a discovered timeline: commands with reachable, authorized origins and traced inputs, rules placed by layer, a per-command refusal inventory, events-vs-views decisions, read models per screen component with queries that follow the business view, Level-1 screens, field lineage, state-transition tables, slice dependencies and the next slice. Use after discovery,
|
|
3
|
+
description: "Shape Screenplay slices from a discovered timeline: commands with reachable, authorized origins and traced inputs, rules placed by layer, a per-command refusal inventory, events-vs-views decisions, read models per screen component with queries that follow the business view, Level-1 screens, field lineage, state-transition tables, slice dependencies and the next slice. Use when designing slices after discovery, adding a capability or deciding command inputs, rule placement, read-model shape or screen data. Not for: stream boundaries or invariants across streams (use `cratis-screenplay-streams-and-consistency`), reactions and captures (use `cratis-screenplay-automations-and-translations`), which scenarios to write (use `cratis-screenplay-scenario-coverage`), or auditing a finished model (use `cratis-screenplay-model-review`)."
|
|
4
4
|
license: MIT
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -14,16 +14,14 @@ first.
|
|
|
14
14
|
|
|
15
15
|
## Verified product sources
|
|
16
16
|
|
|
17
|
-
| Package |
|
|
18
|
-
| --- | --- |
|
|
19
|
-
| `Cratis.Arc.Chronicle` | `
|
|
20
|
-
| `Cratis.Chronicle` | `
|
|
21
|
-
| `Cratis.Chronicle` | `
|
|
22
|
-
| `Cratis.Arc.Core` |
|
|
17
|
+
| Package | Purpose |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| `Cratis.Arc.Chronicle` | `[NotAudited]` in `Cratis.Arc.Chronicle.Commands`; the `ARCCHR0009` analyzer |
|
|
20
|
+
| `Cratis.Chronicle` | `[PII]`, `[Subject]`, redaction, namespace isolation |
|
|
21
|
+
| `Cratis.Chronicle` | `[Encrypted]` in `Cratis.Chronicle.ProtectedValues`; analyzers `CHR0052`, `CHR0053` |
|
|
22
|
+
| `Cratis.Arc.Core` | Authorization filters, `CommandResult.Unauthorized` |
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
> references/arc-boundaries.md. Arc depends on Chronicle 19.39.1; separately
|
|
26
|
-
> version-qualified Chronicle security claims retain their original verification.
|
|
24
|
+
Every Arc check is cited in references/arc-boundaries.md.
|
|
27
25
|
|
|
28
26
|
Reverify against the owning product repository before asserting a framework
|
|
29
27
|
guarantee this file does not already state.
|
|
@@ -101,7 +99,7 @@ command's properties as well as grepping them.
|
|
|
101
99
|
reviewer reading logs for 401s will miss authorization failures.
|
|
102
100
|
- Review [Arc-specific security boundaries](references/arc-boundaries.md) when
|
|
103
101
|
the diff touches hosting, identity, policies, discovery, streams or system actors.
|
|
104
|
-
It
|
|
102
|
+
It ties the checks to Arc source; do not assume a clean analyzer run proves
|
|
105
103
|
those deployment boundaries.
|
|
106
104
|
|
|
107
105
|
## Step 4 — Data exposure
|
|
@@ -3,57 +3,59 @@
|
|
|
3
3
|
<!-- Copyright (c) Cratis. All rights reserved. -->
|
|
4
4
|
<!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Source: Arc. Each source below is a path in the Arc repository.
|
|
7
7
|
|
|
8
8
|
- Enable `TrustForwardedIdentityHeaders` only behind an authenticating ingress
|
|
9
9
|
that strips caller identity headers, replaces them and prevents direct backend
|
|
10
10
|
access. Headers are unsigned, not proof of identity. Without the explicit
|
|
11
11
|
host-wide opt-in Arc ignores them. Custom handlers must honor the same flag.
|
|
12
|
-
[Secure defaults](https://github.com/Cratis/Arc/blob/
|
|
12
|
+
[Secure defaults](https://github.com/Cratis/Arc/blob/main/Documentation/upgrading/secure-defaults.mdx).
|
|
13
13
|
- Application code must not read `.cratis-identity`. The backend derives identity
|
|
14
14
|
from the authenticated principal; the JS client only falls back to the legacy
|
|
15
15
|
cookie on 404, never on 401/403. Use `clearCache()` on logout. Browser identity
|
|
16
16
|
remains display state, not server authorization.
|
|
17
|
-
[Backend provider](https://github.com/Cratis/Arc/blob/
|
|
18
|
-
[JS provider](https://github.com/Cratis/Arc/blob/
|
|
17
|
+
[Backend provider](https://github.com/Cratis/Arc/blob/main/Source/DotNET/Arc.Core/Identity/IdentityProvider.cs),
|
|
18
|
+
[JS provider](https://github.com/Cratis/Arc/blob/main/Source/JavaScript/Arc/identity/IdentityProvider.ts).
|
|
19
19
|
- Test all discovery routes outside Development. Default access is authenticated
|
|
20
20
|
there, or 404 when the host cannot authenticate. Explicit
|
|
21
21
|
`RequireAuthentication=false` opens discovery in every environment;
|
|
22
22
|
`Enabled=false` removes catalogs, not identity discovery. Disable both switches
|
|
23
23
|
when neither is needed. `[ExcludeFromDiscovery]` hides documentation/catalogs,
|
|
24
24
|
not invocation or authorization.
|
|
25
|
-
[Introspection](https://github.com/Cratis/Arc/blob/
|
|
25
|
+
[Introspection](https://github.com/Cratis/Arc/blob/main/Documentation/backend/csharp/introspection/index.md).
|
|
26
26
|
- Check ARC0019/0020/0021: conflicting declarations, Microsoft attributes without
|
|
27
27
|
the ASP.NET integration, and schemes on the standalone host. Microsoft
|
|
28
28
|
`[Authorize]` is enforced only by the ASP.NET host; policies/schemes fail closed
|
|
29
29
|
on supported hosts. A method declaration **replaces** the type declaration.
|
|
30
30
|
Guest access requires every policy in the declaration to opt in
|
|
31
|
-
(`evaluatesAnonymous`), without roles/schemes.
|
|
31
|
+
(`evaluatesAnonymous`), without roles/schemes.
|
|
32
|
+
Requires Arc 22.44.2 for guest endpoints to be
|
|
32
33
|
reachable through HTTP even with an authenticated fallback policy. Keep an
|
|
33
34
|
intentional `IFallbackAuthorizationEvaluator` baseline; it is separate from
|
|
34
35
|
ASP.NET's `FallbackPolicy`.
|
|
35
|
-
[Authorization descriptors](https://github.com/Cratis/Arc/blob/
|
|
36
|
-
[guest endpoint specs](https://github.com/Cratis/Arc/tree/
|
|
36
|
+
[Authorization descriptors](https://github.com/Cratis/Arc/blob/main/Source/DotNET/Arc.Core.CodeAnalysis/DiagnosticDescriptors.cs),
|
|
37
|
+
[guest endpoint specs](https://github.com/Cratis/Arc/tree/main/Source/DotNET).
|
|
37
38
|
- The embedded `/.cratis/event-model` viewer defaults to Debug **and** Development.
|
|
38
39
|
Explicit `Enabled=true` overrides that default: check that deployed hosts have
|
|
39
40
|
not enabled it, rather than claiming Production can never map it.
|
|
40
|
-
[Exposure implementation](https://github.com/Cratis/Arc/blob/
|
|
41
|
+
[Exposure implementation](https://github.com/Cratis/Arc/blob/main/Source/DotNET/Screenplay.Embedded/Hosting/EventModelViewerExposure.cs).
|
|
41
42
|
- Generated identifiers are not secrets, authorization proofs or idempotency
|
|
42
|
-
keys. [Generated values](https://github.com/Cratis/Arc/blob/
|
|
43
|
+
keys. [Generated values](https://github.com/Cratis/Arc/blob/main/Source/DotNET/Arc.Core/Commands/ModelBound/GeneratedValueAttribute.cs).
|
|
43
44
|
- Arc telemetry records type/name/outcome metadata and correlation/tenant ids,
|
|
44
45
|
not command/query/event payload values or validation/exception messages. Do not
|
|
45
46
|
widen it with sensitive payloads or mistake this for a promise of no ids.
|
|
46
|
-
[Telemetry names](https://github.com/Cratis/Arc/blob/
|
|
47
|
+
[Telemetry names](https://github.com/Cratis/Arc/blob/main/Source/DotNET/Arc.Core/WellKnownTelemetryNames.cs).
|
|
47
48
|
- Returned reactor commands marked `[ExecuteCommandsAsSystem]` use a narrow
|
|
48
|
-
disposed system scope.
|
|
49
|
+
disposed system scope.
|
|
50
|
+
Requires Arc 22.72.0 so the system scope never carries the caller principal (earlier versions leaked it);
|
|
49
51
|
manually executing commands still needs explicit actor ownership.
|
|
50
|
-
[Executor](https://github.com/Cratis/Arc/blob/
|
|
52
|
+
[Executor](https://github.com/Cratis/Arc/blob/main/Source/DotNET/Chronicle/Reactors/CommandSideEffectExecutor.cs).
|
|
51
53
|
- Revocable observable data needs `IGuardObservableQueryEmission`; it applies to
|
|
52
54
|
plain HTTP snapshots/waits/long polls too. Suppression withholds data; denial
|
|
53
55
|
terminates/returns unauthorized. Never read the producer's ambient principal.
|
|
54
|
-
[HTTP processing](https://github.com/Cratis/Arc/blob/
|
|
56
|
+
[HTTP processing](https://github.com/Cratis/Arc/blob/main/Source/DotNET/Arc.Core/Queries/ObservableQueryHttp.cs).
|
|
55
57
|
- Query health remains explicitly anonymous and returns connection health. Audit
|
|
56
58
|
exposure of connection user ids (tracked by Arc#2873), not just catalogs:
|
|
57
59
|
discovery restrictions are not blanket protection of `/.cratis/*`.
|
|
58
|
-
[QueryHealth](https://github.com/Cratis/Arc/blob/
|
|
59
|
-
[subscription client UserId](https://github.com/Cratis/Arc/blob/
|
|
60
|
+
[QueryHealth](https://github.com/Cratis/Arc/blob/main/Source/DotNET/Arc.Core/Queries/QueryHealth.cs),
|
|
61
|
+
[subscription client UserId](https://github.com/Cratis/Arc/blob/main/Source/DotNET/Arc.Core/Queries/QuerySubscriptionClientInfo.cs).
|
|
@@ -39,7 +39,7 @@ In a language without those analyzers the same rules hold; the reviewer enforces
|
|
|
39
39
|
them instead of the compiler. Reverify against the owning product repository
|
|
40
40
|
before claiming behavior for another version.
|
|
41
41
|
|
|
42
|
-
The `Cratis.Synopsis.Tool` dotnet tool (verified
|
|
42
|
+
The `Cratis.Synopsis.Tool` dotnet tool (verified) reads these
|
|
43
43
|
names statically, never running code, and writes one HTML or JSON behavior
|
|
44
44
|
document from C#, TypeScript, Gherkin and Screenplay specifications:
|
|
45
45
|
`dotnet tool install --global Cratis.Synopsis.Tool`, then `synopsis . --open`
|
|
@@ -20,29 +20,27 @@ MongoDB observations still need real infrastructure.
|
|
|
20
20
|
|
|
21
21
|
## Verified product sources
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
| Package |
|
|
26
|
-
| --- | --- |
|
|
27
|
-
| `Cratis.Specifications.XUnit` | `
|
|
28
|
-
| `Cratis.Specifications` | `
|
|
29
|
-
| `Cratis.Arc.Testing` | `
|
|
30
|
-
| `Cratis.Chronicle.Testing` | `
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
`EventContext.From` UTC default
|
|
34
|
-
and require **19.46.0+**; see the ReactorScenario section in
|
|
23
|
+
Sources:
|
|
24
|
+
|
|
25
|
+
| Package | Purpose |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| `Cratis.Specifications.XUnit` | `Specification` base, lifecycle discovery, `ShouldXxx` assertions, optional shared lifecycle |
|
|
28
|
+
| `Cratis.Specifications` | `Catch.Exception`, `SpecificationMethods` (dependency of the XUnit package) |
|
|
29
|
+
| `Cratis.Arc.Testing` | `CommandScenario<TCommand>` preserves explicit principal/override/policy services; see application-scenarios |
|
|
30
|
+
| `Cratis.Chronicle.Testing` | `EventScenario`, `ReadModelScenario<T>`, `ReactorScenario<T>` |
|
|
31
|
+
|
|
32
|
+
Requires Chronicle 19.46.0 for reactor read-model seeding/absence, synchronous handler exceptions and the
|
|
33
|
+
`EventContext.From` UTC default; see the ReactorScenario section in
|
|
35
34
|
[application-scenarios.md](references/application-scenarios.md).
|
|
36
35
|
|
|
37
|
-
Per-context in-process MongoDB host isolation is
|
|
38
|
-
`Cratis.Chronicle.XUnit.Integration`
|
|
36
|
+
Per-context in-process MongoDB host isolation is in
|
|
37
|
+
`Cratis.Chronicle.XUnit.Integration` (`ChronicleFixture.cs`,
|
|
39
38
|
`ChronicleClientFixture.cs`, `MongoDBContextStorage.cs`); it is opt-in and does
|
|
40
39
|
not isolate out-of-process/remote kernels. See [integration-specs.md](references/integration-specs.md).
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
`Cratis.Arc.Testing` **22.75.0** (introduced in **22.67.0**).
|
|
41
|
+
Requires `Cratis.Arc.Testing` 22.67.0 for generated-value scenario pinning.
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
Check the owning product repository before claiming support for
|
|
46
44
|
another version. Never translate an assertion or helper name from memory.
|
|
47
45
|
|
|
48
46
|
## Route near misses
|
|
@@ -89,18 +87,13 @@ one. Out-of-process integration specifications are an advanced case reserved for
|
|
|
89
87
|
boundaries the scenario helpers cannot reach — see
|
|
90
88
|
[integration-specs.md](references/integration-specs.md).
|
|
91
89
|
|
|
92
|
-
> **Historical validator-state order-sensitivity:** observed at 22.16-era Arc.
|
|
93
|
-
> Process-wide provider replacement was fixed in 22.23.2; later releases isolated
|
|
94
|
-
> scenario stores/services. Reproduce at 22.75.0 before applying the old
|
|
95
|
-
> direct-validator/small `[Collection]` workaround; it is not verified here.
|
|
96
|
-
|
|
97
90
|
⚠️ `EventScenario` wires a strategy that always answers `ConcurrencyScope.None`,
|
|
98
91
|
which the validator skips, so an append that lets the strategy choose the scope
|
|
99
92
|
never produces a concurrency violation. `ShouldHaveConcurrencyViolations()`
|
|
100
93
|
cannot pass for such an append and its negation passes vacuously — specify concurrency against the
|
|
101
94
|
real kernel with an out-of-process integration specification instead.
|
|
102
95
|
|
|
103
|
-
For a class-based `ReactorScenario<TReactor>` on
|
|
96
|
+
For a class-based `ReactorScenario<TReactor>` on a recent Chronicle (Requires Chronicle 19.46.0), seed each
|
|
104
97
|
handler read-model parameter with `Given.ForEventSourceId(id).ReadModel(instance)`
|
|
105
98
|
or declare intentional absence with `.NoReadModel<T>()`; `Given` events do not
|
|
106
99
|
build it, even if passive. Missing setup throws
|
|
@@ -109,16 +102,18 @@ resolved read-model key. See the ReactorScenario reference for diagnostics,
|
|
|
109
102
|
exception capture and UTC occurrence-time defaults.
|
|
110
103
|
|
|
111
104
|
Specification projects are named `<Source>.Specs`. Add a `PackageReference` to
|
|
112
|
-
`Cratis.Specifications.XUnit
|
|
105
|
+
`Cratis.Specifications.XUnit`, not just `Cratis.Specifications`; the C#
|
|
113
106
|
namespace stays `Cratis.Specifications`. The house runner is xUnit **2.x**
|
|
114
|
-
|
|
115
|
-
net48 was dropped
|
|
116
|
-
`Cratis.Specifications.NUnit`
|
|
107
|
+
not xUnit v3. Supported targets are net8.0/net9.0/net10.0;
|
|
108
|
+
net48 was dropped (retain 3.x for that target).
|
|
109
|
+
`Cratis.Specifications.NUnit` is an alternative with the same base pattern,
|
|
117
110
|
`[Test]` instead of `[Fact]`, and **public** test methods.
|
|
118
111
|
|
|
119
112
|
### Pin server-generated Handle values
|
|
120
113
|
|
|
121
|
-
|
|
114
|
+
Requires Arc 22.67.0 for generated-value pinning.
|
|
115
|
+
|
|
116
|
+
`CommandScenario<TCommand>` defaults to strict generation:
|
|
122
117
|
without a named pin or `AllowGeneration()`, `Execute` returns a command result
|
|
123
118
|
with `GeneratedValueNotPinned`, rather than throwing it. Import
|
|
124
119
|
`Cratis.Arc.Testing.Commands`; configure `PinGeneratedValue(name, concept)`
|
|
@@ -296,8 +291,10 @@ between collaborators. That is where defects hide.
|
|
|
296
291
|
|
|
297
292
|
## Verify
|
|
298
293
|
|
|
294
|
+
Requires `Cratis.Specifications` 4.0.0 for the analyzers.
|
|
295
|
+
|
|
299
296
|
CRSPEC0001–CRSPEC0007 ship as **warnings** in `Cratis.Specifications`, `.XUnit`,
|
|
300
|
-
and `.NUnit
|
|
297
|
+
and `.NUnit`. A warnings-as-errors build enforces them: `should_` names,
|
|
301
298
|
one specification per file (given contexts exempt), no facts on given contexts,
|
|
302
299
|
test attributes on `should_` methods, no explicit base lifecycle calls, public
|
|
303
300
|
specification classes, and no `Because` on given contexts. See
|
package/package/corpus/skills/cratis-specifications-csharp/references/application-scenarios.md
CHANGED
|
@@ -15,8 +15,6 @@ validation, constraints or projections matter; a pure decision (`Handle()`,
|
|
|
15
15
|
call. A library or framework repository reaches for a scenario only to test the
|
|
16
16
|
very engine it provides.
|
|
17
17
|
|
|
18
|
-
Arc scenarios verified at **v22.75.0** (Chronicle dependency 19.39.1).
|
|
19
|
-
Separate Chronicle-only scenario claims retain their version-qualified sources.
|
|
20
18
|
Read [query and decision scenarios](../../cratis-application-slice-specifications/references/query-and-decision-scenarios.md)
|
|
21
19
|
when using `QueryScenario<T>`, buffered emissions or `UseDecisionReads()`.
|
|
22
20
|
Guarded decisions need actual seeded events, not pinned models; their given
|
|
@@ -90,7 +88,7 @@ from `Cratis.Arc.Chronicle.Testing`.
|
|
|
90
88
|
pass against a read-model shape the projection never produces.
|
|
91
89
|
- **Validator and `Provide()` dependencies** are registered in
|
|
92
90
|
`_scenario.Services`; the concrete validator is discovered automatically.
|
|
93
|
-
- **Caller setup (Arc 22.75.1
|
|
91
|
+
- **Caller setup (Requires Arc 22.75.1):** register a substituted
|
|
94
92
|
`ICurrentPrincipalAccessor`, `ICurrentPrincipalOverride` or
|
|
95
93
|
`IAuthorizationPolicyRuntime` in `Services` before first execution. The scenario
|
|
96
94
|
preserves these registrations instead of replacing them with Arc defaults,
|
|
@@ -100,7 +98,7 @@ from `Cratis.Arc.Chronicle.Testing`.
|
|
|
100
98
|
|
|
101
99
|
### Pin generated values
|
|
102
100
|
|
|
103
|
-
|
|
101
|
+
Requires `Cratis.Arc.Testing` 22.67.0 or later.
|
|
104
102
|
For the `AllocateCartId` command from `cratis-arc-command`, whose
|
|
105
103
|
`Handle([GeneratedValue("cart")] CartId cartId)` returns that id, specify the
|
|
106
104
|
pipeline with a known concept pin. Import `Cratis.Arc.Commands` and
|
|
@@ -165,7 +163,7 @@ public class and_value_is_pinned : Specification
|
|
|
165
163
|
A direct-call decision spec supplies the known argument to `Handle()` itself.
|
|
166
164
|
|
|
167
165
|
Guide: [Pin generated values in command specs](/arc/backend/csharp/testing/generated-values/).
|
|
168
|
-
Source:
|
|
166
|
+
Source: `Source/DotNET/Testing/Commands/CommandScenarioGeneratedValueExtensions.cs`,
|
|
169
167
|
`ScenarioGeneratedValueFixture.cs`, `ScenarioGeneratedValues.cs` and
|
|
170
168
|
`GeneratedValuesCommandScenarioExtender.cs`;
|
|
171
169
|
`Source/DotNET/Testing.Specs/Commands/for_CommandScenario/generated_values/when_pinning_a_value.cs`.
|
|
@@ -274,7 +272,9 @@ async Task Because() =>
|
|
|
274
272
|
Construct with an `IServiceProvider` of substituted collaborators and assert on
|
|
275
273
|
those substitutes after `Given` fires the events.
|
|
276
274
|
|
|
277
|
-
### Read-model parameters
|
|
275
|
+
### Read-model parameters
|
|
276
|
+
|
|
277
|
+
Requires Chronicle 19.46.0 or later.
|
|
278
278
|
|
|
279
279
|
`Given` events invoke the reactor; they **do not build read models**, including
|
|
280
280
|
passive ones. In the present-state specification, seed a pre-built instance:
|
|
@@ -300,7 +300,7 @@ for that type when any exist. Fix the fixture/key rather than hiding missing
|
|
|
300
300
|
setup with `NoReadModel<T>()`. This guard applies to `EventStoreForTesting`, not
|
|
301
301
|
production resolution or an explicitly supplied store of another type.
|
|
302
302
|
|
|
303
|
-
|
|
303
|
+
A synchronous handler throw surfaces its own
|
|
304
304
|
exception, not reflection's `TargetInvocationException`, preserving the handler
|
|
305
305
|
stack. Capture with `await Catch.Exception(() => _scenario.Given.ForEventSource(_id).Events(...))`
|
|
306
306
|
and assert the handler's exception type.
|
|
@@ -310,7 +310,7 @@ previously local `Now`. Scenario contexts, `EventContext.Empty` and
|
|
|
310
310
|
`EmptyWithEventSourceId(...)` use this helper; explicit times retain their offset,
|
|
311
311
|
and the positional constructor has no such default.
|
|
312
312
|
|
|
313
|
-
Sources
|
|
313
|
+
Sources:
|
|
314
314
|
`Source/Clients/Testing/Reactors/{ReactorScenario,ReactorSourceGivenBuilder,ScenarioReactorMethodArgumentsResolver,ReadModelNotSeededForReactorScenario}.cs`
|
|
315
315
|
and `Source/Clients/DotNET/Events/EventContext.cs`. For exact signatures and
|
|
316
316
|
source-backed examples, read `cratis-chronicle-reactor/references/specifications.md`.
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
- One outcome per file
|
|
12
12
|
|
|
13
13
|
Detail for the plain `Cratis.Specifications` surface: phases, substitution,
|
|
14
|
-
assertions, and exception capture.
|
|
15
|
-
|
|
14
|
+
assertions, and exception capture. Sources: `Cratis.Specifications.XUnit`
|
|
15
|
+
(base and assertions) and its `Cratis.Specifications` dependency (`Catch`).
|
|
16
16
|
NSubstitute is a separate collaborator-substitution dependency.
|
|
17
17
|
|
|
18
18
|
## Phases
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
- Command execution overloads
|
|
8
8
|
- Assertion helpers
|
|
9
9
|
- Asynchronous follow-ups
|
|
10
|
-
- In-process MongoDB context isolation
|
|
10
|
+
- In-process MongoDB context isolation
|
|
11
11
|
- Rules
|
|
12
12
|
|
|
13
13
|
Reserve these for the host, transport, serialization, or real-infrastructure
|
|
@@ -19,7 +19,7 @@ They live under `when_<behavior>/` **inside the behavior's own folder**, not in
|
|
|
19
19
|
`for_<Type>/` unit folder: there is no isolated unit, the whole slice is under
|
|
20
20
|
test. Never mix unit and integration specifications in one folder.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
Source: `Cratis.Chronicle.Testing` (`Cratis.Chronicle.XUnit.Integration` at the same tag).
|
|
23
23
|
|
|
24
24
|
## Structure
|
|
25
25
|
|
|
@@ -126,7 +126,9 @@ void Destroy() => _collector.Dispose();
|
|
|
126
126
|
`IEventAppendCollection` is part of the Chronicle testing API. The timeout is a
|
|
127
127
|
deadline, not a sleep — it turns a hang into a named failure.
|
|
128
128
|
|
|
129
|
-
## In-process MongoDB context isolation
|
|
129
|
+
## In-process MongoDB context isolation
|
|
130
|
+
|
|
131
|
+
Requires Chronicle 19.51.0 or later.
|
|
130
132
|
|
|
131
133
|
For an **in-process MongoDB** suite using `Cratis.Chronicle.XUnit.Integration`,
|
|
132
134
|
override `ChronicleFixture.UsesPerContextMongoDBHost` to return `true`. It defaults
|
|
@@ -141,7 +143,7 @@ databases in place; collection teardown drops only prefixes it issued. Starting
|
|
|
141
143
|
one host per context costs time. This does not isolate out-of-process or remote
|
|
142
144
|
kernels, which retain kernel reset.
|
|
143
145
|
|
|
144
|
-
Source
|
|
146
|
+
Source: Chronicle `Source/Clients/XUnit.Integration/ChronicleFixture.cs`,
|
|
145
147
|
`ChronicleClientFixture.cs`, `MongoDBContextStorage.cs`,
|
|
146
148
|
`ChronicleOrleansInProcessWebApplicationFactory.cs`, and
|
|
147
149
|
`Documentation/contributing/integration-tests.md` (per-context storage isolation).
|
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
# Optional shared xUnit lifecycle
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Source: `Cratis.Specifications.XUnit`,
|
|
7
7
|
`SpecificationTestFramework.cs`, `SpecificationTestClassRunner.cs`, and
|
|
8
|
-
`Specification.cs`.
|
|
8
|
+
`Specification.cs`.
|
|
9
|
+
|
|
10
|
+
Requires `Cratis.Specifications.XUnit` 4.1.0.
|
|
11
|
+
|
|
12
|
+
The house default remains stock xUnit
|
|
9
13
|
per-fact execution.
|
|
10
14
|
|
|
11
15
|
## Opt in
|
|
@@ -14,8 +14,8 @@ base: setup is separated from the action, and each `it()` verifies one outcome.
|
|
|
14
14
|
|
|
15
15
|
## Verified product sources
|
|
16
16
|
|
|
17
|
-
Helper and setup patterns
|
|
18
|
-
(`for_JsonSerializer/given/given.ts`, `vitest.setup.ts`) and Arc
|
|
17
|
+
Helper and setup patterns come from Fundamentals
|
|
18
|
+
(`for_JsonSerializer/given/given.ts`, `vitest.setup.ts`) and Arc
|
|
19
19
|
(`Source/JavaScript/Arc/given.ts`). The execution stack is:
|
|
20
20
|
|
|
21
21
|
| Framework | Role |
|
|
@@ -12,10 +12,10 @@ an MCP server.
|
|
|
12
12
|
|
|
13
13
|
## Verified product sources
|
|
14
14
|
|
|
15
|
-
| Source |
|
|
16
|
-
| --- | --- |
|
|
17
|
-
| Studio public product announcement |
|
|
18
|
-
| `Cratis/Studio` |
|
|
15
|
+
| Source | Purpose |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| Studio public product announcement | Organization-scoped, credential-gated MCP availability, not tool-effect admission |
|
|
18
|
+
| `Cratis/Studio` | Private repository; implementation evidence is **not admitted** |
|
|
19
19
|
|
|
20
20
|
Studio has an organization-scoped, credential-gated MCP endpoint. Availability
|
|
21
21
|
and credentials do not establish that an operation is observational. The private
|
|
@@ -169,7 +169,7 @@ this piece different from the last one:
|
|
|
169
169
|
- a reason the author owns, in words they would say out loud, supplied by them;
|
|
170
170
|
- the limit, placed in the sentence it limits: "On macOS and Linux, the installer…".
|
|
171
171
|
|
|
172
|
-
Where a sentence has nothing to add, cut it. Concreteness has a ceiling too. In
|
|
172
|
+
Where a sentence has nothing to add, cut it. Concreteness has a ceiling too. In past
|
|
173
173
|
headline experiments, extra concreteness helped headlines that were too vague and hurt ones
|
|
174
174
|
that were already very concrete (HC-03). Packing identifiers into an opening won't rescue it.
|
|
175
175
|
|
|
@@ -4,7 +4,7 @@ description: Use when refactoring unhealthy code and needing Code Health finding
|
|
|
4
4
|
license: Apache-2.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
<!-- Modified by Cratis from CodeScene AB's original (Apache-2.0): added profile guard, policy note, license field and this notice. Upstream: https://github.com/codescene-oss/codescene-mcp-server
|
|
7
|
+
<!-- Modified by Cratis from CodeScene AB's original (Apache-2.0): added profile guard, policy note, license field and this notice. Upstream: https://github.com/codescene-oss/codescene-mcp-server (skills/guiding-refactoring-with-code-health/SKILL.md; see NOTICE) -->
|
|
8
8
|
|
|
9
9
|
# Guiding Refactoring With Code Health
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ description: Use when users with a CodeScene instance ask what to improve first
|
|
|
4
4
|
license: Apache-2.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
<!-- Modified by Cratis from CodeScene AB's original (Apache-2.0): added profile guard, policy note, license field and this notice. Upstream: https://github.com/codescene-oss/codescene-mcp-server
|
|
7
|
+
<!-- Modified by Cratis from CodeScene AB's original (Apache-2.0): added profile guard, policy note, license field and this notice. Upstream: https://github.com/codescene-oss/codescene-mcp-server (skills/prioritizing-technical-debt/SKILL.md; see NOTICE) -->
|
|
8
8
|
|
|
9
9
|
# Prioritizing Technical Debt
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ description: Use when a user asks what to test first based on CodeScene findings
|
|
|
4
4
|
license: Apache-2.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
<!-- Modified by Cratis from CodeScene AB's original (Apache-2.0): added profile guard, policy note, license field and this notice. Upstream: https://github.com/codescene-oss/codescene-mcp-server
|
|
7
|
+
<!-- Modified by Cratis from CodeScene AB's original (Apache-2.0): added profile guard, policy note, license field and this notice. Upstream: https://github.com/codescene-oss/codescene-mcp-server (skills/risk-based-testing-with-code-health/SKILL.md; see NOTICE) -->
|
|
8
8
|
|
|
9
9
|
# Risk-Based Testing With Code Health
|
|
10
10
|
|
|
@@ -14,7 +14,7 @@ Use only in repositories that opted into `cratis/codescene` and have CodeScene M
|
|
|
14
14
|
Use this skill when the goal is to turn CodeScene risk signals into practical testing priorities.
|
|
15
15
|
The output should help testers and developers focus limited test time on the code most likely to produce defects.
|
|
16
16
|
|
|
17
|
-
The primary signal is always the **current branch's change set** — what has actually changed is more immediately actionable than
|
|
17
|
+
The primary signal is always the **current branch's change set** — what has actually changed is more immediately actionable than long-standing hotspots. Hotspots provide background context and catch systemic risk, but they should not displace focus from files the branch has already touched.
|
|
18
18
|
|
|
19
19
|
## When to Use
|
|
20
20
|
- A user asks where testing should focus based on CodeScene hotspots.
|
|
@@ -35,7 +35,7 @@ Use `making-the-business-case-for-code-health` for ROI framing.
|
|
|
35
35
|
- Optional: business criticality hints from the user (for example: release-blocking areas, customer-facing commands)
|
|
36
36
|
|
|
37
37
|
## Quick Reference
|
|
38
|
-
- `list_technical_debt_hotspots_for_project`: Identify high-risk files using low Code Health and high
|
|
38
|
+
- `list_technical_debt_hotspots_for_project`: Identify high-risk files using low Code Health and high past churn.
|
|
39
39
|
- `analyze_change_set`: Evaluate immediate risk in the current branch vs target base.
|
|
40
40
|
- `code_health_score`: Inspect specific files in detail.
|
|
41
41
|
- `code_ownership_for_path`: Route high-risk areas to likely reviewers/domain experts.
|
|
@@ -4,7 +4,7 @@ description: Use when AI-generated or AI-modified changes need a Code Health gat
|
|
|
4
4
|
license: Apache-2.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
<!-- Modified by Cratis from CodeScene AB's original (Apache-2.0): added profile guard, policy note, license field and this notice. Upstream: https://github.com/codescene-oss/codescene-mcp-server
|
|
7
|
+
<!-- Modified by Cratis from CodeScene AB's original (Apache-2.0): added profile guard, policy note, license field and this notice. Upstream: https://github.com/codescene-oss/codescene-mcp-server (skills/safeguarding-ai-generated-code/SKILL.md; see NOTICE) -->
|
|
8
8
|
|
|
9
9
|
# Safeguarding AI-Generated Code
|
|
10
10
|
|