@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
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
<!-- Copyright (c) Cratis. All rights reserved. -->
|
|
2
2
|
<!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
|
|
3
3
|
|
|
4
|
-
# Upgrading
|
|
4
|
+
# Upgrading from older clients
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Source: `Cratis/Chronicle.Elixir` (`Source/chronicle/mix.exs`, `mix.lock`, `lib/chronicle/wire_result.ex`, `jobs.ex`, `event_sequences/event_log.ex`, `read_models.ex`, `seeding.ex`).
|
|
7
7
|
|
|
8
8
|
## Dependencies and wire compatibility
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
The wire contracts target the current Chronicle kernel generations, with renamed RPCs and unwrapped response envelopes. No public Elixir API was removed, but unauthorized or excepted command responses return `{:error, reason}` rather than looking successful. `Jobs.get/2` lists jobs then finds the id client-side; `append_many_for_event_sources/2` uses its dedicated RPC rather than the single-source path.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
- grpc **1.x** and Mint **1.11+** are direct dependencies; do not carry a mandatory `GRPC.Client.Supervisor` child forward from an older grpc setup.
|
|
16
|
-
- Contracts resolve to **19.30.0** in this tag's lockfile. Pair the kernel with the installed contracts descriptor; named event source definitions require **Chronicle 19.30.0+**.
|
|
12
|
+
- Use the `~>` requirement for the published release you intend (`{:cratis_chronicle, "~> 3.10"}` style) and the Elixir version `mix.exs` declares.
|
|
13
|
+
- grpc 1.x and Mint are direct dependencies; do not carry a mandatory `GRPC.Client.Supervisor` child forward from an older grpc setup.
|
|
14
|
+
- Contracts resolve from the lockfile. Pair the kernel with the installed contracts descriptor; named event source definitions need a kernel that supports them (see below).
|
|
17
15
|
- The first append on each channel runs a compatibility check, shared until reconnect. `{:error, {:incompatible_server, response}}` is a version/descriptor problem, not a transient append rejection. Update kernel and contracts as a compatible pair; do not bypass the preflight. Failed transport calls return `{:error, %GRPC.RPCError{}}`.
|
|
18
16
|
|
|
19
|
-
##
|
|
17
|
+
## Behavior to review in an older application
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
An application written against an older client may have relied on behavior that is now corrected:
|
|
22
20
|
|
|
23
|
-
|
|
|
21
|
+
| Behavior | Review |
|
|
24
22
|
| --- | --- |
|
|
25
|
-
| Reducers register successfully and process from the log start | Old events
|
|
26
|
-
| Multi-word projection fields and AutoMap
|
|
27
|
-
| `unique(:owner_email)` and `remove_constraint` registration work | Uniqueness is
|
|
28
|
-
| `ReadModels.query/2` is zero-based, default page 0 | Change first-page callers to `page: 0`; `page: 1` is
|
|
29
|
-
| Seeding skips an event source with existing events |
|
|
30
|
-
| Tail/next sequence lookups
|
|
23
|
+
| Reducers register successfully and process from the log start | Old events reach reducers that previously failed registration |
|
|
24
|
+
| Multi-word projection fields and AutoMap populate | Remove camelCase-string workarounds; inspect fields that were formerly empty |
|
|
25
|
+
| `unique(:owner_email)` and `remove_constraint` registration work | Uniqueness is enforced and release events can remove constraints |
|
|
26
|
+
| `ReadModels.query/2` is zero-based, default page 0 | Change first-page callers to `page: 0`; `page: 1` is the second page |
|
|
27
|
+
| Seeding skips an event source with existing events | Already-stored duplicates are not removed |
|
|
28
|
+
| Tail/next sequence lookups do not narrow implicitly to `"Default"` | Audit callers that depended on implicit routing narrowing |
|
|
29
|
+
|
|
30
|
+
Rejected appends (including concurrency/constraint failures) return `{:error, reason}`, never `:ok`; batch append metadata survives the rich append RPC. Handle errors on single, batch and transactional paths.
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Declared `unique(..., message: ...)` violation messages are preserved on single, batch and transactional appends. Retain the constraint name and diagnostics when handling violations rather than assuming every message came from the kernel.
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
Requires `cratis_chronicle` 3.10.0 and Chronicle kernel 19.30.0 for named event source definitions.
|
|
@@ -5,14 +5,9 @@
|
|
|
5
5
|
|
|
6
6
|
## Variants — mutually exclusive read models for one entity's lifecycle
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
>
|
|
12
|
-
> The 3.4.0 release reported a kernel `$eventSourceId` property-mapping limitation
|
|
13
|
-
> (Cratis/Chronicle#3924). This client-source verification does not establish
|
|
14
|
-
> whether kernel 19.x fixed it; verify the full variant transition against your
|
|
15
|
-
> kernel before claiming end-to-end support.
|
|
8
|
+
Requires `cratis_chronicle` 3.4.0 or later.
|
|
9
|
+
|
|
10
|
+
The client source does not establish whether the kernel maps `$eventSourceId` properties for variants; verify the full variant transition against your kernel before claiming end-to-end support.
|
|
16
11
|
|
|
17
12
|
Some entities do not have one shape for their whole lifetime — a work item is a
|
|
18
13
|
backlog entry until a pull request exists for it, then it is a pull request
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
"input": "Connect an Elixir application, append through a registered event source, and query the first page of its read model.",
|
|
4
4
|
"fixtures": [],
|
|
5
5
|
"assertions": [
|
|
6
|
-
{ "kind": "skill-contains", "value": "
|
|
6
|
+
{ "kind": "skill-contains", "value": "`Cratis/Chronicle.Elixir`" },
|
|
7
7
|
{ "kind": "skill-contains", "value": "{:cratis_chronicle, \"~> 3.10\"}" },
|
|
8
8
|
{ "kind": "skill-contains", "value": "ConnectionString.development()" },
|
|
9
9
|
{ "kind": "skill-contains", "value": "`~> 1.18`" },
|
|
10
10
|
{ "kind": "skill-contains", "value": "`nil` registers as string" },
|
|
11
11
|
{ "kind": "skill-contains", "value": "**The reactor context has six keys**" },
|
|
12
12
|
{ "kind": "skill-contains", "value": "`sequence_number`, `occurred`, `event_source`, `observation_state`" },
|
|
13
|
-
{ "kind": "skill-contains", "value": "**
|
|
13
|
+
{ "kind": "skill-contains", "value": "**Page 1 is the second page**" },
|
|
14
14
|
{ "kind": "skill-contains", "value": "`:retry_attempts` is accepted but ignored", "file": "references/connections.md" },
|
|
15
15
|
{ "kind": "skill-contains", "value": "Client certificates cannot be combined with `disableTls=true`", "file": "references/connections.md" },
|
|
16
16
|
{ "kind": "skill-contains", "value": "registered-source metadata", "file": "references/event-sources.md" },
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: cratis-chronicle-client-go
|
|
3
3
|
description: Connect a standalone Go application to Chronicle, register events and observers, append with explicit outcomes, and materialize read models. Use for Chronicle.Go client setup, projections, reactors, gRPC ownership and safe retry decisions. Do not use for Arc HTTP commands or Chronicle kernel implementation.
|
|
4
4
|
license: MIT
|
|
5
|
-
compatibility: Go 1.26 or later; Chronicle
|
|
5
|
+
compatibility: Go 1.26 or later; a Chronicle kernel profile the client supports.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
<!-- Copyright (c) Cratis. All rights reserved. -->
|
|
@@ -10,9 +10,8 @@ compatibility: Go 1.26 or later; Chronicle.Go v0.9.1 with the Chronicle 19.32.3
|
|
|
10
10
|
|
|
11
11
|
# Chronicle from Go
|
|
12
12
|
|
|
13
|
-
> **Experimental v0:**
|
|
14
|
-
>
|
|
15
|
-
> Fundamentals.Go **v0.3.2**. Minor releases may break APIs.
|
|
13
|
+
> **Experimental v0:** minor releases may break APIs; pin the module version you test against.
|
|
14
|
+
> Companion guidance: Arc.Go and Fundamentals.Go.
|
|
16
15
|
|
|
17
16
|
This is a standalone event-store client, not an Arc HTTP framework. Use explicit
|
|
18
17
|
registration rather than C# attributes or assembly discovery. Events are immutable
|
|
@@ -21,19 +20,19 @@ not an event payload property.
|
|
|
21
20
|
|
|
22
21
|
## Verified product sources
|
|
23
22
|
|
|
24
|
-
| Product |
|
|
25
|
-
| --- | --- |
|
|
26
|
-
| Chronicle.Go (`github.com/cratis/chronicle.go`) | `
|
|
23
|
+
| Product | Source checked |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| Chronicle.Go (`github.com/cratis/chronicle.go`) | `client.go`, `options.go`, `options_transport.go`, `registry.go`, `registry_projections.go`, `registry_readmodels.go`, `registry_reactors.go`, `eventsequences/sequence.go`, `internal/decision/decision.go`, `captures/service.go`, `captures/redaction.go`, `examples/getting-started/main.go`, `examples/projections/main.go` |
|
|
27
26
|
|
|
28
|
-
[Source
|
|
29
|
-
and its [parity
|
|
30
|
-
qualify supported behavior.
|
|
27
|
+
[Source](https://github.com/Cratis/Chronicle.Go)
|
|
28
|
+
and its [parity document](https://github.com/Cratis/Chronicle.Go/blob/main/Documentation/parity.md)
|
|
29
|
+
qualify supported behavior. A README that says observers,
|
|
31
30
|
projections and automatic lifecycle recovery are absent is stale; those surfaces
|
|
32
31
|
exist, but that does **not** mean whole-product parity.
|
|
33
32
|
|
|
34
33
|
## Register and append
|
|
35
34
|
|
|
36
|
-
Install `github.com/cratis/chronicle.go
|
|
35
|
+
Install `github.com/cratis/chronicle.go` at your chosen release in a consumer module. This complete
|
|
37
36
|
package appends one event using **local development** defaults:
|
|
38
37
|
|
|
39
38
|
```go
|
|
@@ -88,7 +87,7 @@ concurrency/idempotency semantics before retrying, never a generic write retry.
|
|
|
88
87
|
Use stable persisted event IDs and explicit `json` names for cross-language data.
|
|
89
88
|
|
|
90
89
|
For a runnable program and its observable append position, use the tagged
|
|
91
|
-
[getting-started example](https://github.com/Cratis/Chronicle.Go/blob/
|
|
90
|
+
[getting-started example](https://github.com/Cratis/Chronicle.Go/blob/main/examples/getting-started/main.go).
|
|
92
91
|
This compileable package does not itself start a kernel or prove a successful append.
|
|
93
92
|
|
|
94
93
|
## Connection and gRPC ownership
|
|
@@ -132,15 +131,15 @@ recreating effect dispatch; use projections for materialization, reactors for ef
|
|
|
132
131
|
`reactors.OnceOnly` excludes replay; it does **not** deduplicate failed-partition
|
|
133
132
|
recovery. Effects may repeat after errors, cleanup failures or reconnect. Keep them
|
|
134
133
|
idempotent. The kernel owns recovery/quarantine and progress; do not invent resume
|
|
135
|
-
positions or acknowledge before successful processing and cleanup. Read the
|
|
136
|
-
[reactor guide](https://github.com/Cratis/Chronicle.Go/blob/
|
|
134
|
+
positions or acknowledge before successful processing and cleanup. Read the
|
|
135
|
+
[reactor guide](https://github.com/Cratis/Chronicle.Go/blob/main/Documentation/reactors.md)
|
|
137
136
|
for exact effect, replay and registration-readiness limits.
|
|
138
137
|
|
|
139
138
|
## Unsupported does not mean success
|
|
140
139
|
|
|
141
|
-
|
|
140
|
+
Requires Chronicle kernel 19.32.3 for decision guards, with compatibility preflight;
|
|
142
141
|
unsupported kernels return `ErrUnsupported`. Protected operations have their own
|
|
143
|
-
|
|
142
|
+
kernel capability gates; the client supports qualified protected revisions and
|
|
144
143
|
classified read-model replay routes, not every protected watch/profile.
|
|
145
144
|
Do not use the deprecated `readmodels.DecisionProtectedModel` or
|
|
146
145
|
`DecisionProtectionMetadata` compatibility hooks for new work.
|
|
@@ -158,5 +157,4 @@ pretend a rejected configuration was applied.
|
|
|
158
157
|
profiles; pure decisions can use standard `testing` directly.
|
|
159
158
|
- Exercise registration, cancellation, reconnect, borrowed connections and joined
|
|
160
159
|
cleanup against the pinned kernel before claiming runtime parity.
|
|
161
|
-
-
|
|
162
|
-
v0.3.2 pin is not a required dependency upgrade.
|
|
160
|
+
- Check the module's `go.mod` for the Fundamentals.Go it requires; the separate concepts skill is not a required dependency upgrade.
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
# Model-bound Go projections
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Source: Chronicle.Go `registry_readmodels.go`,
|
|
7
7
|
`registry_projections.go`, `projections/declaration.go` and the
|
|
8
|
-
[
|
|
8
|
+
[projection example](https://github.com/Cratis/Chronicle.Go/blob/main/examples/projections/main.go).
|
|
9
9
|
This complete package declares a projection; it does not connect or append:
|
|
10
10
|
|
|
11
11
|
```go
|
|
@@ -13,48 +13,46 @@ you construct a client, ask it for an event store, and append or observe.
|
|
|
13
13
|
|
|
14
14
|
## Verified product sources
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
signatures. Historical line citations below are locators, not current line numbers.
|
|
16
|
+
Source: `Cratis/Chronicle.Kotlin`, by source symbols and signatures.
|
|
18
17
|
|
|
19
|
-
| Artifact |
|
|
20
|
-
| --- | --- |
|
|
21
|
-
| `io.cratis:chronicle` | `
|
|
22
|
-
| `io.cratis:chronicle-spring-boot-starter` | `
|
|
23
|
-
| `io.cratis:chronicle-testing` | `
|
|
24
|
-
| `io.cratis:chronicle-contracts` | `
|
|
18
|
+
| Artifact | Source |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| `io.cratis:chronicle` | `Chronicle.Kotlin` |
|
|
21
|
+
| `io.cratis:chronicle-spring-boot-starter` | `Integrations/SpringBoot` |
|
|
22
|
+
| `io.cratis:chronicle-testing` | `Testing` |
|
|
23
|
+
| `io.cratis:chronicle-contracts` | `Source/build.gradle.kts` (`chronicleContractsVersion`) |
|
|
25
24
|
|
|
26
25
|
All three artifacts are published to Maven Central under `io.cratis` (their
|
|
27
26
|
`build.gradle.kts` publishing blocks). The JVM toolchain is **17**.
|
|
28
27
|
|
|
29
|
-
> **Do not copy a version number out of the repository's README or docs.**
|
|
30
|
-
> `v6.13.0` the README and getting-started documentation still say `6.5.0`.
|
|
28
|
+
> **Do not copy a version number out of the repository's README or docs.**
|
|
31
29
|
> The version comes from a Gradle property injected at release time —
|
|
32
30
|
> `Source/build.gradle.kts` reads
|
|
33
31
|
> `providers.gradleProperty("version")` and defaults to `0.0.0-SNAPSHOT` — so
|
|
34
32
|
> the checked-in source never carries the real number. Take it from Maven
|
|
35
33
|
> Central.
|
|
36
34
|
|
|
37
|
-
> **The client and the kernel version independently.**
|
|
38
|
-
> kernel `19.30.0` or later. Historically, client `6.5.0` was verified on kernel
|
|
39
|
-
> `19.6.1`, while `19.4.8` rejects it. `CompatibilityPreflight` checks contracts
|
|
35
|
+
> **The client and the kernel version independently.** `CompatibilityPreflight` checks contracts
|
|
40
36
|
> at connect and throws `ChronicleServerIncompatible`; do not infer a supported
|
|
41
37
|
> pair just because both products are "latest".
|
|
42
38
|
|
|
39
|
+
Requires Chronicle kernel 19.30.0 for event source definitions and streams.
|
|
40
|
+
|
|
43
41
|
## Common pitfalls
|
|
44
42
|
|
|
45
43
|
| Pitfall | Why it bites |
|
|
46
44
|
| --- | --- |
|
|
47
|
-
| Naming a reactor method after the event | The name is ignored; **the first parameter's type** is the subscription (`EventHandlerMethod.kt
|
|
48
|
-
| Two `@EventType` classes sharing a simple name | The id defaults to the simple name, so they collide on the wire (`EventTypesService.kt
|
|
49
|
-
| Shipping the default connection string to production | `skipTlsValidation` defaults to **true**; certificate validation is off (`ChronicleConnectionString.kt
|
|
50
|
-
| Copying a version from the README or docs |
|
|
45
|
+
| Naming a reactor method after the event | The name is ignored; **the first parameter's type** is the subscription (`EventHandlerMethod.kt`) |
|
|
46
|
+
| Two `@EventType` classes sharing a simple name | The id defaults to the simple name, so they collide on the wire (`EventTypesService.kt`) |
|
|
47
|
+
| Shipping the default connection string to production | `skipTlsValidation` defaults to **true**; certificate validation is off (`ChronicleConnectionString.kt`) |
|
|
48
|
+
| Copying a version from the README or docs | It can lag the release; take the version from Maven Central |
|
|
51
49
|
| Supplying `apiKey` in the connection string | Client construction rejects it with `IllegalArgumentException`; use `user:password@` |
|
|
52
|
-
| Expecting `getEventStore` to suspend | It does not — the client already connected in its constructor (`ChronicleClient.kt
|
|
50
|
+
| Expecting `getEventStore` to suspend | It does not — the client already connected in its constructor (`ChronicleClient.kt`) |
|
|
53
51
|
| Expecting `awaitRegistration()` to prove all artifacts registered | The initial gate completes in `finally` even after failure; connection rejection still throws `ChronicleConnectionFailed` |
|
|
54
52
|
| Treating automatic and explicit registration alike | The automatic pass logs failures; explicit `registerAll()` throws `ArtifactRegistrationFailed` for failed observers, and rejected event-type registration throws `ChronicleCommandRejected` |
|
|
55
53
|
| Expecting read model reactors to be discovered | `IReadModelReactor` is absent from the scan and from `IEventStore`; construct `ReadModelReactors(...)` yourself |
|
|
56
|
-
| Leaving the default classpath scan on in a large app | Use `withArtifactsFrom(...)` or `artifact-packages` to narrow it (`ChronicleOptions.kt
|
|
57
|
-
| Expecting WebFlux support from the starter | The web auto-configuration is `SERVLET`-only (`ChronicleWebAutoConfiguration.kt
|
|
54
|
+
| Leaving the default classpath scan on in a large app | Use `withArtifactsFrom(...)` or `artifact-packages` to narrow it (`ChronicleOptions.kt`) |
|
|
55
|
+
| Expecting WebFlux support from the starter | The web auto-configuration is `SERVLET`-only (`ChronicleWebAutoConfiguration.kt`) |
|
|
58
56
|
| Exiting `main` after an append | Reactors and reducers stop with the process; the stream is live |
|
|
59
57
|
| Passing a `KProperty1` as `@VariantOf`'s `key` | The annotation form always takes a plain string; only the declarative `variantOf(...)` builder accepts a property reference |
|
|
60
58
|
| A `@GlobalFor` mapping targeting a property one variant lacks | `GlobalHandlerPropertyNotOnVariant` at registration, not a silently skipped mapping |
|
|
@@ -106,7 +104,7 @@ registration, artifact activation, sink type or OpenTelemetry options.
|
|
|
106
104
|
|
|
107
105
|
### The connection string
|
|
108
106
|
|
|
109
|
-
`ChronicleConnectionString.kt` documents the grammar
|
|
107
|
+
`ChronicleConnectionString.kt` documents the grammar:
|
|
110
108
|
|
|
111
109
|
```
|
|
112
110
|
chronicle://<host>[:<port>][,<host>[:<port>]...][?<options>]
|
|
@@ -114,15 +112,14 @@ chronicle://<username>:<password>@<host>[:<port>][,...][?<options>]
|
|
|
114
112
|
chronicle+srv://<host>[:<port>][?<options>]
|
|
115
113
|
```
|
|
116
114
|
|
|
117
|
-
Default port is `35000
|
|
115
|
+
Default port is `35000`. Recognized query keys, lowercased at parse time
|
|
118
116
|
(`ChronicleConnectionString` parser): `disabletls`, `skiptlsvalidation`,
|
|
119
117
|
`loadbalancer`, `srvnameserver`. `apiKey` is parsed but rejected at client
|
|
120
118
|
creation with `IllegalArgumentException`: the kernel has no API-key authentication.
|
|
121
119
|
Use `user:password@`. Omitting credentials selects `chronicle-dev-client` /
|
|
122
|
-
`chronicle-dev-secret`; these are development credentials, not a production setup. `ChronicleConnectionString.parse(String)` is on the companion
|
|
123
|
-
(`:63`), and `ChronicleConnectionString.DEVELOPMENT` (`:51`) points at
|
|
120
|
+
`chronicle-dev-secret`; these are development credentials, not a production setup. `ChronicleConnectionString.parse(String)` is on the companion, and `ChronicleConnectionString.DEVELOPMENT` points at
|
|
124
121
|
`localhost:35000` with the `chronicle-dev-client` / `chronicle-dev-secret`
|
|
125
|
-
credentials
|
|
122
|
+
credentials.
|
|
126
123
|
|
|
127
124
|
> **TLS is on, certificate validation is off by default** (`disableTls = false`,
|
|
128
125
|
> `skipTlsValidation = true`), for a self-signed development kernel.
|
|
@@ -147,7 +144,7 @@ data class <EventName>(
|
|
|
147
144
|
)
|
|
148
145
|
```
|
|
149
146
|
|
|
150
|
-
`io.cratis.chronicle.events.EventType` — `events/EventType.kt
|
|
147
|
+
`io.cratis.chronicle.events.EventType` — `events/EventType.kt`:
|
|
151
148
|
|
|
152
149
|
```kotlin
|
|
153
150
|
annotation class EventType(
|
|
@@ -158,7 +155,7 @@ annotation class EventType(
|
|
|
158
155
|
```
|
|
159
156
|
|
|
160
157
|
**The id defaults to the class's *simple* name, not its fully qualified name** —
|
|
161
|
-
`events/EventTypesService.kt
|
|
158
|
+
`events/EventTypesService.kt` resolves `ann.id.ifEmpty { cls.simpleName!! }`.
|
|
162
159
|
Two event classes with the same simple name in different packages therefore
|
|
163
160
|
collide on the wire. Give one an explicit `id`.
|
|
164
161
|
|
|
@@ -176,9 +173,9 @@ not right-to-erasure: use `@Pii` for personal data. A value cannot combine
|
|
|
176
173
|
`@Pii` and `@Encrypted`, and neither is supported on an `EventSourceId` concept.
|
|
177
174
|
|
|
178
175
|
Evolving a schema is `IEventTypeMigration<TTarget, TSource>` with `upcast` and
|
|
179
|
-
`downcast` — `events/migrations/IEventTypeMigration.kt
|
|
176
|
+
`downcast` — `events/migrations/IEventTypeMigration.kt`. Migrations
|
|
180
177
|
register in the same call as event types
|
|
181
|
-
(`artifacts/ArtifactRegistrations.kt
|
|
178
|
+
(`artifacts/ArtifactRegistrations.kt`).
|
|
182
179
|
|
|
183
180
|
## Appending
|
|
184
181
|
|
|
@@ -202,12 +199,12 @@ if (!result.isSuccess) {
|
|
|
202
199
|
```
|
|
203
200
|
|
|
204
201
|
- **The event source id is a plain `String`** at every call site
|
|
205
|
-
(`IEventSequence.kt
|
|
202
|
+
(`IEventSequence.kt`). Typed alternatives taking `ConceptAs<String>` exist
|
|
206
203
|
as extension functions in `io.cratis.chronicle.concepts`
|
|
207
204
|
(`concepts/EventSourceIdConcepts.kt`).
|
|
208
205
|
- `AppendResult` carries `sequenceNumber`, `constraintViolations`, `errors`,
|
|
209
|
-
`isSuccess`, `concurrencyViolation` — `eventSequences/AppendResult.kt
|
|
210
|
-
It also carries `sequenceNumberValue: Long`
|
|
206
|
+
`isSuccess`, `concurrencyViolation` — `eventSequences/AppendResult.kt`.
|
|
207
|
+
It also carries `sequenceNumberValue: Long` purely so Java can read
|
|
211
208
|
the number, because `EventSequenceNumber` is a `@JvmInline value class` whose
|
|
212
209
|
getter Java cannot name.
|
|
213
210
|
- The three-argument `appendMany(List<EventForEventSourceId>, ...)` is the only
|
|
@@ -220,12 +217,14 @@ if (!result.isSuccess) {
|
|
|
220
217
|
`concurrencyScope`, `eventSourceType`, `eventStreamType`, `eventStreamId`,
|
|
221
218
|
`subject`, `tags`, `occurred`, `causation`, `eventSource`, `eventStream`.
|
|
222
219
|
|
|
223
|
-
|
|
220
|
+
Requires Chronicle.Kotlin 6.0.0 for kernel-resolved routing.
|
|
221
|
+
|
|
222
|
+
Omitted/empty routing resolves **in the kernel** to
|
|
224
223
|
`Default` / `All` / `Default` (source type / stream type / stream id).
|
|
225
224
|
The client no longer substitutes the event source id as stream id. Preserve a
|
|
226
225
|
legacy route by passing all three explicitly. Reads narrow only by supplied
|
|
227
226
|
filters; single-source `appendMany` applies the routing options to every event.
|
|
228
|
-
See the product's `Documentation/guides/migrate-append-routing.md
|
|
227
|
+
See the product's `Documentation/guides/migrate-append-routing.md`.
|
|
229
228
|
|
|
230
229
|
For an idempotent create, narrow the concurrency scope and use
|
|
231
230
|
`ConcurrencyScopeBuilder.withExpectsNoMatchingEvent()`. The equivalent is
|
|
@@ -234,7 +233,7 @@ expectsNoMatchingEvent = true)`; a concrete sequence number and this flag are
|
|
|
234
233
|
mutually exclusive (package `eventSequences.concurrency`).
|
|
235
234
|
|
|
236
235
|
Event-source definitions and their named streams are optional, discovered
|
|
237
|
-
artifacts
|
|
236
|
+
artifacts (kernel requirement above).
|
|
238
237
|
Read [references/event-sources.md](references/event-sources.md) when declaring
|
|
239
238
|
`@EventSource`/`@EventStream` or appending through a definition.
|
|
240
239
|
|
|
@@ -255,7 +254,7 @@ In a unit of work, `transactional` appends return a placeholder `AppendResult`
|
|
|
255
254
|
### Handlers are found by their first parameter's type
|
|
256
255
|
|
|
257
256
|
This is the single most important convention in this client, and it is not the
|
|
258
|
-
method name. `observation/EventHandlerMethod.kt
|
|
257
|
+
method name. `observation/EventHandlerMethod.kt` reads a function as a
|
|
259
258
|
handler only when **parameter index 1 — the first real parameter — is a class
|
|
260
259
|
annotated with `@EventType`**. The method name is irrelevant. A handler may be
|
|
261
260
|
`suspend` or plain; both are invoked through `callSuspend`.
|
|
@@ -277,25 +276,25 @@ class <ReactorName>(private val <dependency>: <Dependency>) {
|
|
|
277
276
|
whose type is not annotated `@EventType` are ignored; a single event, an
|
|
278
277
|
`EventForEventSourceId`, or a `List` mixing both is appended, defaulting to the
|
|
279
278
|
triggering event source. A returned `List` is one atomic batch: one rejected
|
|
280
|
-
event rejects all — `observation/ReactorSideEffects.kt
|
|
279
|
+
event rejects all — `observation/ReactorSideEffects.kt`.
|
|
281
280
|
This is how a reactor appends without ever touching the event log.
|
|
282
281
|
|
|
283
282
|
`EventContext` is a data class with `sequenceNumber: Long`, `eventSourceId`,
|
|
284
283
|
`eventType`, `occurred`, `correlationId`, `causedBy`, `eventSourceType`,
|
|
285
284
|
`eventStreamType`, `eventStreamId`, `eventStore`, `namespace`, `causation`,
|
|
286
285
|
`tags`, `hash`, `observationState`, `subject`, `eventSource` —
|
|
287
|
-
`events/EventContext.kt`.
|
|
286
|
+
`events/EventContext.kt`. Recompile when the constructor changes.
|
|
288
287
|
|
|
289
288
|
### The annotations
|
|
290
289
|
|
|
291
290
|
| Annotation | Arguments | Source |
|
|
292
291
|
| --- | --- | --- |
|
|
293
|
-
| `@Reactor` | `id = ""`, `eventSequence = ""` | `observation/Reactor.kt
|
|
294
|
-
| `@Reducer` | `id = ""`, `eventSequence = ""`, `isActive = true` | `observation/Reducer.kt
|
|
295
|
-
| `@ReadModel` | `id = ""`, `displayName = ""` | `readModels/ReadModel.kt
|
|
296
|
-
| `@Projection` | `id = ""`, `eventSequence = ""` — optional | `projections/Projection.kt
|
|
297
|
-
| `@Constraint` | `id = ""` | `constraints/Constraint.kt
|
|
298
|
-
| `@Seeder` | none | `seeding/Seeder.kt
|
|
292
|
+
| `@Reactor` | `id = ""`, `eventSequence = ""` | `observation/Reactor.kt` |
|
|
293
|
+
| `@Reducer` | `id = ""`, `eventSequence = ""`, `isActive = true` | `observation/Reducer.kt` |
|
|
294
|
+
| `@ReadModel` | `id = ""`, `displayName = ""` | `readModels/ReadModel.kt` |
|
|
295
|
+
| `@Projection` | `id = ""`, `eventSequence = ""` — optional | `projections/Projection.kt` |
|
|
296
|
+
| `@Constraint` | `id = ""` | `constraints/Constraint.kt` |
|
|
297
|
+
| `@Seeder` | none | `seeding/Seeder.kt` |
|
|
299
298
|
|
|
300
299
|
Handler-level: `@Replay`, `@OnceOnly`. Observer filtering: `@Tag`/`@Tags`,
|
|
301
300
|
`@FilterEventsByTag`/`@FilterEventsByTags`, `@EventSequence`,
|
|
@@ -303,21 +302,21 @@ Handler-level: `@Replay`, `@OnceOnly`. Observer filtering: `@Tag`/`@Tags`,
|
|
|
303
302
|
|
|
304
303
|
A reducer's handler may be `(event)`, `(event, state)`, or
|
|
305
304
|
`(event, state, context)` — the three shapes accepted by the dispatcher and by
|
|
306
|
-
`ReadModelScenario` (`Testing/.../ReadModelScenario.kt
|
|
305
|
+
`ReadModelScenario` (`Testing/.../ReadModelScenario.kt`). **Reducers run
|
|
307
306
|
client-side**: the kernel streams events and the handler is invoked in your
|
|
308
|
-
process (`observation/ReducersService.kt
|
|
307
|
+
process (`observation/ReducersService.kt`).
|
|
309
308
|
|
|
310
309
|
### Read models and model-bound projections
|
|
311
310
|
|
|
312
311
|
Read models are queried through `store.readModels`
|
|
313
|
-
(`readModels/IReadModelsService.kt`): `getInstanceByKey(readModelClass, key): T
|
|
314
|
-
|
|
315
|
-
`getSnapshotsById
|
|
316
|
-
(
|
|
312
|
+
(`readModels/IReadModelsService.kt`): `getInstanceByKey(readModelClass, key): T?`,
|
|
313
|
+
`getInstances(readModelClass, eventCount)`,
|
|
314
|
+
`getSnapshotsById`, and `watch(readModelClass): Flow<ReadModelChangeset<T>>`
|
|
315
|
+
(which is **not** suspending — it hands back a `Flow`).
|
|
317
316
|
|
|
318
317
|
A model-bound projection puts the projection on the read model with `@FromEvent`
|
|
319
|
-
(`projections/FromEvent.kt
|
|
320
|
-
(`projections/SetFrom.kt
|
|
318
|
+
(`projections/FromEvent.kt`) and `@SetFrom`
|
|
319
|
+
(`projections/SetFrom.kt`); the full family also includes `SetValue`,
|
|
321
320
|
`SetFromContext`, `AddFrom`, `SubtractFrom`, `Increment`, `Decrement`, `Count`,
|
|
322
321
|
`Join`, `RemovedWith`, `RemovedWithJoin`, `ChildrenFrom`, `ClearWith`,
|
|
323
322
|
`FromAll`, `FromEvery`, `FromEventSourceId`, `CountFromAll`, `IncrementFromAll`,
|
|
@@ -335,7 +334,9 @@ append includes that event rather than waiting for a materialized observer.
|
|
|
335
334
|
|
|
336
335
|
### Variants — mutually exclusive read models for one entity's lifecycle
|
|
337
336
|
|
|
338
|
-
Variants let several read models share one identity and be mutually exclusive; each variant must declare an `@EntersOn`/`entersOn(...)` event or registration throws `VariantMustDeclareEntersOnEvent`.
|
|
337
|
+
Variants let several read models share one identity and be mutually exclusive; each variant must declare an `@EntersOn`/`entersOn(...)` event or registration throws `VariantMustDeclareEntersOnEvent`.
|
|
338
|
+
|
|
339
|
+
Requires Chronicle.Kotlin 6.5.0 for end-to-end variant key support; replay affected projections once when moving from an earlier version.
|
|
339
340
|
|
|
340
341
|
Read [references/variants.md](references/variants.md) when an entity changes shape over its lifecycle and you need `@VariantOf`, `@EntersOn`, `@GlobalFor` or the declarative `variantOf`/`entersOn` builder.
|
|
341
342
|
|
|
@@ -360,13 +361,15 @@ Read [references/connection-lifecycle.md](references/connection-lifecycle.md) wh
|
|
|
360
361
|
## Testing
|
|
361
362
|
|
|
362
363
|
`io.cratis:chronicle-testing` runs in-process with no kernel and no Docker:
|
|
363
|
-
`EventScenario` (`Testing/.../EventScenario.kt
|
|
364
|
-
`ReadModelScenario<TReadModel>` (`Testing/.../ReadModelScenario.kt
|
|
364
|
+
`EventScenario` (`Testing/.../EventScenario.kt`) and
|
|
365
|
+
`ReadModelScenario<TReadModel>` (`Testing/.../ReadModelScenario.kt`), which
|
|
365
366
|
folds a reducer through the same handler-shape rules as production
|
|
366
|
-
(`ReadModelScenario.kt
|
|
367
|
+
(`ReadModelScenario.kt`). Its scope is small — appends and reducer folds
|
|
367
368
|
only; there is no in-process reactor, projection, or constraint scenario
|
|
368
|
-
(`Testing/api/Testing.api`).
|
|
369
|
-
|
|
369
|
+
(`Testing/api/Testing.api`).
|
|
370
|
+
|
|
371
|
+
Requires Chronicle.Kotlin 6.5.0 for `EventScenario` assertions and
|
|
372
|
+
`eventsOf` to count only events appended after the last `given`.
|
|
370
373
|
|
|
371
374
|
## Verify
|
|
372
375
|
|
package/package/corpus/skills/cratis-chronicle-client-kotlin/references/connection-lifecycle.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Connection lifecycle
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Source: `Cratis/Chronicle.Kotlin`: `CompatibilityPreflight`,
|
|
4
4
|
`ConnectionManager`, `ChronicleConnection` and `EventStore.awaitRegistration`.
|
|
5
5
|
|
|
6
6
|
- Connect checks kernel contract compatibility with a 10-second deadline;
|
|
@@ -8,26 +8,25 @@ Verified at `Chronicle.Kotlin v6.13.0`: `CompatibilityPreflight`,
|
|
|
8
8
|
- Credentials are not validated when constructing the client. A rejected
|
|
9
9
|
connection is surfaced by `awaitRegistration()` and the first append as
|
|
10
10
|
`ChronicleConnectionFailed`. The client keeps retrying and can recover.
|
|
11
|
-
-
|
|
11
|
+
- GUIDs use .NET byte order on the wire. New correlation ids
|
|
12
12
|
round-trip; older events return the first three UUID groups byte-reversed
|
|
13
13
|
relative to what the application originally supplied. Earlier capture ids
|
|
14
14
|
remain stored as-is; supply your original id and the client resolves both.
|
|
15
15
|
|
|
16
16
|
- **Keepalive is two-way.** The kernel pushes a keep-alive down the `Connect`
|
|
17
17
|
stream and the client answers with a separate unary `connectionKeepAlive` RPC
|
|
18
|
-
(`connection/ConnectionManager.kt
|
|
18
|
+
(`connection/ConnectionManager.kt`). A watchdog checks every
|
|
19
19
|
`WATCHDOG_INTERVAL_MS = 1_000L` and treats a gap longer than
|
|
20
|
-
`KEEP_ALIVE_TIMEOUT_MS = 5_000L` as a lost connection
|
|
21
|
-
`:171`). **Silence, not an error, is how the connection dies** — nothing throws.
|
|
20
|
+
`KEEP_ALIVE_TIMEOUT_MS = 5_000L` as a lost connection. **Silence, not an error, is how the connection dies** — nothing throws.
|
|
22
21
|
- Reconnect is an infinite loop with jittered exponential backoff, base 1s,
|
|
23
22
|
capped at 30s, re-resolving DNS/SRV on every attempt
|
|
24
|
-
(`ConnectionManager.kt
|
|
23
|
+
(`ConnectionManager.kt`).
|
|
25
24
|
- The client identifies itself to the kernel as `"Kotlin"`
|
|
26
|
-
(`ConnectionManager.kt
|
|
25
|
+
(`ConnectionManager.kt`).
|
|
27
26
|
- `dispose()` cancels the connection manager, shuts the channel down with a
|
|
28
27
|
5-second `awaitTermination`, then `shutdownNow`
|
|
29
|
-
(`connection/ChronicleConnection.kt
|
|
28
|
+
(`connection/ChronicleConnection.kt`).
|
|
30
29
|
- **Your process must stay alive** for reactors and reducers to keep receiving —
|
|
31
30
|
observation is a live gRPC stream, and each observer runs on its own
|
|
32
|
-
`CoroutineScope(Dispatchers.IO)` (`observation/ReactorsService.kt
|
|
33
|
-
`observation/ReducersService.kt
|
|
31
|
+
`CoroutineScope(Dispatchers.IO)` (`observation/ReactorsService.kt`,
|
|
32
|
+
`observation/ReducersService.kt`).
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
## Discovery and registration
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Source: `Chronicle.Kotlin`: `ClientArtifacts`,
|
|
4
4
|
`ArtifactRegistrations.registerAll` and `EventStore`.
|
|
5
5
|
|
|
6
6
|
`ClientArtifacts` scans the classpath with ClassGraph
|
|
7
|
-
(`artifacts/ClientArtifacts.kt
|
|
8
|
-
process-wide lazy singleton
|
|
7
|
+
(`artifacts/ClientArtifacts.kt`), and `ClientArtifacts.default` is a
|
|
8
|
+
process-wide lazy singleton. What it looks for:
|
|
9
9
|
|
|
10
10
|
| Kind | Rule |
|
|
11
11
|
| --- | --- |
|
|
@@ -40,15 +40,15 @@ Explicit `registerAll()` starts the remaining observers then throws
|
|
|
40
40
|
`ArtifactRegistrationFailed` listing failures. A kernel-rejected event-type
|
|
41
41
|
registration throws `ChronicleCommandRejected`.
|
|
42
42
|
|
|
43
|
-
**Registration re-runs on every reconnect.** `EventStore.kt
|
|
43
|
+
**Registration re-runs on every reconnect.** `EventStore.kt` launches a
|
|
44
44
|
coroutine on `Dispatchers.IO` collecting the connection lifecycle and
|
|
45
45
|
re-registers each time. The connection id rotates on every disconnect because
|
|
46
46
|
the kernel keys observer subscriptions by it
|
|
47
|
-
(`connection/ConnectionLifecycle.kt
|
|
47
|
+
(`connection/ConnectionLifecycle.kt`), so observers must re-register — and
|
|
48
48
|
they do.
|
|
49
49
|
|
|
50
50
|
`store.awaitRegistration()` waits for the first attempted pass; its gate
|
|
51
51
|
completes in `finally` even on failure. It throws `ChronicleConnectionFailed`
|
|
52
52
|
when the kernel rejects the connection, as do gated appends.
|
|
53
|
-
`store.registerAll()`
|
|
53
|
+
`store.registerAll()` runs it by hand when
|
|
54
54
|
`autoDiscoverAndRegister = false`.
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
# Event-source definitions and streams
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Source: `Cratis/Chronicle.Kotlin`: `eventSources/EventSource.kt`,
|
|
7
7
|
`EventStream.kt`, `ConcurrencyDimension.kt`, `EventSources.kt` and
|
|
8
|
-
`eventSequences/EventSequenceEventSources.kt`.
|
|
8
|
+
`eventSequences/EventSequenceEventSources.kt`.
|
|
9
|
+
|
|
10
|
+
Requires Chronicle kernel 19.30.0 for named event source definitions.
|
|
9
11
|
|
|
10
12
|
Definitions are optional: an append without one keeps the ordinary routing
|
|
11
13
|
contract. A definition is a carrier class, never instantiated, discovered with
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Java is a first-class target here, not an afterthought: there is a compile-only
|
|
4
4
|
Java conformance suite under `Source/src/test/java` whose whole point is stated
|
|
5
|
-
in `conformance/JavaConformance.java
|
|
5
|
+
in `conformance/JavaConformance.java` — *"It is never run — compiling it is
|
|
6
6
|
the assertion"*.
|
|
7
7
|
|
|
8
8
|
**Start Java code at `BlockingChronicleClient`**, not at the raw `ChronicleClient`
|
|
9
9
|
plus static bridges. Verbatim from the compile-checked fixture
|
|
10
|
-
(`Source/src/test/java/io/cratis/chronicle/java/JavaClientFlowUsage.java
|
|
10
|
+
(`Source/src/test/java/io/cratis/chronicle/java/JavaClientFlowUsage.java`):
|
|
11
11
|
|
|
12
12
|
```java
|
|
13
13
|
var client = BlockingChronicleClient.connect(ChronicleOptions.development());
|
|
@@ -17,14 +17,14 @@ eventStore.getEventLog().append("<event-source-id>", new <EventName>("<value>"))
|
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
`BlockingChronicleClient` is `AutoCloseable`, so `try (var client = ...)` works
|
|
20
|
-
(`java/BlockingChronicleClient.kt
|
|
20
|
+
(`java/BlockingChronicleClient.kt`, `connect` at). The blocking
|
|
21
21
|
surface continues through `BlockingEventStore`, `BlockingEventSequence`,
|
|
22
22
|
`BlockingReadModels`, `BlockingReactors`, `BlockingReducers`,
|
|
23
23
|
`BlockingUnitOfWork`, and `AppendOptionsBuilder`.
|
|
24
24
|
|
|
25
25
|
> The repository's own README shows the **older** low-level route —
|
|
26
26
|
> `new ChronicleClient(...)` plus `EventStoreJavaBridge` / `EventLogJavaBridge`
|
|
27
|
-
> (`README.md
|
|
27
|
+
> (`README.md`). Both APIs are real, but the reference documentation and
|
|
28
28
|
> the compile-checked fixture both start at `BlockingChronicleClient`. Write new
|
|
29
29
|
> Java against that; reach for the `*JavaBridge` statics only for a corner the
|
|
30
30
|
> blocking client does not wrap.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# Chronicle options
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Source: `Cratis/Chronicle.Kotlin`: `ChronicleOptions.kt` and
|
|
7
7
|
`readModels/DefaultReadModelNamingPolicy.kt`. `ChronicleOptions` is a data class
|
|
8
8
|
with `@JvmOverloads` constructors.
|
|
9
9
|
|