@cratis/pi 8.16.0 → 8.17.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/skills/cratis-arc-authorize-request/references/authproxy.md +3 -0
- package/package/corpus/skills/cratis-arc-authorize-request/references/csharp.md +21 -0
- package/package/corpus/skills/cratis-arc-diagnose-live-query/references/csharp.md +19 -6
- package/package/corpus/skills/cratis-arc-expose-query/references/csharp.md +12 -2
- package/package/corpus/skills/cratis-arc-generate-proxies/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-host-application/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-host-application/references/csharp.md +27 -0
- package/package/corpus/skills/cratis-arc-localize-application/SKILL.md +3 -2
- package/package/corpus/skills/cratis-arc-localize-application/references/csharp.md +1 -1
- package/package/corpus/skills/cratis-arc-localize-application/references/typescript-tooling.md +3 -0
- package/package/corpus/skills/cratis-arc-localize-application/references/typescript.md +32 -0
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-localization.md +26 -2
- package/package/corpus/skills/cratis-arc-react-separate-view-model/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-react-separate-view-model/references/typescript.md +31 -1
- package/package/corpus/skills/cratis-arc-storage-typescript/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-storage-typescript/references/typescript-drizzle.md +2 -0
- package/package/corpus/skills/cratis-authproxy-configure/SKILL.md +3 -2
- package/package/corpus/skills/cratis-authproxy-configure/references/admission.md +6 -4
- package/package/corpus/skills/cratis-authproxy-configure/references/services-and-routing.md +12 -1
- package/package/corpus/skills/cratis-authproxy-configure/references/sessions-and-logout.md +47 -7
- package/package/corpus/skills/cratis-chronicle-cli-operations/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-connect-application/references/csharp-patterns.md +3 -1
- package/package/corpus/skills/cratis-chronicle-connect-application/references/elixir-patterns.md +2 -1
- package/package/corpus/skills/cratis-chronicle-connect-application/references/go-patterns.md +3 -1
- package/package/corpus/skills/cratis-chronicle-connect-application/references/go.md +3 -3
- package/package/corpus/skills/cratis-chronicle-connect-application/references/java.md +40 -2
- package/package/corpus/skills/cratis-chronicle-connect-application/references/kotlin-patterns.md +3 -2
- package/package/corpus/skills/cratis-chronicle-connect-application/references/kotlin.md +2 -2
- package/package/corpus/skills/cratis-chronicle-connect-application/references/typescript-patterns.md +2 -1
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/upgrade-and-recovery.md +14 -0
- package/package/corpus/skills/cratis-chronicle-project-view/SKILL.md +11 -10
- package/package/corpus/skills/cratis-chronicle-project-view/references/join-precedence.md +38 -0
- package/package/corpus/skills/cratis-chronicle-project-view/references/typescript.md +1 -1
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp.md +11 -2
- package/package/corpus/skills/cratis-chronicle-react-to-fact/SKILL.md +17 -1
- package/package/corpus/skills/cratis-chronicle-record-event/references/go.md +11 -0
- package/package/corpus/skills/cratis-chronicle-select-client/references/python.md +8 -1
- package/package/corpus/skills/cratis-code-review/SKILL.md +5 -0
- package/package/corpus/skills/cratis-components-submit-form/SKILL.md +1 -1
- package/package/corpus/skills/cratis-components-submit-form/references/typescript-commanddialog.md +1 -0
- package/package/corpus/skills/cratis-platform-deliver-slice/SKILL.md +3 -0
- package/package/corpus/skills/cratis-platform-deliver-slice/references/csharp.md +9 -3
- package/package/corpus/skills/cratis-platform-start-application/SKILL.md +1 -1
- package/package/corpus/skills/cratis-platform-start-application/references/csharp.md +5 -0
- package/package/corpus/skills/cratis-platform-upgrade-application/SKILL.md +2 -2
- package/package/corpus/skills/cratis-platform-upgrade-application/references/csharp.md +1 -0
- package/package/corpus/skills/cratis-platform-upgrade-application/references/typescript.md +1 -1
- package/package/corpus/skills/cratis-screenplay-declare-slice/SKILL.md +2 -2
- package/package/corpus/skills/cratis-screenplay-declare-slice/references/commands.md +9 -0
- package/package/corpus/skills/cratis-screenplay-declare-slice/references/read-identity.md +1 -1
- package/package/corpus/skills/cratis-screenplay-declare-slice/references/structure-and-imports.md +1 -1
- package/package/corpus/skills/cratis-screenplay-model-automation/SKILL.md +8 -10
- package/package/corpus/skills/cratis-screenplay-model-interaction/SKILL.md +4 -4
- package/package/corpus/skills/cratis-screenplay-model-interaction/references/shell-and-data.md +21 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/SKILL.md +1 -1
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-command-results.md +9 -2
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-events.md +9 -1
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-query-scenario.md +2 -2
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-reactors.md +1 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-read-models.md +13 -1
- package/package/profile-catalog.json +2 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cratis-chronicle-cli-operations
|
|
3
|
-
description: Use when inspecting a live Chronicle store, gating a release or deploy, running an authorized store operation
|
|
3
|
+
description: Use when inspecting a live Chronicle store, gating a release or deploy, running an authorized store operation, installing/updating AI guidance (`cratis ai`), updating the CLI and its templates (`cratis update`) or running `cratis new` unattended in CI via the cratis CLI; lists every `cratis chronicle` command. Not for picking MCP tools (use cratis-chronicle-mcp-inspection) or kernel configuration (use cratis-chronicle-deploy-kernel).
|
|
4
4
|
license: MIT
|
|
5
5
|
---
|
|
6
6
|
|
package/package/corpus/skills/cratis-chronicle-connect-application/references/csharp-patterns.md
CHANGED
|
@@ -17,7 +17,7 @@ The first argument is the scope (a `PatternGroupingKey`, convertible from a stri
|
|
|
17
17
|
|
|
18
18
|
| Call | Answers |
|
|
19
19
|
| --- | --- |
|
|
20
|
-
| `GetPatternsAt(scope, moment, alsoConstraining)` | What usually happens at this point in the week. `moment` defaults to now; the day and time bucket are derived from it. `alsoConstraining`
|
|
20
|
+
| `GetPatternsAt(scope, moment, alsoConstraining)` | What usually happens at this point in the week. `moment` defaults to now at the process's local offset; the day and time bucket are derived from it. `alsoConstraining` adds facets to the question |
|
|
21
21
|
| `GetUsualActions(scope, context)` | What usually happens in a context that is not a moment; at most one answer per action |
|
|
22
22
|
| `GetPatterns(scope, context)` | Which established patterns cover a known action: put `FacetName.CommandType` in the context. Most specific first, then most confident |
|
|
23
23
|
| `GetPatternsForScope(scope)` | Every stored pattern for the scope, including those below the confidence threshold; for browsing |
|
|
@@ -26,6 +26,8 @@ The first argument is the scope (a `PatternGroupingKey`, convertible from a stri
|
|
|
26
26
|
The first three also accept `minimumConfidence: new PatternConfidence(0.8)` (default: the kernel's configured minimum), `maximumResults: 3` (default: ten) and a cancellation token.
|
|
27
27
|
|
|
28
28
|
- **Context:** `FacetSet.Empty.With(FacetName.AggregateType, "Parcel").With(FacetName.Day, DayOfWeek.Monday.ToString())`. `With` returns a new set and replaces an existing value for the same name. Facet names: `CommandType`, `InitiatorType`, `InitiatorId`, `OnBehalfOf`, `CausedByCommand`, `CorrelationRootId`, `AggregateType`, `Year`, `Month`, `Day`, `TimeBucket`. A facet the kernel is not configured to mine is discarded and does not narrow the answer.
|
|
29
|
+
- **Moment:** on a server the default is the server's clock and offset, not the user's; pass a `DateTimeOffset` carrying the user's offset.
|
|
30
|
+
- **An added facet is not a filter:** in `GetPatternsAt` and `GetUsualActions` a pattern answers when everything it was established on, apart from its action, appears in the question. A pattern established only on the day and time bucket therefore still answers a question that also names `AggregateType`. Read `Facets` to see what each row was established on, and keep only the actions the application offers in that situation before showing them.
|
|
29
31
|
- **Time bucket:** prefer `GetPatternsAt` over computing buckets yourself. When you need one, `moment.ToTimeBucket()` on a `DateTimeOffset` applies the kernel's rule (`EarlyMorning`, `Morning`, `Midday`, `Afternoon`, `Evening`, `Night`).
|
|
30
32
|
- **Result:** `BehaviorPattern` has `GroupingKey`, `Facets`, `Confidence` (0 to 1), `Support` (0 to 1), `Occurrences` (a mining count, not an audit total), `Weight` (decays when the behavior goes unseen), `FirstSeen` and `LastSeen`. `pattern.Facets.Constrains(name)` tells whether the pattern fixes that facet.
|
|
31
33
|
- **Checking normality:** a result that only fixes the day or time does not establish that the action is normal; require `pattern.Facets.Constrains(FacetName.CommandType)`.
|
package/package/corpus/skills/cratis-chronicle-connect-application/references/elixir-patterns.md
CHANGED
|
@@ -17,13 +17,14 @@ The first argument is the scope (grouping key): a string, usually a user identit
|
|
|
17
17
|
|
|
18
18
|
| Call | Answers |
|
|
19
19
|
| --- | --- |
|
|
20
|
-
| `get_patterns_at(scope, moment \\ nil, opts)` | Default. What the scope usually does at this moment. `moment` is a `DateTime` (`nil` means now); `Day` and `TimeBucket` come from the moment's **own offset**, not UTC. `also_constraining: %{facet => value}`
|
|
20
|
+
| `get_patterns_at(scope, moment \\ nil, opts)` | Default. What the scope usually does at this moment. `moment` is a `DateTime` (`nil` means now in UTC, so pass the user's local `DateTime` whenever the question is about a person); `Day` and `TimeBucket` come from the moment's **own offset**, not UTC. `also_constraining: %{facet => value}` adds facets to the question |
|
|
21
21
|
| `get_usual_actions(scope, context \\ %{}, opts)` | What is usually done in a hand-built context; at most one answer per action |
|
|
22
22
|
| `get_patterns(scope, context \\ %{}, opts)` | Which established patterns describe a hand-built context |
|
|
23
23
|
| `get_patterns_for_scope(scope, opts)` | Every pattern mined for the scope |
|
|
24
24
|
| `get_scopes(opts)` | `{:ok, [scope_id]}` known in the namespace |
|
|
25
25
|
| `time_bucket(datetime)` | The kernel's part-of-day rule: `:early_morning` (05–08), `:morning` (08–11), `:midday` (11–14), `:afternoon` (14–17), `:evening` (17–22), `:night` (22–05). Never write your own copy: a different rule asks about slots that were never mined and looks like "nothing established" |
|
|
26
26
|
|
|
27
|
+
- **An added facet is not a filter:** in `get_patterns_at` and `get_usual_actions` a pattern answers when everything it was established on, apart from its action, appears in the question. A pattern established only on the day and time bucket therefore still answers a question that also names the aggregate type. Read `facets` to see what each row was established on, and keep only the actions the application offers in that situation before showing them.
|
|
27
28
|
- **Facets:** use the `FacetName` functions as map keys: `command_type`, `initiator_type`, `initiator_id`, `on_behalf_of`, `caused_by_command`, `correlation_root_id`, `aggregate_type`, `year`, `month`, `day`, `time_bucket`. Values are strings.
|
|
28
29
|
- **Options on every call:** `:client`, `:namespace`, `:minimum_confidence` (`0.0` to `1.0`) and `:max_results`; the last two default to the server's settings.
|
|
29
30
|
- **Rows:** `%Patterns.BehaviorPattern{grouping_key, facets, occurrences, confidence, support, weight, first_seen, last_seen}`. The action a row answers for is its `command_type` facet; a row without it only describes a situation.
|
package/package/corpus/skills/cratis-chronicle-connect-application/references/go-patterns.md
CHANGED
|
@@ -19,10 +19,12 @@ Import `github.com/cratis/chronicle.go/patterns`. The second argument is a `patt
|
|
|
19
19
|
| --- | --- |
|
|
20
20
|
| `GetUsualActions(ctx, key, facets, options)` | What usually happens in this context; ranked, at most one row per action |
|
|
21
21
|
| `GetPatterns(ctx, key, facets, options)` | Which established patterns describe this context; most specific first, then most confident |
|
|
22
|
-
| `GetPatternsAt(ctx, key, moment, alsoConstraining, options)` | What usually happens at this moment; `moment` is a `*time.Time` (nil means now) and sets the `Day` and `TimeBucket` facets from its own UTC offset |
|
|
22
|
+
| `GetPatternsAt(ctx, key, moment, alsoConstraining, options)` | What usually happens at this moment; `moment` is a `*time.Time` (nil means now in the process's local zone) and sets the `Day` and `TimeBucket` facets from its own UTC offset |
|
|
23
23
|
| `GetPatternsForScope(ctx, key)` | Every pattern for the scope, unfiltered |
|
|
24
24
|
| `GetScopes(ctx)` | Scopes known in this namespace (`ID`, optional `Name` and `UserName`) |
|
|
25
25
|
|
|
26
|
+
- **Moment:** on a server a nil moment is the server's clock and zone, not the user's; pass the user's local moment, a `time.Time` in that user's location.
|
|
27
|
+
- **An added facet is not a filter:** in `GetPatternsAt` and `GetUsualActions` a pattern answers when everything it was established on, apart from its action, appears in the question. A pattern established only on the day and time bucket therefore still answers a question that also names `AggregateType`. Read `Facets` to see what each row was established on, and keep only the actions the application offers in that situation before showing them.
|
|
26
28
|
- **Facets:** `CommandType`, `InitiatorType`, `InitiatorID`, `OnBehalfOf`, `CausedByCommand`, `CorrelationRootID`, `AggregateType`, `Year`, `Month`, `Day`, `TimeBucket`. `set.With(name, value)` returns a new set; an empty value means unspecified; an empty `FacetSet` constrains nothing.
|
|
27
29
|
- **Options:** `patterns.QueryOptions{MinimumConfidence, MaximumResults}` are pointers. Nil or zero both mean the server default; you cannot ask for zero results.
|
|
28
30
|
- **Rows:** `BehaviorPattern` has `ID`, `GroupingKey`, `Facets`, `Confidence`, `Support`, `Occurrences`, `Weight`, `Specificity`, `FirstSeen`, `LastSeen`; `Action()` is its `CommandType` facet, empty for a context-only pattern.
|
|
@@ -31,7 +31,7 @@ For a wiring test only, in a disposable namespace call `res, err := s.EventLog()
|
|
|
31
31
|
- `names, err := c.EventStores(ctx)` lists authorized stores; `partitions, err := s.Namespaces().List(ctx)` lists namespaces in this store.
|
|
32
32
|
- `s.Namespaces().Ensure(ctx, ns)` idempotently creates. `s.Namespaces().Remove(ctx, ns)` irreversibly deletes the explicit target, not necessarily this handle's namespace. Stop **all** clients using it first. Missing target is a no-op; default namespace and system store are protected. Inspect server state after uncertain failure; handles are not invalidated.
|
|
33
33
|
- `err := c.EvictEventStores()` clears lookup and future automatic registration membership without I/O. Old handles and watches remain live; the next lookup uses a new facade. Not a resource cleanup operation.
|
|
34
|
-
- Stop admitting work, then `err := c.Shutdown(shutdownCtx)` to drain admitted calls and close. `c.CloseContext(ctx)` cancels immediately with a bounded wait; `c.Close()` cancels and joins without a deadline. A deadline leaves cleanup in progress; join again. Close borrowed resources afterwards.
|
|
34
|
+
- Stop admitting work, then `err := c.Shutdown(shutdownCtx)` to drain admitted calls and close. It drains only RPCs already admitted: application work that has not yet entered an RPC is refused before dispatch with `ErrClosed`, so finish or hand back in-flight application work before calling it. `c.CloseContext(ctx)` cancels immediately with a bounded wait; `c.Close()` cancels and joins without a deadline. A deadline leaves cleanup in progress; join again. Close borrowed resources afterwards.
|
|
35
35
|
|
|
36
36
|
## Endpoint, security and supervision options
|
|
37
37
|
|
|
@@ -40,7 +40,7 @@ Below, `With…` options are in `chronicle` and are passed to `Dial` or `NewClie
|
|
|
40
40
|
- `WithConnectionString("chronicle://one:35000,two:35000")` uses direct endpoints. Default is `chronicle://localhost:35000`; omitted TLS credentials use the public development OAuth client, not anonymous auth. For a matching local self-signed kernel only, `WithDevelopmentDefaults()` permits its certificate.
|
|
41
41
|
- `chronicle+srv://cluster.example` re-resolves `_chronicle._tcp.cluster.example` each generation. Trust DNS: the target receives credentials. At most 64 candidates. `?srvNameServer=127.0.0.1:53` selects DNS or `WithSRVResolver(resolver)` supplies a cancelable resolver.
|
|
42
42
|
- Default `least-connections` probes endpoint counts and reserves best effort. `?loadBalancer=round-robin` or `random` selects per generation. `WithLoadBalancer(strategy)` calls `Next(ctx, candidates)` each attempt; return an offered address, respect cancellation. Do not combine with a URI balancer or borrowed channel.
|
|
43
|
-
- Use OAuth userinfo (`client-id:encoded-secret@host`), `?apiKey=encoded-key` for `api-key` RPC metadata, or `WithTokenSource(source)` for a concurrent, cancelable external bearer source. `WithNoAuthentication()` or `?auth=none` suppresses SDK authentication. Do not combine authentication modes.
|
|
43
|
+
- Use OAuth userinfo (`client-id:encoded-secret@host`), `?apiKey=encoded-key` for `api-key` RPC metadata, or `WithTokenSource(source)` for a concurrent, cancelable external bearer source. The source stays caller-owned: the client never closes it, so close it after the client. Its `Token(ctx)` must return when `ctx` is cancelled; the client cannot stop a callback, so one that ignores cancellation makes `Close()` wait forever (`CloseContext(ctx)` bounds the wait, not the callback). The same holds for a `WithSRVResolver` resolver. `WithNoAuthentication()` or `?auth=none` suppresses SDK authentication. Do not combine authentication modes.
|
|
44
44
|
- TLS verifies by default. `?caCertificatePath=/run/ca.pem` replaces system roots; `certificatePath=/run/client.pem` adds a leaf-first client chain and unencrypted private key for mutual TLS. Or `WithTLS(&tls.Config{RootCAs: roots, Certificates: certs})`; do not mix with URI certificate files. `skipTlsValidation=true` disables verification, not encryption; `false` overrides development defaults. `disableTls=true` uses plaintext even for OAuth and probes: use only on an independently secured hop, never with `WithTLS` or a client certificate.
|
|
45
45
|
- `WithGRPCConnection(conn)` borrows an owner-secured channel. Explicitly select an OAuth authority URI, token source or `WithNoAuthentication()` (e.g. owner handles auth); owner controls routing and must disable ambiguous write retries. Client shutdown does not close the channel.
|
|
46
46
|
- `WithConnectTimeout(8*time.Second)` changes the positive connection budget (default 5s); bound registration separately with its context. `WithSkipCompatibilityCheck()` or `skipCompatibilityCheck=true` skips structural negotiation at caller risk, not authentication. A rejected negotiation returns `*chronicle.CompatibilityError` (`ServerVersion`, `Details`): match it with `errors.As` and align the releases.
|
|
@@ -70,7 +70,7 @@ Match sentinels with `errors.Is` and typed errors with `errors.As`; all are in p
|
|
|
70
70
|
| `ErrInvalidConfiguration` | An option, URI, ID or declaration is invalid | Fix the code or configuration; never retry |
|
|
71
71
|
| `ErrNotRegistered` | The event type is not in the client's registry | Register it before `Dial`/`NewClient` |
|
|
72
72
|
| `ErrUnsupported` | This SDK or the connected kernel lacks the capability | Use the documented alternative; do not work around it |
|
|
73
|
-
| `ErrClosed` | The client was closed | Stop; create a new client only at process level |
|
|
73
|
+
| `ErrClosed` | The client was closed. Returned bare from a write, it was refused before dispatch: nothing was sent | Stop; create a new client only at process level. Hand the unsent work back to its source; do not reconcile it as an unknown write |
|
|
74
74
|
| `ErrNotPrepared`, `ErrPreparationInProgress`, `*ClientStateError` | A captured client was used before or during `Prepare` | Finish preparation first |
|
|
75
75
|
| `ErrSessionLost` | The kernel no longer knew this connection; the client reconnects by itself | Nothing; seen as the `Err` of a disconnect notification |
|
|
76
76
|
| `ErrProtocol` | The kernel reply was missing or inconsistent | Treat a write's outcome as unknown; check client and kernel releases |
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
# Connect a Java application
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Own one client
|
|
6
|
+
- What fails at startup
|
|
7
|
+
- Endpoints, credentials and trust
|
|
8
|
+
- Workload options
|
|
9
|
+
- Spring Boot ownership
|
|
10
|
+
- Startup errors and tracing
|
|
11
|
+
- Not supported in this SDK
|
|
4
12
|
|
|
5
13
|
## Own one client
|
|
6
14
|
|
|
15
|
+
Use `io.cratis:chronicle` from Maven Central and a gRPC transport such as `io.grpc:grpc-netty-shaded` on the runtime classpath. Use the blocking facade on a worker thread, not an event loop. Names below are illustrative.
|
|
16
|
+
|
|
7
17
|
Supply `CHRONICLE_URI` through your deployment's secret configuration. It should include the deployment credentials and `skipTlsValidation=false`. Put the compiled artifacts on the application's runtime classpath. For example, in package `dispatch.events`, declare `@io.cratis.chronicle.events.EventType public record GateOpened(String gate) {}`.
|
|
8
18
|
|
|
9
19
|
```java
|
|
@@ -31,6 +41,34 @@ try (var client = BlockingChronicleClient.connect(options)) {
|
|
|
31
41
|
|
|
32
42
|
Hold the client until all work finishes; `close()` calls `dispose()`. `getEventStore("Dispatch")` uses `Default`, not a request tenant. Handles reuse an underlying store by name/namespace. `client.getEventStores()` reads a snapshot of store names; `client.evictEventStores()` clears the local cache for future lookups, not kernel data. `awaitRegistration()` blocks for the automatic registration pass or throws on terminal connection failure; return means a first pass was attempted, even if artifact registration threw. Inspect registration diagnostics; this is neither proof that every definition succeeded nor observer catch-up. With `options.withoutAutoRegistration()` it returns immediately: call `store.registerAll()` yourself if this process owns registration.
|
|
33
43
|
|
|
44
|
+
## What fails at startup
|
|
45
|
+
|
|
46
|
+
With default connection options, `BlockingChronicleClient.connect` dials the kernel and runs the compatibility preflight before it returns, so it can fail before returning the client; there is no lazy connect. With `skipCompatibilityCheck=true`, do not rely on `connect` to detect an unreachable or incompatible kernel. With `skipKeepAlive=true`, a dial failure is recorded in the connection lifecycle instead of thrown by `connect`; it surfaces as `ChronicleConnectionFailed` from `awaitRegistration()` or the first append. The `connect` rows below describe the default options. Credentials are **not** checked in `connect` under any options: a failed token request is only written to standard error and the client is still returned.
|
|
47
|
+
|
|
48
|
+
| Call | Failure | React |
|
|
49
|
+
| --- | --- | --- |
|
|
50
|
+
| `connect` | Nothing listening, wrong host or port, or an untrusted certificate with `skipTlsValidation=false`: `io.grpc.StatusException` with status `UNAVAILABLE`. No operation was sent | Fail startup and let the supervisor restart the process, or retry `connect` with backoff |
|
|
51
|
+
| `connect` | The kernel rejects the client's contracts: `io.cratis.chronicle.connection.ChronicleServerIncompatible`, an `IllegalStateException`. No operation was sent | Never retry; align the client and kernel releases |
|
|
52
|
+
| `connect` | A connection string with `apiKey`: `IllegalArgumentException` | Fix the configuration |
|
|
53
|
+
| `awaitRegistration()` or the first append | The kernel refuses the connection: `io.cratis.chronicle.connection.ChronicleConnectionFailed`, a `RuntimeException` whose message names the status (`UNAUTHENTICATED` for a wrong client ID or secret, `PERMISSION_DENIED` for a client that is not permitted) | Report not ready. If the configured client ID or secret is wrong, correct it and restart the application: the background retry reuses the connection string the client was built with. If only the kernel side needs correction (the client's registration or its permissions), keep the client and add no retry loop: its background retry recovers and later calls succeed once the kernel accepts it |
|
|
54
|
+
| `awaitRegistration()` or the first append | The kernel became unreachable after `connect`: nothing is thrown and the call waits with no limit of its own | Bound the startup wait as below |
|
|
55
|
+
|
|
56
|
+
`StatusException` is a checked exception that `connect` does not declare, so `catch (StatusException e)` around it does not compile. Catch `Exception` and read `io.grpc.Status.fromThrowable(e).getCode()`.
|
|
57
|
+
|
|
58
|
+
The blocking facade has no cancellable wait. Run the startup wait on another thread and stop waiting for it:
|
|
59
|
+
|
|
60
|
+
```java
|
|
61
|
+
try {
|
|
62
|
+
CompletableFuture.runAsync(store::awaitRegistration).get(30, TimeUnit.SECONDS);
|
|
63
|
+
} catch (TimeoutException timeout) {
|
|
64
|
+
throw new IllegalStateException("Chronicle was not ready within 30 seconds", timeout);
|
|
65
|
+
} catch (ExecutionException failed) {
|
|
66
|
+
throw new IllegalStateException("Chronicle refused the connection", failed.getCause());
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Through the future a `ChronicleConnectionFailed` arrives as the cause of the `ExecutionException`. The thread running `awaitRegistration` stays blocked until the client connects and closing the client does not release it, so respond to the timeout by stopping the process. Neither a normal return nor a registration log line is readiness: check `isSuccess()` on every append result. Keep one client per process; never open a client per append or per request. After the first registration pass, an append made while the connection stands refused still throws `ChronicleConnectionFailed`, and one made during an outage throws a gRPC `StatusException` or waits.
|
|
71
|
+
|
|
34
72
|
## Endpoints, credentials and trust
|
|
35
73
|
|
|
36
74
|
- `ChronicleOptions.development()` targets localhost:35000 over TLS with development client credentials and certificate validation skipped. Do not use it for shared deployments.
|
|
@@ -64,7 +102,7 @@ cratis.chronicle.registration-timeout=20s
|
|
|
64
102
|
|
|
65
103
|
Defaults: development connection, `Default` store and namespace, discovery in Boot application packages, Spring artifact activation (constructor injection). `program-identifier` overrides `spring.application.name`; `default-sink-type-id` overrides the environment. A unique `ReadModelNamingPolicy` bean overrides container naming. All Chronicle properties here use the `cratis.chronicle` prefix.
|
|
66
104
|
|
|
67
|
-
`namespace-resolution.strategy` defaults to `FIXED`. For authenticated tenancy choose `AUTHENTICATION` and `namespace-resolution.claim` (default `tenant_id`); `HTTP_HEADER` reads `namespace-resolution.http-header` (default `x-cratis-tenant-id`); `SUBDOMAIN` uses the request host. Accept only authorized routing information from trusted infrastructure.
|
|
105
|
+
`namespace-resolution.strategy` defaults to `FIXED`. For authenticated tenancy choose `AUTHENTICATION` and `namespace-resolution.claim` (default `tenant_id`); `HTTP_HEADER` reads `namespace-resolution.http-header` (default `x-cratis-tenant-id`); `SUBDOMAIN` uses the request host. Accept only authorized routing information from trusted infrastructure. Supply an `IEventStoreNamespaceResolver` bean for custom routing. Every strategy except `FIXED` falls back to the `Default` namespace instead of failing: `AUTHENTICATION` when the request is unauthenticated or the token lacks the claim, and all three for work outside a request, such as a scheduled job or a reactor. So require authentication and reject a request without a valid tenant before it reaches Chronicle. In background work never use the injected store: obtain the store for a named namespace from the `IChronicleClient` bean. `cratis-platform-configure-environment` has the per-strategy fallback table and that background-work code.
|
|
68
106
|
|
|
69
107
|
Servlet filters provide request unit of work, causation and (with Spring Security) identity. Disable individual integrations only when the application supplies that context: `unit-of-work.enabled=false`, `causation.enabled=false`, `identity.enabled=false`. Resolve identity after authentication. With automatic registration enabled, startup waits up to `registration-timeout` (30 seconds by default); timeout allows startup with registration continuing, terminal rejection fails startup. Gate dependent traffic separately. `auto-discover-and-register=false` disables this startup wait too.
|
|
70
108
|
|
package/package/corpus/skills/cratis-chronicle-connect-application/references/kotlin-patterns.md
CHANGED
|
@@ -21,13 +21,14 @@ usual.forEach { println("${it.action} ${it.confidence} ${it.occurrences}") }
|
|
|
21
21
|
|
|
22
22
|
| Call | Answers |
|
|
23
23
|
| --- | --- |
|
|
24
|
-
| `getPatternsAt(key, moment, alsoConstraining, minimumConfidence, maximumResults)` | What the scope usually does at this moment; `moment` is an `OffsetDateTime` (omitted means now) and sets the `Day` and `TimeBucket` facets, replacing any in `alsoConstraining` |
|
|
24
|
+
| `getPatternsAt(key, moment, alsoConstraining, minimumConfidence, maximumResults)` | What the scope usually does at this moment; `moment` is an `OffsetDateTime` (omitted means now at the JVM's default offset) and sets the `Day` and `TimeBucket` facets, replacing any in `alsoConstraining` |
|
|
25
25
|
| `getUsualActions(key, context, minimumConfidence, maximumResults)` | The actions usually taken in this facet context |
|
|
26
26
|
| `getPatterns(key, context, minimumConfidence, maximumResults)` | The established patterns that hold in this facet context |
|
|
27
27
|
| `getPatternsForScope(key)` | Every pattern for the scope, unfiltered |
|
|
28
28
|
| `getScopes()` | Every scope with established patterns in this namespace |
|
|
29
29
|
|
|
30
|
-
- **Moment:** the time bucket comes from the moment's own offset, not UTC; pass a moment carrying the offset of the person asked about. To build a bucket yourself use `toTimeBucket()` on an `OffsetDateTime` or `ZonedDateTime` (`EarlyMorning` 05–08, `Morning` 08–11, `Midday` 11–14, `Afternoon` 14–17, `Evening` 17–22, `Night` 22–05). A bucket derived any other way
|
|
30
|
+
- **Moment:** the time bucket comes from the moment's own offset, not UTC; pass a moment carrying the offset of the person asked about. On a server an omitted moment is the server's clock and zone, not the user's, so always pass the user's local moment there. To build a bucket yourself use `toTimeBucket()` on an `OffsetDateTime` or `ZonedDateTime` (`EarlyMorning` 05–08, `Morning` 08–11, `Midday` 11–14, `Afternoon` 14–17, `Evening` 17–22, `Night` 22–05). A bucket derived any other way asks about a different slot: usually an empty answer that looks like "no established behavior", sometimes another slot's routine.
|
|
31
|
+
- **An added facet is not a filter:** in `getPatternsAt` and `getUsualActions` a pattern answers when everything it was established on, apart from its action, appears in the question. A pattern established only on the day and time bucket therefore still answers a question that also names `AggregateType`. Read `facets` to see what each row was established on, and keep only the actions the application offers in that situation before showing them.
|
|
31
32
|
- **Facets:** `FacetName.CommandType` (the action), `InitiatorType`, `InitiatorId`, `OnBehalfOf`, `CausedByCommand`, `CorrelationRootId`, `AggregateType`, `Year`, `Month`, `Day` (such as `Monday`), `TimeBucket`. `set.with(name, value)` returns a new set and replaces an existing value; `FacetSet.empty` constrains nothing.
|
|
32
33
|
- **Options:** omit `minimumConfidence` (a `PatternConfidence` from 0.0 to 1.0) and `maximumResults` to use the server's configured values; zero means the same, so you cannot ask for zero results.
|
|
33
34
|
- **Rows:** `BehaviorPattern` has `groupingKey`, `facets`, `occurrences`, `confidence`, `support`, `weight`, `specificity`, `firstSeen`, `lastSeen` (nullable); `action` is its `CommandType` facet, unspecified (`isSpecified` false) for a context-only pattern.
|
|
@@ -28,7 +28,7 @@ try {
|
|
|
28
28
|
}
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
With default connection options, the constructor dials the kernel and runs the compatibility preflight before it returns, so it can fail before returning the client and no operation is sent; there is no lazy connect. With `skipCompatibilityCheck=true`, do not rely on construction to detect an unreachable or incompatible kernel. With `skipKeepAlive=true`, a dial failure is recorded in the connection lifecycle instead of thrown by construction; it surfaces as `ChronicleConnectionFailed` on `awaitRegistration()` or the first append. Credentials are not checked at construction under any options: refused credentials surface on `awaitRegistration()` or the first append (see Startup errors and tracing). Store handles are cached by name and namespace; omitting the namespace selects the SDK default, not the current tenant. Automatic registration runs on connection and reconnect. **`awaitRegistration()` waits for the first pass to finish, even if that pass threw**; it can throw `ChronicleConnectionFailed` for a terminal connection failure. It is not an all-definitions-success result. The first append shares this gate. For explicit startup ownership use `options.withoutAutoRegistration()` before constructing the client and call `withTimeout(30_000) { store.registerAll() }` at startup: this ensures the store and surfaces thrown registration errors. Inspect diagnostics too: a rejected capture declaration is reported without aborting the pass. With auto-registration off, `awaitRegistration()` returns immediately.
|
|
32
32
|
|
|
33
33
|
For an integration test only, declare `@io.cratis.chronicle.events.EventType(id = "parcel-dispatched") data class ParcelDispatched(val dock: String)` in the scanned package. Use disposable namespaces:
|
|
34
34
|
|
|
@@ -82,7 +82,7 @@ cratis.chronicle.artifact-packages=example.dispatch
|
|
|
82
82
|
|
|
83
83
|
Inject `IEventStore`; it delegates to the store for the namespace resolved at use. For background work pass the authorized namespace explicitly to `IChronicleClient.getEventStore`. Discovery otherwise starts from Boot's auto-configuration packages. Spring supplies an artifact activator; a `ReadModelNamingPolicy` bean customizes names. `cratis.chronicle.program-identifier` overrides the application name; `default-sink-type-id` selects document storage. `auto-discover-and-register=false` transfers registration ownership. `registration-timeout` bounds the starter's wait (30 seconds); it warns and proceeds on timeout, so enforce a stricter readiness policy separately.
|
|
84
84
|
|
|
85
|
-
`cratis.chronicle.namespace-resolution.strategy` defaults to `FIXED`. Choose `AUTHENTICATION` for a trusted principal (`namespace-resolution.claim`, default `tenant_id`), `HTTP_HEADER` for a **validated** header (`namespace-resolution.http-header`, default `x-cratis-tenant-id`), or `SUBDOMAIN` for a validated host. Override `IEventStoreNamespaceResolver` for application policy. Do not treat a caller-selected header as authorization. Servlet integration supplies request unit-of-work, causation and security identity filters; resolve identity after authentication. Disable individual features with `cratis.chronicle.unit-of-work.enabled=false`, `cratis.chronicle.causation.enabled=false` or `cratis.chronicle.identity.enabled=false`. Do not assume servlet filters run on a reactive host.
|
|
85
|
+
`cratis.chronicle.namespace-resolution.strategy` defaults to `FIXED`. Choose `AUTHENTICATION` for a trusted principal (`namespace-resolution.claim`, default `tenant_id`), `HTTP_HEADER` for a **validated** header (`namespace-resolution.http-header`, default `x-cratis-tenant-id`), or `SUBDOMAIN` for a validated host. Override `IEventStoreNamespaceResolver` for application policy. Do not treat a caller-selected header as authorization. Every strategy except `FIXED` falls back to the `Default` namespace instead of failing: `AUTHENTICATION` when the request is unauthenticated or the token lacks the claim, and all three for work outside a request, such as a scheduled job or a reactor. So require authentication and reject a request without a valid tenant before it reaches Chronicle, and never use the injected `IEventStore` in background work; `cratis-platform-configure-environment` has the per-strategy fallback table. Servlet integration supplies request unit-of-work, causation and security identity filters; resolve identity after authentication. Disable individual features with `cratis.chronicle.unit-of-work.enabled=false`, `cratis.chronicle.causation.enabled=false` or `cratis.chronicle.identity.enabled=false`. Do not assume servlet filters run on a reactive host.
|
|
86
86
|
|
|
87
87
|
Outside the filters the SDK exposes `identityProvider.setCurrentIdentity(identity)`, `correlationIdManager.set(id)` and `causationManager.defineRoot(properties)`. Scope them to the work, then `clearCurrentIdentity()`, `clear()` and `clear()` respectively. Identity, causation and correlation are thread-local: they do not follow coroutine suspension or dispatcher changes, and a pooled thread keeps a value until it is cleared, so clear in `finally` on the thread that set it.
|
|
88
88
|
|
package/package/corpus/skills/cratis-chronicle-connect-application/references/typescript-patterns.md
CHANGED
|
@@ -24,7 +24,8 @@ const isNormal = await store.patterns.getPatterns(userId,
|
|
|
24
24
|
|
|
25
25
|
- **Scope** is the grouping key, normally a user ID.
|
|
26
26
|
- **Options:** `minimumConfidence` (0–1) and `maximumResults`; omitting either selects the server default. `getPatternsAt` also takes `alsoConstraining: FacetSet`; pass `undefined` as the moment to keep "now". The derived `Day` and `TimeBucket` override those keys in `alsoConstraining`.
|
|
27
|
-
- **Moment:** `{ instant: Date, offsetMinutes }`, minutes east of UTC, an integer from -840 to 840. Do not add the offset to the `Date` yourself; an invalid date or offset rejects with `RangeError` before any query.
|
|
27
|
+
- **Moment:** on a server the default is the server's clock and offset, not the user's; pass the user's local moment. Shape: `{ instant: Date, offsetMinutes }`, minutes east of UTC, an integer from -840 to 840. Do not add the offset to the `Date` yourself; an invalid date or offset rejects with `RangeError` before any query.
|
|
28
|
+
- **An added facet is not a filter:** in `getPatternsAt` and `getUsualActions` a pattern answers when everything it was established on, apart from its action, appears in the question. A pattern established only on the day and time bucket therefore still answers a question that also names `AggregateType`. Read `facets` to see what each row was established on, and keep only the actions the application offers in that situation before showing them.
|
|
28
29
|
- **Facets:** `FacetName` has `CommandType`, `InitiatorType`, `InitiatorId`, `OnBehalfOf`, `CausedByCommand`, `CorrelationRootId`, `AggregateType`, `Year`, `Month`, `Day`, `TimeBucket`. The kernel ignores facets it does not mine instead of returning nothing, so an unmined facet silently widens the answer. `{}` constrains nothing; empty values are dropped.
|
|
29
30
|
- **Time buckets** (start inclusive, end exclusive, at the moment's offset): `EarlyMorning` 05–08, `Morning` 08–11, `Midday` 11–14, `Afternoon` 14–17, `Evening` 17–22, `Night` 22–05. `toTimeBucket(moment)` and `toDayOfWeek(moment)` apply the same rule; days are the English names `Sunday`–`Saturday`.
|
|
30
31
|
- **Result:** each `BehaviorPattern` has `id`, `groupingKey`, `facets`, `confidence`, `support`, `occurrences` (bigint), `weight`, `specificity`, `firstSeen` and `lastSeen` (`Date` or `undefined`).
|
package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/upgrade-and-recovery.md
CHANGED
|
@@ -62,6 +62,20 @@ path on a copy of production data, not on an empty database.
|
|
|
62
62
|
Clients, their wire contract and stored data are unaffected by that alone.
|
|
63
63
|
- Do not land on 14.0.0 or 17.0.0. If your target is major 14 or 17, use
|
|
64
64
|
14.0.1 or 17.0.1; they are not stops you must make on the way past.
|
|
65
|
+
- Crossing 15 → 16 moves everything onto one port. The separate management
|
|
66
|
+
port (8080 by default) is gone: gRPC, the Workbench, the REST API, sign-in
|
|
67
|
+
and health are all on 35000, over TLS, so the Workbench is at
|
|
68
|
+
`https://<host>:35000`. Before starting the target:
|
|
69
|
+
- remove `managementPort` from the kernel configuration, `ManagementPort`
|
|
70
|
+
from client options, and the `workbench.tls` block (the top-level `tls`
|
|
71
|
+
certificate now serves the Workbench too);
|
|
72
|
+
- in an Aspire app host, replace `DefaultManagementPort` and the
|
|
73
|
+
`management` endpoint with the single `grpc` endpoint;
|
|
74
|
+
- repoint port mappings, ingress rules, probes and bookmarks from the
|
|
75
|
+
management port to 35000 and from `http` to `https`;
|
|
76
|
+
- give a production kernel a certificate. Only a development image
|
|
77
|
+
generates its own. Listeners, certificates and probes on the target are
|
|
78
|
+
in [network and TLS](network-and-tls.md).
|
|
65
79
|
- Compatibility runs one way and only within a major: the release gate checks
|
|
66
80
|
each kernel's wire contract against the first stable release of every
|
|
67
81
|
earlier minor of its major. It compares contracts; it does not run old
|
|
@@ -15,28 +15,29 @@ compatibility: A supported application client and access to the intended kernel.
|
|
|
15
15
|
- Choosing off the default path
|
|
16
16
|
- Checks
|
|
17
17
|
|
|
18
|
-
A projection
|
|
18
|
+
A projection maps events to a read model. The application declares it and reads the result; the Chronicle kernel runs it. A materialized projection keeps instances current in a sink; a passive projection computes an instance on read without storing it. Names in the language references are illustrative.
|
|
19
19
|
|
|
20
20
|
## When to use it
|
|
21
21
|
|
|
22
|
-
- **Projection**: the view can be stated as "this event sets, adds to, counts into or removes that".
|
|
22
|
+
- **Projection**: the view can be stated as "this event sets, adds to, counts into or removes that". The default for every read model.
|
|
23
23
|
- **Reducer** (`cratis-chronicle-reduce-state`): the next state needs code over the previous state that no projection operation expresses.
|
|
24
|
-
- **Passive projection**:
|
|
25
|
-
- **Graph projection**: the question
|
|
24
|
+
- **Passive projection**: one event source's state is wanted on demand and nothing is stored.
|
|
25
|
+
- **Graph projection**: the question traverses relationships instead of looking up a document.
|
|
26
26
|
|
|
27
27
|
A read model has exactly one builder: one projection or one reducer.
|
|
28
28
|
|
|
29
29
|
## How it behaves
|
|
30
30
|
|
|
31
|
-
- **Asynchronous and eventually consistent.**
|
|
31
|
+
- **Asynchronous and eventually consistent.** A successful append is never proof that the stored view shows the change. To read your own change, wait for observer completion on the append result and check its outcome, or watch for the expected change. Waiting does not make append and query atomic.
|
|
32
32
|
- **Ordered per key, retried on failure.** Events are handled in order within a partition. A failing event is retried and can be delivered again; when retries are exhausted the partition stops until it is attended to, and its instances lag.
|
|
33
33
|
- **Persisted (default).** Instances are materialized in a sink: the document sink (MongoDB) by default, the graph sink (Neo4j) for graphs. SQL and other named sinks are set up on the kernel; a read model opts in where its SDK allows.
|
|
34
34
|
- **Passive.** No sink. Each read replays the stream whose event source id equals the requested key. The result reflects revisions, redactions and erased personal data. Never combine passive with a redirected key, a join or events from other sources: the fold can miss the creation, and a join misses joined events appended later. A passive read is not a protected command decision.
|
|
35
35
|
- **Input is chosen by event type.** A projection receives every event of the types its mappings name, from every event source in its one selected sequence (the event log unless the SDK infers or you pick another; see your language reference); each event lands on the instance its key selects. Tags, event source type and stream type on an append do not narrow it: use a reducer or reactor when only a subset may count. Several event types can feed one model; a property an event does not carry is left unchanged.
|
|
36
36
|
- **Replay rebuilds from history.** The sequence is handled again from the start; the rebuilt state is incomplete until the replay finishes. Replay does not undo anything outside the sink.
|
|
37
|
+
- **Replay cannot supply a fact no event carries.** A new field needs a fact history holds; otherwise record it from now on and state the gap. Never fill it with a copy job or a sink write.
|
|
37
38
|
- **Identity.** The projection id is a deployed identity. Keep the previous id when renaming or moving a type; a new id is a new projection.
|
|
38
39
|
- **Registration.** Clients with automatic registration submit definitions on connect. A full set retires omitted projections only for the same owner and registrant, leaving sink data intact; a partial set retires none. Check for per-projection failures and verify catch-up separately.
|
|
39
|
-
- **Version guard.** Chronicle stores each definition with the registering client's software version and compares by semantic-version precedence. A registration older than the stored one is ignored (warning logged, Workbench recommendation); an equal, missing or unparseable version replaces it
|
|
40
|
+
- **Version guard.** Chronicle stores each definition with the registering client's software version and compares by semantic-version precedence. A registration older than the stored one is ignored (warning logged, Workbench recommendation); an equal, missing or unparseable version replaces it: identical versions give no protection. A version change never replays. Roll back by redeploying the old code under a higher version. Only the .NET client sends a version today (see its reference); other SDKs always replace.
|
|
40
41
|
- **Counters see events, not transitions.** A duplicate "added" or "closed" event drifts a counter and replay reproduces the drift. Refuse the non-transition in the producing command.
|
|
41
42
|
- **Joins consume events, not other read models.** An unmatched join creates nothing.
|
|
42
43
|
- **Graph writes are watermarked.** Each node and edge remembers the sequence number that last wrote it, so a redelivered event is skipped and an increment is not applied twice.
|
|
@@ -80,7 +81,7 @@ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Nod
|
|
|
80
81
|
| Operation | What it does / when |
|
|
81
82
|
|---|---|
|
|
82
83
|
| From | Create or update the instance from one event type. |
|
|
83
|
-
| Join | Copy values from an event of another event source, matched through a property of the read model that holds that source's id.
|
|
84
|
+
| Join | Copy values from an event of another event source, matched through a property of the read model that holds that source's id. On a root event each joined type also supplies its latest earlier event, not merged by time: one field per type ([join precedence](references/join-precedence.md)). |
|
|
84
85
|
| FromEvery | Apply a mapping on every event type the projection already handles (last changed, last sequence number). Can exclude child events. |
|
|
85
86
|
| FromAll | Subscribe to every type, including unrelated events that can create otherwise empty instances, keyed by event source id by default. Use for sequence-wide statistics. |
|
|
86
87
|
| FromAll with other mappings | An event with its own From mapping or a declared join applies the all-events mappings once, through that mapping and its key; an unmatched join still creates nothing. A child-only event applies them once to the parent; child events cannot be excluded (use FromEvery for that). |
|
|
@@ -174,8 +175,8 @@ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Nod
|
|
|
174
175
|
|
|
175
176
|
- **Fluent builder** when the read model is shared or cannot carry annotations, or the model-bound form in your SDK lacks a needed operation.
|
|
176
177
|
- **Key redirection** when one event source produces instances identified by something else; then the view must be persisted.
|
|
177
|
-
- **Join** for display data owned by another event source; keep
|
|
178
|
-
- **Dictionary entries** when each key needs only one value (a total, count or latest value) and the keys come from the events, e.g. per category or per user. **Children** when each item carries several fields
|
|
178
|
+
- **Join** for display data owned by another event source; keep each fact in its own property.
|
|
179
|
+
- **Dictionary entries** when each key needs only one value (a total, count or latest value) and the keys come from the events, e.g. per category or per user. **Children** when each item carries several fields, needs ordering or joins, or is listed as items. **Nested** for one optional object; **variants** when the shape, not just a status, changes by stage.
|
|
179
180
|
- **Reducer** when the mapping needs code.
|
|
180
181
|
|
|
181
182
|
## Checks
|
|
@@ -185,6 +186,6 @@ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Nod
|
|
|
185
186
|
- A join needs a matching key value, not matching property names.
|
|
186
187
|
- Each child appears only under its intended parent, and removal takes only that child.
|
|
187
188
|
- Counters equal the authoritative history after replay.
|
|
188
|
-
- A stored view may lag; a passive read
|
|
189
|
+
- A stored view may lag; a passive read does not prove it current.
|
|
189
190
|
|
|
190
191
|
Specify projections with the read-model scenario taught by `cratis-specifications-exercise-backend`.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Join precedence
|
|
2
|
+
|
|
3
|
+
Read this when a read model takes one value from two joined event types (such as registered and renamed), when a `From` mapping and a join write the same property, or when a joined value is stale after a reassignment. It holds for every SDK and for the declaration language.
|
|
4
|
+
|
|
5
|
+
## What the engine does
|
|
6
|
+
|
|
7
|
+
- A joined event that arrives updates every instance whose `on` property holds its key. It creates nothing.
|
|
8
|
+
- When a root (`From`) event is handled, Chronicle looks up, for each joined event type separately, the latest stored event of that type before the root event, and applies its mappings. This backfill is what lets a new relationship pick up data that is already in the joined stream.
|
|
9
|
+
- The joined types are resolved one by one. They are not merged into one chronological stream, so when two types write one property the result follows the order the joins are resolved in, not which fact is newer.
|
|
10
|
+
- Joined mappings run after the `From` mappings of the same event. A `From` mapping cannot clear a value the backfill reapplies, and no operation clears a joined value.
|
|
11
|
+
- The backfill looks the joined event up by event source id, also when the join matches by an event property. Append the root before such a joined event.
|
|
12
|
+
|
|
13
|
+
## Default: one field per joined type
|
|
14
|
+
|
|
15
|
+
When two joined types describe one value, map each to its own property and resolve the value to show by precedence, in the query or on the screen.
|
|
16
|
+
|
|
17
|
+
| Joined event | Writes |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| Registered, carrying the name | `registeredName` |
|
|
20
|
+
| Renamed, carrying the new name | `currentName` |
|
|
21
|
+
|
|
22
|
+
Show `currentName` when it has a value, else `registeredName`.
|
|
23
|
+
|
|
24
|
+
When the question is which of two facts happened last, store when each occurred in its own property and compare them. Never infer it from arrival order.
|
|
25
|
+
|
|
26
|
+
## Avoid
|
|
27
|
+
|
|
28
|
+
- Two joins writing one property. A reassignment backfills both types, and the older name can overwrite the newer one.
|
|
29
|
+
- A `From` mapping and a join writing the same property (the C# analyzer reports `CHR0042`).
|
|
30
|
+
- A `From` mapping meant to reset a joined value.
|
|
31
|
+
|
|
32
|
+
## Specify
|
|
33
|
+
|
|
34
|
+
Use two keys and cover both orders:
|
|
35
|
+
|
|
36
|
+
- Rename after assign: the joined event arrives when the instance exists.
|
|
37
|
+
- Assign after rename: the root event arrives when both joined events are already stored.
|
|
38
|
+
- Reassign to another key whose joined source was renamed earlier.
|
|
@@ -138,7 +138,7 @@ export class OrderDetails {
|
|
|
138
138
|
}
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
- `@join(Event, on, eventPropertyName)`: `on` names the model field holding the other source's id; the joined event matches by its event source id. For child enrichment use the fluent child join below, not `@join` on a child property. A join never creates an instance.
|
|
141
|
+
- `@join(Event, on, eventPropertyName)`: `on` names the model field holding the other source's id; the joined event matches by its event source id. For child enrichment use the fluent child join below, not `@join` on a child property. A join never creates an instance. Two joined event types need a field each: see [join precedence](join-precedence.md).
|
|
142
142
|
- `@childrenFrom(Event, options)`: `key` (event field identifying the child, default event source id), `identifiedBy` (child field holding the identity), `parentKey` (event field selecting the parent), `prepend`, `orderBy`, `orderByDescending`, `childType`. Default: append. Choose one ordering per collection; ordering affects insertion, not later updates. Declare the element type with `@field(Array, { genericArguments: [Child] })`.
|
|
143
143
|
- `@nested` marks one optional object; its class carries `@fromEvent` and `@clearWith`.
|
|
144
144
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
Names are illustrative. Inject the model into the validator for refusals or `Handle` to build the event. Both are protected under `On`.
|
|
16
16
|
|
|
17
|
-
1.
|
|
17
|
+
1. The ASP.NET Core host references the `Cratis` package, which brings Arc with its Chronicle integration (`Cratis.Arc.Chronicle`) and that package's build props; host setup is in `cratis-arc-host-application`. Put the command and validator together in `Features/Trips/Reservations/`. Use `TripId` as the command's only event-source-ID property: it selects both the trip to read and the trip to append to.
|
|
18
18
|
2. Share the source ID and event declarations across commands for the same trip. Request `TripCapacity?` in the validator constructor. For a trip with no events the validator receives `null` or an instance with `Available` 0; the rule refuses both.
|
|
19
19
|
3. Leave `CratisReadProtection` unset: the `Cratis.Arc.Chronicle` build props default it to `On`. Without those props do not assume the default. Check with `dotnet msbuild -getProperty:CratisReadProtection`. In deployment, leave `Cratis__Arc__ReadProtection__MaximumMode` unset or set it to `On`; don't lower the maximum when competing writes must be refused.
|
|
20
20
|
|
|
@@ -139,6 +139,7 @@ The failures below are code defects, not competing writes. Most are raised under
|
|
|
139
139
|
| `ReadModelStreamNotOnCommandRoute` | A per-stream model parameter whose declared source or stream is not the command's route, or the command has no explicit stream ID. Refused in every mode, not only `On` | Route the command to the model's source and stream with an explicit stream ID, or read another stream explicitly through `IDecisionReads` directly in `Handle`, with a reasoned `ARCCHR0040` suppression as described under the lookup keys above |
|
|
140
140
|
| `ConcurrentNestedCommandsUnderReadProtection` | A nested command started while another nested command of the same outer command was still running, and one of the commands involved has read protection `On` | Await nested commands one after another |
|
|
141
141
|
| `NestedEarlyCompletionUnderReadProtection` | A nested command committed the outer command's unit (an aggregate `Commit()`) | Commit in the outer command |
|
|
142
|
+
| `DiscoverableValidatorRefusedInProtectedDecision` | Outside `On`, a `[ProtectedDecision]` command has a discoverable validator without exactly one public parameterless constructor and certified construction is not set up. Under `On`, Arc did not construct the validator for this invocation: it has a scoped, singleton, factory or instance registration | Outside `On`, follow Validators outside On. Under `On`, let convention discovery register the validator as transient |
|
|
142
143
|
| `CommandCannotBeBothProtectedAndUnprotected` | `[ProtectedDecision]` and `[Unprotected]` on one command | Keep one |
|
|
143
144
|
| `ConflictingReadProtection` | `[ReadProtection]` with `On` or `Measure` and `[Unprotected]` on one command | Keep one |
|
|
144
145
|
| `ConflictingContributionsOnLabel`, `ConflictingExplicitScopes` | Two explicit or aggregate guards on one event source contradict each other: the same predicate with two expectations, or a no-check scope mixed with a checked one | Reconcile them into one expectation per predicate, or remove the no-check scope. Guards with distinct predicates may share a source; do not drop an independent guard |
|
|
@@ -154,6 +155,14 @@ The failures below are code defects, not competing writes. Most are raised under
|
|
|
154
155
|
|
|
155
156
|
## Validators outside On
|
|
156
157
|
|
|
157
|
-
Prefer `On` with convention-discovered transient validators
|
|
158
|
+
Prefer `On` with convention-discovered transient validators: there a validator takes a plain read-model parameter and no provider setup is needed.
|
|
159
|
+
|
|
160
|
+
Outside `On` (`Off` or `Measure`), a `[ProtectedDecision]` command by default runs a discoverable validator only when it has exactly one public parameterless constructor. A validator whose constructor takes anything, including a plain read model, `DecisionRead<T>` or a service, or that has more than one public constructor, is refused with `DiscoverableValidatorRefusedInProtectedDecision`. The plain model is not the cause and swapping it for another dependency does not help; a factory or instance registered for the validator, in the host or in a spec, does not change the refusal either. Choose in this order:
|
|
161
|
+
|
|
162
|
+
1. Keep the validator input-only (parameterless) and move the state check into `Handle` on a `DecisionRead<T>` parameter.
|
|
163
|
+
2. Move the command to `On` and take the plain model in the validator constructor.
|
|
164
|
+
3. Only when the validator itself must read state outside `On`, opt into certified construction, described next.
|
|
165
|
+
|
|
166
|
+
With certified construction the validator takes `DecisionRead<T>` or `IDecisionReads` rather than plain models or raw store readers. This opt-in path requires untrimmed JIT; it does not support trimmed JIT or NativeAOT. After `AddCratisArc`, install `Cratis.Arc.DependencyInjection.ProtectedDecisionServiceProviderFactory` as the host's actual DI factory; pass `ServiceProviderOptions` if you want provider validation because host defaults do not carry over. Execute in a native child scope or let the pipeline open one. An opaque or forwarding provider cannot prove ownership.
|
|
158
167
|
|
|
159
168
|
Arc constructs a fresh transient graph with one public constructor per type. Scoped or singleton collaborators, factory/instance registrations, keyed, optional and collection dependencies are refused. To configure rules, call `services.AddProtectedDecisionValidator<TValidator>(configure)` instead of supplying an application DI factory; Arc configures the actual fresh instance before it validates. Check the real host's Execute path: a passing advisory validation call alone does not prove acceptance or commitment.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cratis-chronicle-react-to-fact
|
|
3
|
-
description: Use when a service must act on an appended Chronicle fact, including replay-safe external effects and
|
|
3
|
+
description: Use when a service must act on an appended Chronicle fact, including replay-safe external effects, derived events, and deadline, timeout or expiry handling done as a sweep over a stored list of pending work when a scheduled fact arrives. Not for maintaining query state from facts (use cratis-chronicle-project-view) or for declaring such a process in a Screenplay model (use cratis-screenplay-model-automation).
|
|
4
4
|
compatibility: A supported application client and a registered event type.
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -89,6 +89,22 @@ Cratis has no saga or process-manager building block. Build a multi-step process
|
|
|
89
89
|
|
|
90
90
|
**No rollback across steps.** Each step commits on its own, and nothing spans a reactor's returned events and commands, several returned commands, or several steps. A failed step is redelivered, so first make each step safe to repeat and let a transient failure retry. Compensate only when the domain decides to reverse completed work: record that decision as a fact and issue a compensating command for each completed step it reverses. Chronicle does not prevent a duplicate compensation, so make each one safe to repeat. Keep the item on the work list until a completion or cancellation fact removes it. Never delete or redact events to undo a step.
|
|
91
91
|
|
|
92
|
+
**A step that committed before its handler failed.** Skipping replay is not exactly-once delivery: a handler that fails after its command committed is redelivered and executes the command again. If the command mints a new identity on each execution, the retry addresses a different event source, and a uniqueness constraint refuses it on every attempt, so the partition never recovers by retrying. Before retrying the partition, reconcile the entity the first attempt committed to the key of the triggering fact and persist that mapping. From then on the handler looks the identity up, or allocates it once per triggering key. Never drop the constraint, swallow the refusal, parse an outside key as the local identity or match entities by name.
|
|
93
|
+
|
|
92
94
|
**Order.** Each handler method sees its events in order within one event source. Two methods of the same reactor are not ordered relative to each other, even for the same event source: a batch method and a per-event method each keep only their own order. When two effects must happen in a set order, handle them in one method. Order does not hold across event sources or between observers: a reactor can handle a fact before a projection has stored it, and the reverse. When logic needs the facts of two entities in order, put them on one event source or carry the needed data on the later event. Limiting partition concurrency protects a downstream system; it does not create a global order. With several instances of a service connected, keep the kernel's default fan-out, which keeps each event source on one instance while the set of connected instances is unchanged. Scaling or a reconnect can move an event source to another instance, so do not hold per-source state in instance memory.
|
|
93
95
|
|
|
96
|
+
## Deadlines, timeouts and expiry
|
|
97
|
+
|
|
98
|
+
Time passing is not a fact, and a reactor never waits, sleeps or owns a timer. Do not build a saga, a process manager or a timer per item. Whether the work is a slice of its own is decided in `cratis-modeling-design-event-model`.
|
|
99
|
+
|
|
100
|
+
1. **Pending list.** Keep a stored (materialized) read model of the open work, holding each item's deadline so the due ones can be selected by it. The opening fact adds the item; every fact that closes the work removes it. A passive model is not this list: each read replays the events and nothing is stored or indexed.
|
|
101
|
+
2. **Scheduled fact.** The host's scheduler appends an application-owned clock fact that carries its time. Nothing runs until it is appended.
|
|
102
|
+
3. **Sweep.** A reactor handles the clock fact, selects the items due at the fact's time (never the wall clock) and issues one guarded command per candidate, passing that same time.
|
|
103
|
+
4. **The command decides again.** The list only nominates: it can lag, and a retried sweep meets items it already handled. A candidate that is gone or not yet due is refused as "nothing to do", and the sweep continues; any other refusal fails the handler.
|
|
104
|
+
5. **The expiry is a fact.** It removes the item, and the next step reacts to it.
|
|
105
|
+
|
|
106
|
+
Excluding the sweep from replay stops old clock facts from sweeping again. It does not make the sweep run once: initial catch-up and recovery of a failed partition still call it, which is why step 4 is required.
|
|
107
|
+
|
|
108
|
+
Worked sweep, the clock fact and result handling: `cratis-platform-deliver-slice` (Draining a to-do list and Time in its C# reference).
|
|
109
|
+
|
|
94
110
|
Read [provenance](references/provenance.md) when checking attribution.
|
|
@@ -32,6 +32,17 @@ if err != nil { return err }
|
|
|
32
32
|
|
|
33
33
|
Positions start at zero across the sequence. For another sequence use `seq, err := store.EventSequence(id)`. On error inspect the result **as well as** the error: `Committed` is durable even if a requested check was unsupported; `Rejected` with violations stored nothing. Use `errors.As` on `r.Err()` for `*eventsequences.ConstraintError` and `*eventsequences.ConcurrencyError` and retain `Errors` and both violation lists. A transport failure or `*eventsequences.OutcomeUnknownError` after dispatch is not a confirmed rejection: reconcile in the original history; do not blindly retry.
|
|
34
34
|
|
|
35
|
+
A consumer that must acknowledge, redeliver or dead-letter its input classifies each append in this order:
|
|
36
|
+
|
|
37
|
+
| Evidence | Outcome | Do |
|
|
38
|
+
| --- | --- | --- |
|
|
39
|
+
| `errors.As(err, &unknown)` on the returned error, with `unknown` a `*eventsequences.OutcomeUnknownError` | Sent; may be stored. Includes a call cancelled or timed out after dispatch | Reconcile by reading the history; never redeliver blindly |
|
|
40
|
+
| `r.Disposition == eventsequences.Committed` | Stored, whatever `err` says | Acknowledge |
|
|
41
|
+
| `r.Disposition == eventsequences.Rejected` | Refused; nothing stored | Dead-letter or report. Retry the unchanged append after a delay only when both violation lists are empty, `r.Errors` is non-empty and every entry is `eventsequences.ConstraintIndexUnavailable`. `errors.Is` alone is not enough: it also matches a result that carries a violation or another error |
|
|
42
|
+
| Any other non-nil error, such as `chronicle.ErrClosed`, `chronicle.ErrInvalidConfiguration`, `chronicle.ErrNotRegistered` or a context error | Refused locally before dispatch; nothing was sent | Redeliver freely for `ErrClosed` and a context error; fix the code for the other two |
|
|
43
|
+
|
|
44
|
+
Test the returned error for the first row, not `r.Disposition == eventsequences.Unknown` or `r.Err()`: the empty result of a local refusal also reads as unknown. Give each append a context that outlives the shutdown signal, bounded by its own deadline. An append context derived from the signal context is cancelled mid-call on shutdown and turns work that would have committed into unknown outcomes. Never treat every error alike: redelivering an unknown outcome can duplicate the event, and reconciling a write that was never sent wastes the recovery path.
|
|
45
|
+
|
|
35
46
|
## Declare and route
|
|
36
47
|
|
|
37
48
|
- Registration defaults to the Go type name and generation 1. Pass `events.WithID("dock-assigned")` only to keep a stored ID stable across a type rename, to resolve a name collision, or to match an ID another system publishes. Pass `events.WithGeneration(2)` with a migration for incompatible changes (`cratis-chronicle-evolve-event`). Use `events.WithTags("dispatch")` for type-level classification; `events.WithTombstone()` for a terminal fact, not erasure or a closure guard. Register the compensating type with `events.WithCompensationFor(assigned)`.
|
|
@@ -41,4 +41,11 @@ assert EnsureEventStoreRequest.FromString(want.SerializeToString()) == want
|
|
|
41
41
|
|
|
42
42
|
A round trip checks the contract without contacting a kernel. It does not show that a kernel accepted, stored or delivered anything.
|
|
43
43
|
|
|
44
|
-
Edge case, contributor diagnostics only: calling a kernel through a stub means supplying TLS trust, an OAuth client-credentials token and `authorization: Bearer` metadata on every call yourself, with no registration, retry or reconnect. Do that only against a disposable local kernel, never as an application path.
|
|
44
|
+
Edge case, contributor diagnostics only: calling a kernel through a stub means supplying TLS trust, an OAuth client-credentials token and `authorization: Bearer` metadata on every call yourself, with no registration, retry or reconnect. Do that only against a disposable local kernel, never as an application path. The token exchange is OAuth client credentials, not HTTP Basic:
|
|
45
|
+
|
|
46
|
+
- POST `grant_type=client_credentials`, `client_id` and `client_secret` form-encoded to `/connect/token` on the kernel's host and port. Never send the secret as a Basic header or on any other call.
|
|
47
|
+
- Read `access_token` and `expires_in` from the response; a missing `expires_in` means 3600 seconds.
|
|
48
|
+
- Attach the token as call metadata on each call; a token fixed into the channel's headers expires with the channel still open.
|
|
49
|
+
- Renew 60 seconds before expiry. When a renewal fails, keep using the cached token while it is still valid and wait a few seconds before trying again.
|
|
50
|
+
- When a unary call returns `UNAUTHENTICATED`, fetch a new token at once and retry that call exactly once.
|
|
51
|
+
- Never log the token or the connection string.
|
|
@@ -239,6 +239,11 @@ language reference.
|
|
|
239
239
|
- View models are plain classes with no UI-framework hooks
|
|
240
240
|
(`cratis-arc-react-separate-view-model`).
|
|
241
241
|
- Commands and queries are called through generated proxies.
|
|
242
|
+
- A contract change is reviewed as: regenerate the proxies, then type-check
|
|
243
|
+
the frontend. The slice layout is a convention: it does not enforce
|
|
244
|
+
dependency boundaries and does not wire host or provider setup, routes or
|
|
245
|
+
composition, so review those explicitly. A type several slices share is
|
|
246
|
+
declared once, at the feature root or another shared location, never copied.
|
|
242
247
|
|
|
243
248
|
### Performance, in passing
|
|
244
249
|
|
|
@@ -74,7 +74,7 @@ A callback that throws or rejects stops the chain: no later callback, no field m
|
|
|
74
74
|
- Failure or a refused confirmation never closes. A close veto does not undo a successful command.
|
|
75
75
|
- Without `useDialog` nothing closes itself: render the dialog conditionally and hide it from `onSuccess` and `onCancel`.
|
|
76
76
|
|
|
77
|
-
**Steps.** Each element child of a stepper is one step: use one `StepperPanel` per step with a distinct `header`, and put each bound property on exactly one step. Next is refused while the current step shows field errors; moving back is always allowed. `StepperCommandDialog` closes like `CommandDialog`; `CommandStepper` stays in place after success, so navigate or reset from `onSuccess
|
|
77
|
+
**Steps.** Each element child of a stepper is one step: use one `StepperPanel` per step with a distinct `header`, and put each bound property on exactly one step. Next is refused while the current step shows field errors; moving back is always allowed. `StepperCommandDialog` closes like `CommandDialog`; `CommandStepper` stays in place after success, so navigate or reset from `onSuccess`; it has no Cancel button or `onCancel`, so the page supplies the way out. Both use the same transform, confirmation and callback sequence. Keep the built-in navigation and relabel it. Step rules, Submit visibility and styling attributes: see Several steps in your language reference.
|
|
78
78
|
|
|
79
79
|
**Binding.** Fields bind wherever they render inside the form, including inside layout elements and custom components. A field binds one top-level property: a nested accessor binds its first member, and `fieldName` is a literal property name for a computed accessor. Edit an object-valued property with one custom field (see Nested data in your language reference). Server validation results map to fields by member name; results no field claims go to the summary.
|
|
80
80
|
|
package/package/corpus/skills/cratis-components-submit-form/references/typescript-commanddialog.md
CHANGED
|
@@ -106,6 +106,7 @@ Step rules:
|
|
|
106
106
|
- Moving back is always allowed. With `linear` (the default) headers are not clickable. `onChangeStep` reports an accepted move.
|
|
107
107
|
- `StepperCommandDialog` hides Submit until the last step and a valid form, and offers no footer Cancel unless `showCancel` is set.
|
|
108
108
|
- `CommandStepper` shows Submit on the last step, disabled while the form is invalid or busy, or while any step shows field errors. While `onBeforeExecute`, confirmation or the command is pending, Next and Submit are disabled and Submit shows a spinner; Previous stays enabled. `isBusy` is for work the page owns: it disables Previous, Next and Submit and sets `data-busy` on the stepper parts. It does not disable step headers (clickable with `linear={false}`) or the fields, and shows no spinner. To lock the fields during host work, disable them yourself, for example with a `<fieldset disabled>` around the fields inside each panel. On `CommandStepper`, `showNavigation={false}` hides the whole built-in footer, Submit included, and `showSubmit={false}` hides only Submit; labels fall back to the provider's stepper messages.
|
|
109
|
+
- `CommandStepper` has no Cancel button and no `onCancel`. Default: put a cancel or back action on the surrounding page and navigate away or remove the wizard. Choose `StepperCommandDialog` only when the task needs dismissal in place. Leaving the page does not abort a command that has already started. Avoid reloading the page to clear the wizard, and turning an inline wizard into a dialog only to get Cancel.
|
|
109
110
|
|
|
110
111
|
## Stepper layout and styling
|
|
111
112
|
|
|
@@ -188,6 +188,9 @@ its SDK does not support.
|
|
|
188
188
|
authorization) to an outcome event, or acknowledge it, instead of failing the partition. C# only.
|
|
189
189
|
- Once-only — exclude a reactor from replay when its effect must not repeat on rebuild; it does not
|
|
190
190
|
prevent redelivery after a failure, so the follow-up must still be idempotent.
|
|
191
|
+
- Translation — the translator executes the same command the screen uses, never an import-specific twin.
|
|
192
|
+
The adapter records each outside message once, by the sender's message identity. C# has a keyed append
|
|
193
|
+
for this; see Translation in the C# language reference. In another SDK the adapter keeps that record.
|
|
191
194
|
- Received facts — react to facts published by another event store through the local inbox
|
|
192
195
|
(`cratis-chronicle-publish-contract`).
|
|
193
196
|
- Outside input — a job, import or webhook that executes an existing command
|
|
@@ -314,15 +314,21 @@ public class VehicleImportFailed() : Exception("Vehicle registration failed.");
|
|
|
314
314
|
the other system's names and codes: the event type carries them and the translator interprets them.
|
|
315
315
|
- Filter, map, execute the local command, and throw when the result is not successful: a refused import
|
|
316
316
|
must stay visible, not be acknowledged as done.
|
|
317
|
+
- Execute the same command the screen and the API use. Never add an import-specific twin: the command
|
|
318
|
+
knows nothing about the other system, so its rules hold for every caller.
|
|
317
319
|
- Nothing else consumes the outside event. Read models project the application's own events, here the one
|
|
318
320
|
`RegisterVehicle` produces.
|
|
319
321
|
- Declaring the event type connects nothing. An adapter in the host (a webhook or a broker consumer)
|
|
320
|
-
receives the message, validates sender and payload, appends the outside event under a stable event
|
|
321
|
-
source id
|
|
322
|
+
receives the message, validates sender and payload, and appends the outside event under a stable event
|
|
323
|
+
source id with a keyed append (`AppendOnce`), the key derived from the sender's message identity and never from personal data. It
|
|
324
|
+
acknowledges upstream only after a confirmed append or a matching repeat; a key conflict is a different
|
|
325
|
+
message under the same key and is never acknowledged as done. Keyed appends and their results:
|
|
326
|
+
`cratis-chronicle-record-event`.
|
|
322
327
|
- A retry after a failure executes the command again. If the command creates a new identity on each
|
|
323
328
|
execution, the retry creates a second entity or is refused by a uniqueness constraint. Keep a durable
|
|
324
329
|
mapping from the outside key to the local identity, and decide what a repeated message means. Never
|
|
325
|
-
parse an outside key as the local identity or treat equal names as the same entity.
|
|
330
|
+
parse an outside key as the local identity or treat equal names as the same entity. Recovering a
|
|
331
|
+
partition stuck on such a retry: `cratis-chronicle-react-to-fact`.
|
|
326
332
|
|
|
327
333
|
## Specifications
|
|
328
334
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cratis-platform-start-application
|
|
3
|
-
description: Use when creating a new Cratis application
|
|
3
|
+
description: Use when creating a new Cratis application from a template (`cratis new`, or `dotnet new` from `Cratis.Templates`) and running the scaffold locally for the first time - choosing the template (full-stack web application, single-application Aspire app host, Chronicle console or web host), choosing its database (MongoDB, PostgreSQL, SQL Server, SQLite) and what that means for how the backend reads data, and the create and run commands. Not for a Stage-rendered app (use cratis-stage-render-slice), manual backend setup without a template (use cratis-arc-host-application), several services under one Aspire or Compose setup (use cratis-multi-service-local-orchestration), connecting the read store of an existing backend (use cratis-arc-connect-storage), or checking an existing host's Chronicle binding (use cratis-platform-configure-environment).
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Start a new Cratis application from a template
|