@cratis/pi 7.149.0 → 7.150.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.
@@ -47,8 +47,8 @@ probe=${probe//[\'\"\\]/}
47
47
  probe_lower="$(printf '%s' "$probe" | tr '[:upper:]' '[:lower:]')" || parser_failed
48
48
  case "$probe_lower" in
49
49
  *kubectl*|*printenv*|*env*|*docker*|*podman*|*"gh "*|*vault*|*pulumi*|*show-secret*|*aws*|*"az "*|*gcloud*|*kubeconfig*|*.kube*|\
50
- *sh*|*extglob*|*set*|*emulate*|*'-o'*|*'+o'*|*globignore*|*export*|*declare*|*id_rsa*|*id_ed25519*|*id_ecdsa*|*id_dsa*|*.pem*|*.p12*|*.pfx*|*token*|*.netrc*|*.npmrc*|\
51
- *credentials*|*.pgpass*|*pypirc*|*secrets*|*oc*) ;;
50
+ *sh*|*extglob*|*set*|*emulate*|*'-o'*|*'+o'*|*globignore*|*export*|*declare*|*id_rsa*|*id_ed25519*|*id_ecdsa*|*id_dsa*|*.pem*|*.key*|*.p12*|*.pfx*|*.jks*|*.kdbx*|*token*|*.netrc*|*.npmrc*|\
51
+ *credential*|*.pgpass*|*pypirc*|*secrets*|*oc*) ;;
52
52
  *)
53
53
  case "$command_text" in
54
54
  *'$'*|*'*'*|*'?'*|*'['*|*'{'*|*'('*|*'^'*|*'~'*|*'`'*) ;;
@@ -110,19 +110,31 @@ function ansi_c(s, i, n, c, c2, v, d, k, lim, stop, digits) {
110
110
  # or operands (`kubectl get > /dev/stdout secrets`). Nothing is exempted: the command itself is still analyzed.
111
111
  # A word is a redirection only when its whole operator lies in the word's unquoted prefix (WP: characters before
112
112
  # the first quoted or escaped one), so `1">"b` and `">x"` stay operands; input redirections (`< file`) stay too.
113
- function stem_boundary(t, start, finish, stem, a, b, before, after, left, right, component) {
113
+ function stem_boundary(t, start, finish, stem, nonliteral, a, b, before, after, left, right, component, literal) {
114
+ # Raw text of an expanding word is judged after expansion: braces and parameters are resolved
115
+ # alternatives scanned separately; only unresolved globs and expansion markers stay non-literal.
116
+ if (nonliteral == "expanding") literal = t !~ /[][?*()`~^\001-\007]/
117
+ else literal = !nonliteral && t !~ /[][?*{}()$`~^\001-\007]/
114
118
  if (stem == "/environ" && substr(t, finish + 1, 1) ~ /[a-z0-9_]/) return 0
115
- if (stem !~ /^(id_rsa|id_ed25519|id_ecdsa|id_dsa|kubeconfig|credentials)$/) return 1
119
+ if (stem ~ /^\.(key|jks|keystore|kdbx)$/) {
120
+ if (substr(t, finish + 1, 1) ~ /[a-z0-9_-]/) return 0
121
+ # Ambiguous key words are credential extensions only at the end of a literal filename.
122
+ if (literal && t !~ /\.(key|jks|keystore|kdbx)[.]*$/) return 0
123
+ }
124
+ if (stem !~ /^(id_rsa|id_ed25519|id_ecdsa|id_dsa|kubeconfig|credentials?)$/) return 1
116
125
  a = start; b = finish
117
126
  while (a > 1 && substr(t, a - 1, 1) ~ /[a-z0-9_]/) a--
118
127
  while (b < length(t) && substr(t, b + 1, 1) ~ /[a-z0-9_]/) b++
119
- if (stem == "credentials") {
128
+ if (stem ~ /^credentials?$/) {
120
129
  left = a; right = b
121
- while (left > 1 && substr(t, left - 1, 1) ~ /[a-z0-9_.-]/) left--
122
- while (right < length(t) && substr(t, right + 1, 1) ~ /[a-z0-9_.-]/) right++
130
+ while (left > 1 && substr(t, left - 1, 1) != "/") left--
131
+ while (right < length(t) && substr(t, right + 1, 1) != "/") right++
123
132
  component = substr(t, left, right - left + 1)
124
- if (component !~ /^credentials([.]|$)/ && substr(t, right + 1, 1) == "/") return 0
125
- if (code_file(component) && component !~ /^credentials\./) return 0
133
+ if (literal && component !~ /^credentials([.]|$)/ && substr(t, right + 1, 1) == "/") return 0
134
+ # Never infer a source file from a partial component or an expansion. JSON is not source.
135
+ if (literal && code_file(component)) return 0
136
+ # The singular word is ordinary vocabulary; it marks a protected file only in credential JSON names.
137
+ if (stem == "credential" && literal && component !~ /credential[^\/]*\.json[.]*$/) return 0
126
138
  }
127
139
  before = substr(t, a - 1, 1); after = substr(t, b + 1)
128
140
  return !(before == "$" || before == "-" || (before == "{" && substr(t, a - 2, 1) == "$") || after ~ /^(=|\+=)/)
@@ -166,13 +178,13 @@ function stem_units(t, m, start, stem) {
166
178
  delete SM
167
179
  return stem_match(t, stem, start, 1, 0, 0)
168
180
  }
169
- function stem_scan(text, mode, t, k, stem, pos, offset, first, found, end, p, candidate) {
181
+ function stem_scan(text, mode, nonliteral, t, k, stem, pos, offset, first, found, end, p, candidate) {
170
182
  t = tolower(text)
171
183
  for (k = 1; k <= nstem; k++) {
172
184
  stem = STEM[k]; offset = 0
173
185
  while ((pos = index(substr(t, offset + 1), stem)) > 0) {
174
186
  pos += offset; end = pos + length(stem) - 1
175
- if (stem_boundary(t, pos, end, stem) && (!first || pos < first)) { first = pos; found = stem; break }
187
+ if (stem_boundary(t, pos, end, stem, nonliteral) && (!first || pos < first)) { first = pos; found = stem; break }
176
188
  offset = pos
177
189
  }
178
190
  if (stem == ".kube/") {
@@ -187,7 +199,7 @@ function stem_scan(text, mode, t, k, stem, pos, offset, first, found, end, p,
187
199
  stem = STEM[k]
188
200
  if (candidate != substr(stem, 1, 1) && candidate !~ /[*?[(@+!~^]/) continue
189
201
  end = stem_units(t, mode, p, stem)
190
- if (end && stem_boundary(t, p, end, stem)) { first = p; found = stem; break }
202
+ if (end && stem_boundary(t, p, end, stem, nonliteral)) { first = p; found = stem; break }
191
203
  }
192
204
  }
193
205
  }
@@ -349,7 +361,7 @@ function end_cmd( k, m, w, j, hit) {
349
361
  if (is_assign(W[k])) set_var(W[k], WM[k])
350
362
  if ((k in RP) && RP[k] < 0) continue
351
363
  w = (k in RP) ? substr(W[k], 1, RP[k]) : W[k]
352
- hit = stem_scan(w, "raw"); if (TAINT == "") TAINT = hit
364
+ hit = stem_scan(w, "raw", expands(w, WM[k]) ? "expanding" : 0); if (TAINT == "") TAINT = hit
353
365
  if (!(k in RP) && expands(W[k], WM[k])) {
354
366
  resolve(W[k], WM[k])
355
367
  for (j = 1; j <= nalt; j++) { hit = stem_scan(ALT[j], "resolved"); if (TAINT == "") TAINT = hit }
@@ -610,11 +622,13 @@ function sensitive_path(w, l, b) {
610
622
  l = tolower(w); b = l; sub(/.*\//, "", b)
611
623
  if (l ~ /(^|\/)\.kube\// || b == "kubeconfig" || b ~ /\.kubeconfig$/) return "a kubeconfig"
612
624
  if (b ~ /^\.env/ || b ~ /\.env$/) { if (b ~ /\.(example|sample|template|dist|defaults?)$/) return ""; return "an .env file" }
613
- if (b ~ /\.(pem|p12|pfx)$/) return "a key or certificate file"
625
+ # Unambiguous credential extensions also protect disguised source suffixes; ambiguous words
626
+ # such as Signing.Key.cs are source unless the credential extension is final.
627
+ if (b ~ /\.(pem|p12|pfx)([.]|$)/ || b ~ /\.(key|jks|keystore|kdbx)[.]*$/) return "a key or certificate file"
614
628
  if (b == "id_rsa" || b == "id_ed25519" || b == "id_ecdsa" || b == "id_dsa") return "a private key"
615
629
  if (b ~ /(^|[._-])tokens?($|[._-])/ && !code_file(b) && !token_ok(l, b)) return "a token file"
616
630
  if (b == ".netrc" || b == ".npmrc" || b == ".pgpass" || b == ".pypirc" || b == ".git-credentials") return "a credentials file"
617
- if (b == "credentials" || b == "credentials.json") return "a credentials file"
631
+ if (b == "credentials" || b ~ /credential.*\.json[.]*$/) return "a credentials file"
618
632
  if (l ~ /\.docker\/config\.json$/) return "the Docker registry credentials"
619
633
  if (l ~ /\/proc\/[^\/]*\/environ$/) return "a process environment"
620
634
  if (l ~ /^\/(var\/)?run\/secrets\//) return "mounted secrets"
@@ -1414,7 +1428,7 @@ BEGIN {
1414
1428
  nprobe2 = split(".kube/config .aws/credentials .docker/config.json /proc/1/environ /run/secrets/token /var/run/secrets/token", PROBE2, " ")
1415
1429
  nextension = split("pem key p12 pfx jks keystore kdbx kubeconfig env", EXT, " ")
1416
1430
  ndispatch = split("cat tac nl less more head tail bat batcat strings xxd od hexdump cut sort uniq base64 wc dd cp mv ln rsync scp tar zip shopt set setopt unsetopt emulate grep egrep fgrep rg ag sed awk gawk jq yq kubectl oc docker podman docker-compose gh vault aws az gcloud pulumi cratis printenv export declare typeset env bash sh zsh dash ksh eval", DN, " ")
1417
- nstem = split(".env .pem .p12 .pfx id_rsa id_ed25519 id_ecdsa id_dsa .netrc .npmrc .pgpass .pypirc .git-credentials .kube/ kubeconfig credentials .docker/ /environ run/secrets", STEM, " ")
1431
+ nstem = split(".env .pem .key .p12 .pfx .jks .keystore .kdbx id_rsa id_ed25519 id_ecdsa id_dsa .netrc .npmrc .pgpass .pypirc .git-credentials .kube/ kubeconfig credentials credential .docker/ /environ run/secrets", STEM, " ")
1418
1432
  CMD = ENVIRON["GS_COMMAND"]
1419
1433
  for (pass = 1; pass <= 2; pass++) {
1420
1434
  delete queue; queued = 0; qi = 0; delete seen; reports = ""
@@ -76,6 +76,7 @@
76
76
  "cratis-arc-command-execution",
77
77
  "cratis-arc-command-operation",
78
78
  "cratis-arc-command-validation",
79
+ "cratis-arc-configuration",
79
80
  "cratis-arc-ef-core-migration",
80
81
  "cratis-arc-hosting",
81
82
  "cratis-arc-neo4j",
@@ -298,6 +299,7 @@
298
299
  "cratis-chronicle-cli-operations",
299
300
  "cratis-chronicle-client-dotnet",
300
301
  "cratis-chronicle-compliance",
302
+ "cratis-chronicle-configuration",
301
303
  "cratis-chronicle-decision-reads",
302
304
  "cratis-chronicle-event-constraints",
303
305
  "cratis-chronicle-event-modeling",
@@ -4,6 +4,8 @@
4
4
 
5
5
  - Wiring
6
6
  - MSBuild properties
7
+ - Route settings must match the host and the frontend
8
+ - Skipping generation
7
9
  - What the generator extracts for client-side validation
8
10
  - Failure modes
9
11
  - Blocking severity
@@ -82,6 +84,32 @@ inserted without configuration.
82
84
  Item groups the target also forwards: `AssemblyToPackageMapping`,
83
85
  `ExcludeType`, `ExcludeNamespace`, `NamespaceRoot`, and `TypeToTsType`.
84
86
 
87
+ ## Route settings must match the host and the frontend
88
+
89
+ The route properties (`CratisProxiesApiPrefix`, `CratisProxiesSegmentsToSkip`,
90
+ `CratisProxiesSkipCommandNameInRoute`, `CratisProxiesSkipQueryNameInRoute`) shape
91
+ the URLs written into the generated client. The host maps endpoints from
92
+ `Cratis:Arc:GeneratedApis` (`RoutePrefix` default `api`, `SegmentsToSkipForRoute`
93
+ default `0`, `IncludeCommandNameInRoute` and `IncludeQueryNameInRoute` default
94
+ `true`). The skip properties and the include keys are inverses. Arc does not
95
+ compare them: a mismatch is a 404 with no build error. Change both in one
96
+ commit.
97
+
98
+ On the frontend, the generated route already starts with the API prefix.
99
+ `<Arc apiBasePath>` is only an extra deployment prefix (`/workbench` plus
100
+ `/api/orders` is `/workbench/api/orders`); never repeat `/api` there, and
101
+ `basePath` does nothing. See `cratis-arc-configuration` for the full list.
102
+
103
+ ## Skipping generation
104
+
105
+ The package has no `DisableProxyGenerator` property. MSBuild accepts unknown
106
+ `-p:` names silently, so passing it looks effective and does nothing. The only
107
+ gate is `CratisProxiesOutputPath`: leave it empty (for a build, pass
108
+ `-p:CratisProxiesOutputPath=`) and the `CratisProxyGenerator` target does not
109
+ run. A repository can define its own `DisableProxyGenerator` property and
110
+ condition its own targets on it, as the Chronicle kernel project does; that is
111
+ repository-local, not part of this package.
112
+
85
113
  ## What the generator extracts for client-side validation
86
114
 
87
115
  The generated command proxy carries the rules it could extract, so
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: cratis-arc-configuration
3
+ description: Use when choosing, changing or diagnosing C# Arc settings, defaults, ArcOptions, appsettings keys, read protection, MongoDB or EF Core keys, or React provider props. Not for command design, hosting setup or Chronicle kernel settings.
4
+ license: MIT
5
+ ---
6
+
7
+ <!-- Copyright (c) Cratis. All rights reserved. -->
8
+ <!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
9
+
10
+ # Configure Cratis Arc
11
+
12
+ Arc settings fail quietly: a route prefix that differs between the build and
13
+ the host returns 404 with no warning, a development-only default turns on
14
+ exception details or open discovery, and `AddCratis()` authenticates nobody
15
+ until a trust setting is flipped. Find the key, its default and the side that
16
+ owns it before changing code.
17
+
18
+ ## Where settings live
19
+
20
+ | Section | Read by | Holds |
21
+ | --- | --- | --- |
22
+ | `Cratis:Arc` | `AddCratisArc`, `AddCratis` | `ArcOptions`: core, commands, queries, routes, identity, tenancy |
23
+ | `Cratis:Chronicle` | `AddCratis`, `WithChronicle()` | Chronicle client options (see `cratis-chronicle-configuration`) |
24
+ | `Cratis:MongoDB` | `WithMongoDB()` | MongoDB connection and resilience |
25
+ | `Cratis:EntityFrameworkCore` | `WithEntityFrameworkCore()` | EF Core connection and discovery |
26
+ | `ReadProtection` (no `Cratis:` prefix) | Startup and run time | Read-protection ceiling and measuring |
27
+ | Build properties | Proxy generator package | `CratisProxies*` and `CratisReadProtection` |
28
+ | React `<Arc>` props | Frontend | `apiBasePath`, `origin`, query transport |
29
+
30
+ Environment variables replace `:` with `__`:
31
+ `Cratis:Arc:Tenancy:HttpHeader` is `Cratis__Arc__Tenancy__HttpHeader`; list
32
+ items take an index. Keys are case-insensitive. The `configureOptions` callback
33
+ passed to `AddCratisArc` runs after binding and wins over configuration.
34
+
35
+ ## Workflow
36
+
37
+ 1. Start from the symptom in [symptoms](references/symptoms.md) when there is
38
+ an error or odd behavior; it names the setting.
39
+ 2. Look up the key in [Arc options](references/arc-options.md), or the
40
+ MongoDB, EF Core and read-protection keys in
41
+ [data and protection keys](references/data-and-protection-keys.md).
42
+ 3. For the browser side, use [frontend and routes](references/frontend-and-routes.md),
43
+ which also covers the settings that must match between build and host.
44
+ 4. Change one setting and restart; reproduce the symptom.
45
+
46
+ ## Rules that prevent the common mistakes
47
+
48
+ - **Never state a default from memory.** Read the reference; for a key that is
49
+ not listed, read the options type.
50
+ - **Route settings exist twice**: as MSBuild properties for the generator and
51
+ as `GeneratedApis` keys for the host. Arc does not compare them; a mismatch
52
+ is a 404. Change both in one commit. The skip and include forms are
53
+ inverses.
54
+ - **`ExposeExceptionDetails` defaults from `ASPNETCORE_ENVIRONMENT` alone.**
55
+ `DOTNET_ENVIRONMENT=Development` does not turn it on. Leave it off in
56
+ production.
57
+ - **Discovery (introspection) is anonymous only in Development.** Outside
58
+ Development it needs a signed-in user unless `Introspection:Roles` narrows it
59
+ or `Introspection:Enabled` / `IdentityDiscovery` is `false`. Do not switch a
60
+ deployed host to Development to restore access.
61
+ - **`AddCratis()` authenticates nobody** until `TrustForwardedIdentityHeaders`
62
+ is `true`, and that is correct only when every request passes through an
63
+ ingress that authenticates callers and replaces the identity headers.
64
+ - **`ReadProtection` keys are root-level.** `Cratis:Arc:ReadProtection:*` has no
65
+ effect. The protection mode itself is the `CratisReadProtection` build
66
+ property, not configuration.
67
+ - **Do not put connection strings or credentials in committed appsettings.**
68
+ Use secret configuration or environment variables.
69
+ - Do not change a setting on a shared or deployed environment without stating
70
+ the change and its blast radius first.
71
+
72
+ ## References
73
+
74
+ - Read [Arc options](references/arc-options.md) for `Cratis:Arc` keys,
75
+ defaults and when to change them.
76
+ - Read [data and protection keys](references/data-and-protection-keys.md) for
77
+ `Cratis:MongoDB`, `Cratis:EntityFrameworkCore` and `ReadProtection`.
78
+ - Read [frontend and routes](references/frontend-and-routes.md) for React
79
+ provider props and the generator-versus-host route settings.
80
+ - Read [symptoms](references/symptoms.md) when starting from an error.
81
+
82
+ ## Related skills
83
+
84
+ - Use `cratis-arc-command` for the proxy generator build package and its
85
+ properties.
86
+ - Use `cratis-arc-authentication-authorization-and-identity` for identity
87
+ design.
88
+ - Use `cratis-arc-hosting` for creating the host.
89
+ - Use `cratis-chronicle-configuration` for Chronicle client and kernel settings.
@@ -0,0 +1,93 @@
1
+ # Arc options
2
+
3
+ ## Contents
4
+
5
+ - Core
6
+ - Commands and queries
7
+ - Routes
8
+ - Identity, tenancy and discovery
9
+ - Settings that are code-only
10
+ - Names to prefer
11
+
12
+ All keys are under `Cratis:Arc`.
13
+
14
+ ## Core
15
+
16
+ | Key | Default | Change it when |
17
+ | --- | --- | --- |
18
+ | `ExposeExceptionDetails` | `true` only when `ASPNETCORE_ENVIRONMENT` is `Development`, otherwise `false` | Diagnosing a deployed failure briefly; leave `false` in production. Read once at process start. |
19
+ | `CorrelationId:HttpHeader` | `X-Correlation-ID` | A gateway uses another correlation header. |
20
+ | `Calendar:TimeZone` | `UTC` | The application calendar follows a local zone. Use an IANA id; an unknown id stops the host. |
21
+ | `Hosting:ApplicationUrl` | `http://+:5001/` | Arc.Core host only. The default binds every interface; use `http://localhost:5001/` for local-only. |
22
+ | `IdentityDetailsProvider` | not set (discovered) | Discovery finds none or several providers. Code-only in practice. |
23
+
24
+ ## Commands and queries
25
+
26
+ | Key | Default | Change it when |
27
+ | --- | --- | --- |
28
+ | `Command:MaximumCallerAllowedSeverity` | `Warning` | Callers may allow a different severity through the severity header. |
29
+ | `Command:IgnoreCallerAllowedSeverity` | `false` | The caller header must be ignored entirely. |
30
+ | `Query:KeepAliveInterval` | 30 seconds | A proxy closes idle observable-query connections sooner. Zero or negative disables it. |
31
+ | `Query:AllowedWebSocketOrigins` | not set (accepts any origin) | Production: set to the front-end origins. |
32
+ | `QueryHealth:RequireAuthentication` | unset: anonymous in Development, authenticated elsewhere | Require sign-in in Development too. |
33
+ | `QueryHealth:Roles` | not set | Restrict the query-health feed to roles. |
34
+
35
+ `CommandOperationOptions.CompensationTimeout` (30 seconds) is not bound from
36
+ `Cratis:Arc`; set it with `services.Configure<CommandOperationOptions>(...)`.
37
+
38
+ ## Routes
39
+
40
+ | Key | Default | Must match build property |
41
+ | --- | --- | --- |
42
+ | `GeneratedApis:RoutePrefix` | `api` | `CratisProxiesApiPrefix` |
43
+ | `GeneratedApis:SegmentsToSkipForRoute` | `0` | `CratisProxiesSegmentsToSkip` |
44
+ | `GeneratedApis:IncludeCommandNameInRoute` | `true` | inverse of `CratisProxiesSkipCommandNameInRoute` |
45
+ | `GeneratedApis:IncludeQueryNameInRoute` | `true` | inverse of `CratisProxiesSkipQueryNameInRoute` |
46
+ | `GeneratedApis:EnableQueryHttpMethod` | `true` | Set `false` when infrastructure rejects the HTTP `QUERY` method. |
47
+ | `EndpointGroups:Ports`, `EndpointGroups:RoutePrefixes` | empty | Serve endpoint groups on separate ports or prefixes. |
48
+ | `EndpointGroups:ServeDefaultGroupOnGroupPorts` | `false` | The default group must also be reachable on group ports. |
49
+
50
+ ## Identity, tenancy and discovery
51
+
52
+ | Key | Default | Change it when |
53
+ | --- | --- | --- |
54
+ | `TrustForwardedIdentityHeaders` | `false` | Every request comes through an ingress that authenticates callers and replaces the `x-ms-client-principal*` headers. Until then `AddCratis()` leaves every request anonymous and logs a startup warning. |
55
+ | `Introspection:Enabled` | `true` | `false` on deployed hosts that need no catalogs. |
56
+ | `Introspection:IdentityDiscovery` | `true` | `false` when no user and tenant lists are needed. |
57
+ | `Introspection:RequireAuthentication` | unset: anonymous in Development, authenticated elsewhere | Leave unset unless you must change it. |
58
+ | `Introspection:Roles` | not set | Restrict discovery to roles. |
59
+ | `Tenancy:ResolverType` | `Header` | Tenant comes from a query parameter, claim, subdomain or fixed value. |
60
+ | `Tenancy:HttpHeader` | `x-cratis-tenant-id` | A gateway uses another tenant header. |
61
+ | `Tenancy:BaseDomain` | empty | Required for the `Subdomain` resolver. The `Host` header is caller-set, so validate it upstream. |
62
+ | `Tenancy:QueryParameter` | `tenantId` | Query resolver parameter name. |
63
+ | `Tenancy:ClaimType` | `tenant_id` | Claim resolver claim name. |
64
+ | `Tenancy:FixedTenantId` | `development` | Tenant for the `Fixed` and `Development` resolvers. |
65
+ | `Tenancy:IngressValidatesTenant` | `false` | A trusted ingress validates caller-to-tenant membership. It only silences a startup diagnostic. |
66
+ | `Tenancy:StrictValidatorMembership` | `false` | Recommended `true` for new applications. |
67
+ | `ConnectionResolution:*` | resolver `Default`, cache 5 minutes | Per-tenant database connections. The same tree exists under MongoDB and EF Core. |
68
+ | `OnBehalfOf:*`, `ForwardedIdentity:*` | `Enabled` is `false` | Signed assertions or forwarded identity are in use. |
69
+
70
+ Discovery access and query-health access check the host environment first
71
+ (`DOTNET_ENVIRONMENT` counts), then `ASPNETCORE_ENVIRONMENT` when no host
72
+ environment is registered. Introspection is anonymous only in Development;
73
+ outside Development it needs a signed-in user unless `Roles` narrows it or the
74
+ feature is off.
75
+
76
+ ## Settings that are code-only
77
+
78
+ These have no `Cratis:Arc` section; set them in code:
79
+ `CapabilitiesOptions` (`EndpointGroup` default `capabilities`, `GatedEndpoints`,
80
+ `AllowedPrincipalKinds`), MCP options through `WithMcp(...)` (`Path` default
81
+ `/mcp`, `Profile` default `PatOnly`, `MaxRequestBodySize` 1 MiB,
82
+ `ExclusiveTools` default `true`), `ProtectedReadModelKeyOptions.Strict` (default
83
+ `false`). Setting `ExclusiveTools` to `false` serves other registered tools with
84
+ no scope check.
85
+
86
+ ## Names to prefer
87
+
88
+ | Setting | Prefer | Also accepted |
89
+ | --- | --- | --- |
90
+ | Fixed tenant | `Tenancy:FixedTenantId` | `Tenancy:DevelopmentTenantId` (sets both) |
91
+ | Trust unsigned identity headers | `TrustForwardedIdentityHeaders` | `Introspection:TrustForwardedIdentityHeaders` (obsolete) |
92
+ | Register MongoDB | `WithMongoDB()` | `UseCratisMongoDB()`, `AddCratisMongoDB()`; register once |
93
+ | React base path | `apiBasePath` | `basePath` does nothing |
@@ -0,0 +1,52 @@
1
+ # Data and protection keys
2
+
3
+ ## Contents
4
+
5
+ - MongoDB
6
+ - EF Core
7
+ - Read protection
8
+
9
+ ## MongoDB
10
+
11
+ Section `Cratis:MongoDB`, read by `WithMongoDB()`.
12
+
13
+ | Key | Default | Change it when |
14
+ | --- | --- | --- |
15
+ | `Server` | none, required | Always. Keep credentials in secret configuration. Missing `Server` or `Database` fails host startup. |
16
+ | `Database` | none, required | Always. |
17
+ | `DirectConnection` | not set (the connection string's setting is kept) | Force or forbid a direct connection. |
18
+ | `EnableResilience` | `true` | Keep on for Cosmos DB and change streams opened before a collection exists; it treats "collection not found" as an empty result on async calls. |
19
+ | `LogCommandBodies` | `false` | Diagnosing only. Bodies can contain personal data; never in production. |
20
+ | `ConnectionResolution:*` | resolver `Default` | Per-tenant connections. |
21
+ | `Sinks:<name>:*` | none | Named sinks. |
22
+
23
+ ## EF Core
24
+
25
+ Section `Cratis:EntityFrameworkCore`, read by `WithEntityFrameworkCore()`.
26
+
27
+ | Key | Default | Change it when |
28
+ | --- | --- | --- |
29
+ | `ConnectionString` | empty | Always. While empty, Arc does not auto-discover `DbContext` types. |
30
+ | `AutoDiscoverDbContexts` | `true` | You register contexts yourself. |
31
+ | `ConnectionResolution:*` | resolver `Default` | Per-tenant connections. |
32
+
33
+ `JsonConverters` is code-only; other options properties are not read from
34
+ configuration.
35
+
36
+ ## Read protection
37
+
38
+ Root-level `ReadProtection` section (no `Cratis:` prefix). The environment form
39
+ is `ReadProtection__MaximumMode`. `Cratis:Arc:ReadProtection:*` has no effect.
40
+
41
+ | Key | Default | Change it when |
42
+ | --- | --- | --- |
43
+ | `ReadProtection:MaximumMode` | `On` | Lower the effective mode at run time without a rebuild; it is a ceiling that can only lower. |
44
+ | `ReadProtection:StartupAdmissionCheck` | `Default` | `Log` or `Off` while adopting protection. |
45
+ | `ReadProtection:RequireGeneratedMetadata` | `false` (always required where dynamic code is unavailable) | Fail instead of falling back to reflection for read-model key lookup. |
46
+ | `ReadProtection:MeasureSampleRate` | `0.1` | Fraction of commands scanned by Measure, 0 to 1. |
47
+ | `ReadProtection:MeasureTailTimeout` | 250 ms | 1 to 5000. |
48
+ | `ReadProtection:MeasureScanTimeout` | 5000 ms | 1 to 5000. |
49
+ | `ReadProtection:MeasureScanLimit` | 500 events | 1 to 500. |
50
+
51
+ The mode itself is the `CratisReadProtection` MSBuild property, not a
52
+ configuration key.
@@ -0,0 +1,53 @@
1
+ # Frontend and routes
2
+
3
+ ## Contents
4
+
5
+ - Settings that must match
6
+ - React provider props
7
+ - Hosting under a path prefix
8
+
9
+ ## Settings that must match
10
+
11
+ The route settings exist twice. The proxy generator reads MSBuild properties and
12
+ writes URLs into the generated client; the host reads `Cratis:Arc:GeneratedApis`
13
+ and maps endpoints. Arc does not compare them. A mismatch gives a 404 with no
14
+ build error and no log entry.
15
+
16
+ | MSBuild property (generator) | Host key `Cratis:Arc:GeneratedApis:...` | Generator default | Host default |
17
+ | --- | --- | --- | --- |
18
+ | `CratisProxiesApiPrefix` | `RoutePrefix` | `api` | `api` |
19
+ | `CratisProxiesSegmentsToSkip` | `SegmentsToSkipForRoute` | none | `0` |
20
+ | `CratisProxiesSkipCommandNameInRoute` | `IncludeCommandNameInRoute` (inverse) | `false` | `true` |
21
+ | `CratisProxiesSkipQueryNameInRoute` | `IncludeQueryNameInRoute` (inverse) | `false` | `true` |
22
+
23
+ Change both sides in one commit, then compare a generated client's `route` with
24
+ the mapped endpoint. An explicit `[Path]` on a model-bound artifact replaces the
25
+ route and does not get the prefix. The full property list is in the proxy
26
+ generator reference of `cratis-arc-command`.
27
+
28
+ ## React provider props
29
+
30
+ Props on `<Arc>`. Inner providers do not inherit outer values.
31
+
32
+ | Prop | Default | Change it when |
33
+ | --- | --- | --- |
34
+ | `apiBasePath` | `''` | The application is served under a path prefix. Never repeat the generated route's `/api`. |
35
+ | `origin` | `''` (current origin) | The backend is on another origin. Requests then bypass a dev-server proxy. |
36
+ | `microservice` | `''` | An ingress selects a service through a header. |
37
+ | `development` | `false` | Turn on development behavior in the provider. |
38
+ | `httpHeadersCallback` | none | Dynamic headers on fetch requests; not applied to native streaming handshakes. |
39
+ | `queryTransportMethod` | `ServerSentEvents` | Another observable-query transport. |
40
+ | `queryDirectMode` | `false` | `true` skips shared hubs. |
41
+ | `queryConnectionCount` | `1` | More hub connection slots (server-sent events capped at four). |
42
+ | `observableQueryTransferMode` | `Delta` | Full snapshots instead of deltas. |
43
+ | `queryCacheRetentionMs` | `30000` | Cache lifetime after the last consumer releases an entry. |
44
+ | `basePath` | `''` | Deprecated; does nothing. |
45
+
46
+ ## Hosting under a path prefix
47
+
48
+ For an app served at `/workbench`: set `<Arc apiBasePath="/workbench">`, set the
49
+ router `basename` to `/workbench` separately, and make the backend accept the
50
+ prefix (`UsePathBase` for ASP.NET Core; static file request path for the
51
+ lightweight host). `/workbench` plus the generated `/api/orders` becomes
52
+ `/workbench/api/orders`. A reverse proxy that strips the prefix means the
53
+ server sees unprefixed paths; configure the frontend and ingress together.
@@ -0,0 +1,23 @@
1
+ # Symptoms and the setting behind them
2
+
3
+ Each row is a first hypothesis; confirm before changing.
4
+
5
+ | Symptom | Setting to check |
6
+ | --- | --- |
7
+ | Build succeeds but no TypeScript proxies appear | `CratisProxiesOutputPath` is empty; the generator target runs only when it is set |
8
+ | Generated client calls return 404 | Generator and host route settings differ: prefix, segments to skip, name inclusion (skip and include are inverses) |
9
+ | Requests go to the wrong path behind a gateway | `apiBasePath` duplicated `/api` or missing the deployment prefix; `origin` bypassing the dev proxy |
10
+ | Every request is anonymous after `AddCratis()`; endpoints return 401 | `TrustForwardedIdentityHeaders` is `false` by default; enable only behind an ingress that authenticates and replaces the headers |
11
+ | Exception details missing in a Development-like environment | `ExposeExceptionDetails` follows `ASPNETCORE_ENVIRONMENT` only; `DOTNET_ENVIRONMENT` does not set it |
12
+ | Exception details visible in production | `ExposeExceptionDetails` set to `true`; remove it |
13
+ | Discovery or `/.cratis/me` returns 401 or 404 | Introspection is anonymous only in Development; outside it needs a signed-in user unless `Introspection:Roles`, `Enabled` or `IdentityDiscovery` changes that; check the frontend `apiBasePath` and origin |
14
+ | Query-health feed refused | `QueryHealth:RequireAuthentication`, `QueryHealth:Roles` |
15
+ | Observable query WebSocket connections accepted from any origin | `Query:AllowedWebSocketOrigins` unset; set the front-end origins |
16
+ | Observable query connection dropped by a proxy while idle | `Query:KeepAliveInterval` |
17
+ | Host fails at startup with a time zone error | `Calendar:TimeZone` must be a valid IANA id |
18
+ | Host fails at startup with a MongoDB error | `Cratis:MongoDB:Server` and `Database` are required |
19
+ | `DbContext` types not discovered | `Cratis:EntityFrameworkCore:ConnectionString` empty, or `AutoDiscoverDbContexts` off |
20
+ | Tenant resolved wrongly | `Tenancy:ResolverType`, header, claim or query names; header, query and subdomain resolvers read caller-set values; trust them only behind a gateway that sets them |
21
+ | Read-protection settings seem ignored | Keys must be root-level `ReadProtection`, not under `Cratis:Arc`; the mode is the `CratisReadProtection` build property |
22
+ | MCP tools served without a scope check | `ExclusiveTools` set to `false` |
23
+ | Setting in appsettings has no effect | A `configureOptions` callback runs after binding and wins; or the key is code-only |
@@ -35,10 +35,35 @@ chronicle+srv://host/?opts
35
35
 
36
36
  Default port `35000`. `Default` is `chronicle://localhost:35000`;
37
37
  `Development` adds the `chronicle-dev-client` / `chronicle-dev-secret`
38
- credentials. Query options: `apiKey`, `auth`, `skipTlsValidation`,
39
- `skipCompatibilityCheck`, `loadBalancer`, `srvNameServer`, `certificatePath`,
40
- `certificatePassword` (`ChronicleConnectionStringBuilder.cs`). There is an
41
- implicit conversion from `string` and a `Redacted` form for logging.
38
+ credentials. Query options: `apiKey`, `auth`, `skipTlsValidation`, `disableTls`,
39
+ `skipCompatibilityCheck`, `skipKeepAlive`, `serverless`, `loadBalancer`,
40
+ `srvNameServer`, `certificatePath`, `certificatePassword`, `caCertificatePath`
41
+ (`ChronicleConnectionStringBuilder.cs`). There is an implicit conversion from
42
+ `string` and a `Redacted` form for logging.
43
+
44
+ #### `disableTls`
45
+
46
+ `disableTls=true` connects over cleartext HTTP/2 (h2c). Use it only when the
47
+ kernel runs with `tls.enabled` false behind a private HTTPS-terminating proxy or
48
+ reaches the client through a port-forward, for example
49
+ `chronicle://localhost:35001/?disableTls=true&auth=none`. Rules:
50
+
51
+ - With no credentials the client uses no authentication and does **not** fall
52
+ back to the development credentials.
53
+ - Explicit client credentials (username and password) are refused with
54
+ `ClientCredentialsRequireTls`, because they would travel in the clear.
55
+ - `apiKey=<token>` from an external identity authority works; the token is sent
56
+ unencrypted, so keep the hop private.
57
+ - Certificate validation does not apply and its warning is suppressed.
58
+ - Never use it across an untrusted network.
59
+
60
+ #### `authPort`
61
+
62
+ `authPort` is not a .NET connection string option; the .NET builder does not
63
+ recognize it. The Elixir client uses it to name the port of the token endpoint
64
+ (default: the first server port). Do not add it to a .NET connection string.
65
+ See `cratis-chronicle-configuration` for the settings that pair with these
66
+ switches.
42
67
 
43
68
  With ClientCredentials auth and **both** username and password absent, the .NET
44
69
  client also falls back to these development credentials, including through
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: cratis-chronicle-configuration
3
+ description: Use when choosing, changing or diagnosing Chronicle client or kernel settings, defaults, environment variables or the local development loop. Not for production topology (use cratis-chronicle-hosting) or client wiring (use the client skills).
4
+ license: MIT
5
+ ---
6
+
7
+ <!-- Copyright (c) Cratis. All rights reserved. -->
8
+ <!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
9
+
10
+ # Configure Chronicle
11
+
12
+ Most Chronicle problems that look like bugs are a setting: a message size that
13
+ differs between client and kernel, a development default left in a deployed
14
+ environment, a port or TLS switch that does not match the other side. Find the
15
+ setting, its default and the side that owns it before changing code.
16
+
17
+ Two surfaces exist and they are configured differently:
18
+
19
+ | Surface | Where it lives | How to set it |
20
+ | --- | --- | --- |
21
+ | Client (`ChronicleOptions`) | The application | Code, `Cratis:Chronicle` configuration section, or the connection string |
22
+ | Kernel (server options) | The `cratis/chronicle` container or process | `chronicle.json` mounted at `/app/chronicle.json`, or `Cratis__Chronicle__*` environment variables |
23
+
24
+ A setting on one side never changes the other. Where both sides enforce a limit
25
+ (gRPC message size), change both.
26
+
27
+ ## Workflow
28
+
29
+ 1. Name the symptom and the side. Read [symptoms](references/symptoms.md) first;
30
+ it maps error text to the setting that usually causes it.
31
+ 2. Look up the setting: [client options](references/client-options.md) or
32
+ [kernel options](references/kernel-options.md). Both list the default and when
33
+ changing it is justified.
34
+ 3. For a container or CI deployment, translate the JSON path to an environment
35
+ variable with [environment variables](references/environment-variables.md).
36
+ 4. For a local developer machine, follow the
37
+ [development inner loop](references/development-inner-loop.md) instead of
38
+ copying production settings.
39
+ 5. Change one setting, restart the side that owns it, and reproduce the symptom.
40
+
41
+ ## Rules that prevent the common mistakes
42
+
43
+ - **Do not state a default from memory.** Read the reference; if a setting is
44
+ not listed, read the product options type or documentation before answering.
45
+ - **`DEVELOPMENT` is a compile-time symbol of the image**, not an environment
46
+ variable. `latest-development` images behave as development kernels;
47
+ `ASPNETCORE_ENVIRONMENT` does not turn a production image into one. The
48
+ runtime environment (`Development`) separately controls webhook and capture
49
+ `AllowInsecureHttp` and the loopback exemption. The `Validation` default
50
+ (`Warn` versus `BlockLocalAddresses`) follows the image, not the runtime
51
+ environment.
52
+ - **Certificate validation is skipped by default on the client.** That suits the
53
+ self-signed development image. A deployed client must opt in to validation.
54
+ - **`Authentication:Authority` is an external identity provider's issuer URL.**
55
+ A non-empty value disables the built-in issuer. It is never the kernel's own
56
+ URL.
57
+ - **Secrets go in `*File` variants or secret management**, not in committed
58
+ `chronicle.json`, images or logs. Do not quote or invent credential values.
59
+ - **Caller-set namespace resolvers are not trusted on their own.** The default
60
+ HTTP header resolver (`NamespaceHttpHeader`) and the subdomain resolver both
61
+ read values the caller sets. Strip or overwrite the header at a trusted
62
+ gateway, or resolve from an authenticated claim, before it selects a tenant.
63
+ - A settings change is not authorization to restart, redeploy or alter a shared
64
+ environment. State the change and its blast radius first.
65
+
66
+ ## References
67
+
68
+ - Read [client options](references/client-options.md) for `ChronicleOptions`,
69
+ ASP.NET Core options and the connection-string switches.
70
+ - Read [kernel options](references/kernel-options.md) for ports, TLS, features,
71
+ observers, authentication, clustering and storage keys.
72
+ - Read [environment variables](references/environment-variables.md) for the
73
+ naming rule, list indexes and secret `*File` variants.
74
+ - Read [development inner loop](references/development-inner-loop.md) for the
75
+ development image, port, credentials, first Workbench sign-in and TLS switches.
76
+ - Read [symptoms](references/symptoms.md) when starting from an error or odd
77
+ behavior rather than a setting.
78
+
79
+ ## Related skills
80
+
81
+ - Use `cratis-chronicle-hosting` for production topology, certificates,
82
+ MongoDB replica sets, clustering and backup order; this skill does not repeat
83
+ them.
84
+ - Use `cratis-chronicle-client-dotnet` for client wiring and lifecycle;
85
+ its connection-options reference holds connection-string forms.
86
+ - Use `cratis-chronicle-multi-tenancy` for namespace resolution design.
87
+ - Use `cratis-arc-configuration` for Arc's own settings.
@@ -0,0 +1,80 @@
1
+ # Client options
2
+
3
+ ## Contents
4
+
5
+ - Where client options come from
6
+ - ChronicleOptions
7
+ - ASP.NET Core options
8
+ - Connection-string switches
9
+ - Limits that must match the kernel
10
+
11
+ ## Where client options come from
12
+
13
+ Precedence, lowest to highest: built-in default, `Cratis:Chronicle`
14
+ configuration section, connection string, code in the options callback. The
15
+ event store name is required and has no default.
16
+
17
+ ## ChronicleOptions
18
+
19
+ | Setting | Default | Change it when |
20
+ | --- | --- | --- |
21
+ | `EventStore` (client options) | none, required | Always: name the event store the application writes to. |
22
+ | `ProgramIdentifier` | `[N/A]` | Several applications share a kernel and you need to tell them apart in logs and the Workbench. |
23
+ | `ConnectTimeout` | 5 seconds | The kernel starts slowly or the network is slow; raise it instead of retrying in application code. |
24
+ | `AutoDiscoverAndRegister` | `true` | Registering artifacts explicitly. Set `false` only together with an explicit artifact list. |
25
+ | `RegistrationMode` | `Inline` | Registration must not block startup; check the options type before choosing another mode. |
26
+ | `RegistrationRetry` | 5 attempts, 2 second initial delay, 30 second maximum delay | Startup races the kernel (compose, orchestrators). Raise attempts or delay rather than adding sleeps. |
27
+ | `SkipKeepAlive` | `false` | A short-lived client (a CLI command, a job) that should not hold keep-alive pings. |
28
+ | `SkipCompatibilityCheck` | `false` | Connecting deliberately to a kernel version the client does not declare compatible. Leave on otherwise. |
29
+ | `UnitOfWorkLifecyclePolicy` | `Compatibility` | `Strict` to fail on units of work that are never completed. |
30
+ | `EventGenerationDelivery` | `Compatibility` | Opting into the newer event generation delivery behavior. |
31
+ | `ArtifactIdentityDrift` | `Warn` | `Error` in CI to fail on renamed or drifted artifact identities. |
32
+ | `DefaultSinkTypeId` | MongoDB | Read models should default to another sink type. |
33
+ | `ClaimsBasedNamespaceResolverClaimType` | `tenant_id` | The identity provider carries the tenant in another claim. |
34
+ | `EnableEventTypeGenerationValidation` | `false` | Only a development kernel honors this; a production kernel always enforces migration-chain validation. |
35
+ | `MaxReceiveMessageSize` / `MaxSendMessageSize` | 100 MiB each | See [limits that must match the kernel](#limits-that-must-match-the-kernel). |
36
+ | `Tls.SkipCertificateValidation` | `true` | Any deployed client: set `false` against a certificate that can be verified. |
37
+ | `Tls.CaCertificatePath` | not set | The kernel certificate is issued by a private authority the client machine does not trust. |
38
+ | `Reactors.MaxConcurrentPartitions`, `Reducers.MaxConcurrentPartitions` | processor count, capped at 8 | Handler code is not thread-safe (set 1) or the machine has spare capacity for more partitions. One partition's batches stay ordered. Client-side only; the kernel `observers` section is separate. |
39
+
40
+ Telemetry options exist under the client's telemetry section; read the product
41
+ documentation for span naming and event-source id tracing before changing them.
42
+ The hash key used to pseudonymize event source ids must be at least 32
43
+ characters.
44
+
45
+ ## ASP.NET Core options
46
+
47
+ | Setting | Default | Change it when |
48
+ | --- | --- | --- |
49
+ | `NamespaceHttpHeader` | `x-cratis-tenant-id` | Your gateway sends the tenant in another header. |
50
+ | `UseAutomaticMiddleware` | `true` | You order the Chronicle middleware yourself. |
51
+ | Namespace resolver | HTTP header resolver | Tenant comes from a claim, subdomain or fixed value. The header and subdomain resolvers read caller-set values; set or strip the header at a trusted gateway, or use the claims resolver. |
52
+ | Unit-of-work `ReportFailuresBeforeResponseStarts` | `false` | The response should fail before it starts when a unit of work fails. |
53
+
54
+ ## Connection-string switches
55
+
56
+ Connection-string syntax and every query option are in
57
+ `cratis-chronicle-client-dotnet` (connection options). The switches that change
58
+ runtime behavior:
59
+
60
+ | Switch | Effect | Use when |
61
+ | --- | --- | --- |
62
+ | `skipTlsValidation=false` | Verify the kernel certificate | Every deployed client |
63
+ | `disableTls=true` | Cleartext HTTP/2 to the kernel | The kernel sits behind a private proxy or port-forward with `Tls:Enabled` false; never across an untrusted network |
64
+ | `auth=none` | No authentication | Together with `disableTls`, for a kernel with authentication off |
65
+ | `apiKey=<token>` | Bearer token from an external authority | The kernel uses an external identity provider |
66
+ | `skipKeepAlive=true`, `skipCompatibilityCheck=true` | Same as the options above | Same as the options above |
67
+ | `caCertificatePath=<file>` | Trust a private CA | Private certificate authority |
68
+
69
+ With `disableTls`, explicit client credentials are refused because they would
70
+ travel in the clear. The Elixir client has an extra `authPort` option; the .NET
71
+ client does not recognize it.
72
+
73
+ ## Limits that must match the kernel
74
+
75
+ gRPC message size is enforced on both ends. The client defaults and the kernel
76
+ `maxReceiveMessageSize` default are both 100 MiB. When a large event, batch or
77
+ read-model payload fails with `ResourceExhausted`, raise the limit on the
78
+ receiving side first, then on the sending side, and keep client and kernel
79
+ values aligned. A kernel `maxReceiveMessageSize` of `null` removes the kernel
80
+ limit.
@@ -0,0 +1,77 @@
1
+ # Development inner loop
2
+
3
+ ## Contents
4
+
5
+ - Start the development kernel
6
+ - Connect an application
7
+ - First Workbench sign-in
8
+ - TLS switches
9
+ - Leaving development
10
+
11
+ ## Start the development kernel
12
+
13
+ Use the development image, which bundles MongoDB and is built with the
14
+ `DEVELOPMENT` symbol:
15
+
16
+ ```yaml
17
+ services:
18
+ chronicle:
19
+ image: cratis/chronicle:latest-development
20
+ ports:
21
+ - "127.0.0.1:35000:35000"
22
+ - "127.0.0.1:27017:27017"
23
+ ```
24
+
25
+ `latest-development-slim` omits MongoDB; supply a replica-set MongoDB yourself
26
+ (appends use transactions, so a standalone server fails). Publish ports on
27
+ loopback only.
28
+
29
+ The development image generates a self-signed certificate on every start,
30
+ generates ephemeral keys, honors a default administrator password and creates a
31
+ development client application. None of this is available in the production
32
+ image, and environment variables cannot turn the production image into a
33
+ development kernel.
34
+
35
+ ## Connect an application
36
+
37
+ The kernel listens on port 35000 over HTTPS. The default and development
38
+ connection strings target `chronicle://localhost:35000`. With client
39
+ credentials unset the .NET client falls back to the development client
40
+ credentials, and certificate validation is skipped by default, so a development
41
+ pair connects with no setup. Do not copy that default to a deployed client.
42
+
43
+ The Workbench is served from the same port: `https://localhost:35000`. A browser
44
+ warns about the self-signed certificate; accept it for local work.
45
+
46
+ ## First Workbench sign-in
47
+
48
+ The Workbench requires sign-in before any view loads; unauthenticated requests
49
+ return 401 and the app redirects to `/login`. On the development image sign in
50
+ as `Admin` with the development default password, which the Chronicle
51
+ repository's local-development rule and the development documentation state.
52
+ These credentials are valid only on a developer machine. A production kernel
53
+ instead uses the setup token from its startup log, `initialAdminSetupToken`, or
54
+ the `adminUser` bootstrap (see [kernel options](kernel-options.md)).
55
+
56
+ ## TLS switches
57
+
58
+ | Need | Switch | Notes |
59
+ | --- | --- | --- |
60
+ | Local client against the self-signed development certificate | Nothing; validation is skipped by default | Set `skipTlsValidation=false` to test real verification. |
61
+ | Reach the kernel through a port-forward or private proxy that forwards h2c | Kernel `tls.enabled=false` and `authentication.enabled=false` (isolated development only); client `disableTls=true` | Example connection string: `chronicle://localhost:35001/?disableTls=true&auth=none`. With authentication on, TLS off refuses to start unless `authentication.authority` is an external HTTPS issuer. Explicit credentials are refused with `disableTls`. |
62
+ | Token from an external identity provider over a proxy | `disableTls=true` with `apiKey=<token>` | The token travels in the clear on that hop; keep it on a private link. |
63
+ | Private CA | `caCertificatePath=<file>` | Client trust only; the kernel still needs its own certificate. |
64
+
65
+ ## Leaving development
66
+
67
+ Before a shared or deployed environment:
68
+
69
+ - Switch to a production image, pinned to a tested release.
70
+ - Remove the persisted development client application and any configuration that
71
+ recreates it; switching storage to a production kernel does not remove it.
72
+ - Set `skipTlsValidation=false` and configure a real certificate.
73
+ - Replace development credentials and the default administrator password.
74
+ - Review `Webhooks` and `ExternalServices` `Validation`, which differ between
75
+ images.
76
+
77
+ Production topology and certificates are in `cratis-chronicle-hosting`.
@@ -0,0 +1,66 @@
1
+ # Environment variables
2
+
3
+ ## Contents
4
+
5
+ - Naming rule
6
+ - Common variables
7
+ - Secrets
8
+ - Container example
9
+
10
+ ## Naming rule
11
+
12
+ Every kernel option has an environment variable. Prefix `Cratis__Chronicle__`,
13
+ join section names with `__` (double underscore), keep the property name. The
14
+ JSON path `compliance.encryption.migrateFromDefaultStorage` becomes
15
+ `Cratis__Chronicle__Compliance__Encryption__MigrateFromDefaultStorage`. Names are
16
+ case-insensitive. List items take an index:
17
+ `Cratis__Chronicle__Webhooks__AllowedHosts__0`. Per-key dictionaries use the key
18
+ as a segment: `Cratis__Chronicle__Webhooks__EventStoreAllowedHosts__orders__0`.
19
+
20
+ An application's `Cratis:Chronicle` configuration section has the same
21
+ environment form (`Cratis__Chronicle__...`) but is read by the client in the
22
+ application process; set it on the application, not on the kernel container.
23
+
24
+ ## Common variables
25
+
26
+ | Variable | Sets |
27
+ | --- | --- |
28
+ | `Cratis__Chronicle__Port` | Listener port (35000) |
29
+ | `Cratis__Chronicle__Tls__Enabled` | TLS on the listener (default `true`) |
30
+ | `Cratis__Chronicle__Tls__CertificatePath`, `...CertificatePassword` | Listener certificate (PFX) |
31
+ | `Cratis__Chronicle__Storage__Type`, `...ConnectionDetails` | Storage backend and connection |
32
+ | `Cratis__Chronicle__Features__Workbench`, `...Api` | Workbench and REST API |
33
+ | `Cratis__Chronicle__Authentication__Authority` | External identity provider issuer URL |
34
+ | `Cratis__Chronicle__Observers__SubscriberTimeout` | Observer subscriber timeout, seconds |
35
+ | `Cratis__Chronicle__Observers__MaxRetryAttempts` | Observer retries |
36
+ | `Cratis__Chronicle__Clustering__Type` | `Localhost`, `MongoDB` or `Sql` |
37
+ | `Cratis__Chronicle__Clustering__GatewayEnabled` | Orleans client gateway |
38
+ | `Cratis__Chronicle__Webhooks__Validation`, `Cratis__Chronicle__ExternalServices__Validation` | Destination validation mode |
39
+ | `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_SERVICE_NAME` | Telemetry export |
40
+
41
+ The Chronicle hosting documentation's environment variables page holds the
42
+ full table; read it for anything not listed here.
43
+
44
+ ## Secrets
45
+
46
+ Several options have a `*File` form that reads the value from a file, for
47
+ example a mounted Kubernetes Secret: `Cratis__Chronicle__Storage__ConnectionDetailsFile`,
48
+ `...Sinks__Configurations__<name>__ConnectionDetailsFile`,
49
+ `...Neo4j__PasswordFile`. Set either the value or its file variant, not both.
50
+ Use these for connection strings, passwords and tokens; never commit the value.
51
+
52
+ ## Container example
53
+
54
+ ```yaml
55
+ services:
56
+ chronicle:
57
+ image: cratis/chronicle:<tested-release>
58
+ environment:
59
+ Cratis__Chronicle__Storage__ConnectionDetailsFile: /run/secrets/chronicle-storage
60
+ Cratis__Chronicle__Tls__CertificatePath: /certs/chronicle.pfx
61
+ Cratis__Chronicle__Tls__CertificatePassword: ${CHRONICLE_CERT_PASSWORD}
62
+ Cratis__Chronicle__Features__Workbench: "false"
63
+ ```
64
+
65
+ A pinned release tag, not `latest`, is for deployments. Topology, replica sets
66
+ and certificate provisioning are in `cratis-chronicle-hosting`.
@@ -0,0 +1,87 @@
1
+ # Kernel options
2
+
3
+ ## Contents
4
+
5
+ - How the kernel reads configuration
6
+ - Listener, TLS and features
7
+ - Observers, read models, jobs and events
8
+ - Authentication
9
+ - Clustering and storage
10
+ - Development image differences
11
+
12
+ ## How the kernel reads configuration
13
+
14
+ `chronicle.json` at `/app/chronicle.json` plus `Cratis__Chronicle__*`
15
+ environment variables; environment variables win. Keys below are the JSON path
16
+ under the root. Defaults describe the production image unless stated.
17
+
18
+ ## Listener, TLS and features
19
+
20
+ | Key | Default | Change it when |
21
+ | --- | --- | --- |
22
+ | `port` | 35000 | The port clashes or a proxy expects another. Clients must use the same port. |
23
+ | `bindTimeout` | 30 seconds | Startup binds slowly in constrained environments. |
24
+ | `healthCheckEndpoint` | `/health` | A probe expects another path. A dedicated health port is configured separately (`health`). |
25
+ | `maxReceiveMessageSize` | 100 MiB | Clients send payloads above the limit (`ResourceExhausted`). `null` removes the limit. Keep aligned with the client's send limit. |
26
+ | `shutdown.drainTimeout` | 8 seconds | Orchestrator termination grace is shorter or longer than the drain. |
27
+ | `tls.enabled` | `true` | Only behind a private HTTPS proxy: `false` serves HTTP/2 cleartext (h2c) and must never be reachable directly. With authentication on, it also needs an external HTTPS `authentication.authority`, or startup is refused. |
28
+ | `tls.certificatePath`, `tls.certificatePassword` | not set | The production image refuses to start with TLS on and no certificate. |
29
+ | `features.api` | `true` | Turn off the REST API when unused. |
30
+ | `features.workbench` | `true` | Turn off the Workbench on a hardened deployment. |
31
+ | `features.oauthAuthority` | `true` | Authentication uses an external authority; see below. |
32
+ | `features.changesetStorage` | `false` | You need stored changesets and accept the storage cost. |
33
+
34
+ ## Observers, read models, jobs and events
35
+
36
+ | Key | Default | Change it when |
37
+ | --- | --- | --- |
38
+ | `observers.subscriberTimeout` | 30 seconds in code | A subscriber is slow to answer. `0` waits indefinitely during catch-up and replay only. The development configuration file sets 5. |
39
+ | `observers.maxRetryAttempts` | 10 | Failing observers should quarantine sooner or later. |
40
+ | `observers.backoffDelay`, `observers.exponentialBackoffDelayFactor`, `observers.maximumBackoffDelay` | 1 second, factor 2, 600 seconds | Tune retry pacing for transient downstream failures. |
41
+ | `observers.definitionEvolution` | `Automatic` | `Manual` or `PartialOnly` when replays must be scheduled by hand. |
42
+ | `observers.replayOnDefinitionChange` | `false` in code; `true` in the development configuration file | Decide whether a changed definition replays by itself. |
43
+ | `readModels.maxBatchSize` | 500 | Replay batches overload a subscriber or sink; must be above zero. |
44
+ | `jobs.maxParallelSteps` | CPU count minus 1 | Cap or raise parallel job steps (replays, rebuilds). |
45
+ | `events.queues` | 2 | Event append throughput needs more queues. |
46
+
47
+ ## Authentication
48
+
49
+ | Key | Default | Change it when |
50
+ | --- | --- | --- |
51
+ | `authentication.enabled` | `true` | Almost never in production; read the authentication page before turning it off. |
52
+ | `authentication.authority` | empty | An external identity provider issues the tokens. Set its issuer URL; non-empty disables the built-in issuer. Never the kernel's own URL. |
53
+ | `authentication.initialAdminSetupToken` | not set | First administrator setup through a supplied token. Use secret management; remove after setup. |
54
+ | `authentication.adminUser.*` | not set | Bootstrap an administrator by username and password. The password is hashed on first start. |
55
+
56
+ First administrator on a production kernel: the setup token from the startup
57
+ log, a supplied `initialAdminSetupToken`, or the `adminUser` bootstrap. The
58
+ development image instead honors a default administrator password (see
59
+ [development inner loop](development-inner-loop.md)).
60
+
61
+ ## Clustering and storage
62
+
63
+ | Key | Default | Change it when |
64
+ | --- | --- | --- |
65
+ | `clustering.type` | `Localhost` | More than one node: `MongoDB` or `Sql`. Topology belongs to `cratis-chronicle-hosting`. |
66
+ | `clustering.siloPort`, `clustering.gatewayPort` | 11111, 30000 | Ports clash or the network policy fixes them. |
67
+ | `clustering.gatewayEnabled` | `true` | Applications use only HTTP and gRPC: set `false`. |
68
+ | `storage.type` | MongoDB | A different backend. |
69
+ | `storage.connectionDetails` | empty | Always in production; prefer `connectionDetailsFile` for secrets. |
70
+ | `storage.createIfMissing` | `true` | Databases and schemas must be created by an operator. |
71
+
72
+ Sinks, per-namespace storage and encryption certificates are covered by
73
+ `cratis-chronicle-hosting`.
74
+
75
+ ## Development image differences
76
+
77
+ - Compile-time `DEVELOPMENT`: self-signed certificate on every start,
78
+ ephemeral keys, built-in default administrator password honored.
79
+ - `Webhooks.Validation` and `ExternalServices.Validation` default to `Warn` in a
80
+ development image and `BlockLocalAddresses` in the production image (compile
81
+ time). `AllowInsecureHttp` and the loopback exemption follow the runtime
82
+ environment (`Development`), not the image.
83
+ - The development image uses MongoDB at `mongodb://localhost:27017` and a
84
+ `chronicle.json` with a 5 second subscriber timeout and replay on definition
85
+ change.
86
+ - The development client application created by a development kernel persists
87
+ in storage. Moving that storage to a production kernel does not remove it.
@@ -0,0 +1,53 @@
1
+ # Symptoms and the setting behind them
2
+
3
+ ## Contents
4
+
5
+ - Connection and security
6
+ - Limits and timeouts
7
+ - Observers and replay
8
+ - Startup and storage
9
+
10
+ Each row names the usual setting. Confirm the cause before changing it; a row
11
+ is a first hypothesis, not a diagnosis.
12
+
13
+ ## Connection and security
14
+
15
+ | Symptom | Setting to check |
16
+ | --- | --- |
17
+ | Client cannot connect to a local development kernel | Port 35000 published on loopback; connection string host and port; kernel running the development image |
18
+ | TLS or certificate error from a deployed client | `skipTlsValidation=false` with a certificate the client trusts; `caCertificatePath` for a private CA |
19
+ | Client works locally but fails behind a port-forward or proxy | Kernel `tls.enabled` and client `disableTls` must agree; with `disableTls`, use `auth=none` or `apiKey`, not client credentials |
20
+ | `ClientCredentialsRequireTls` or credentials refused | `disableTls=true` with explicit username and password; use `apiKey` from an external authority or restore TLS |
21
+ | 401 from the Workbench or REST API | Sign-in required; development default administrator on the development image only; production setup token or `adminUser` bootstrap |
22
+ | Production kernel refuses to start with TLS on | `tls.certificatePath` and `tls.certificatePassword` missing |
23
+ | External identity provider tokens rejected | `authentication.authority` must be the provider's issuer URL, never the kernel's own URL |
24
+ | Development application still exists after moving to production | Persisted development client application; remove it and any configuration that recreates it |
25
+
26
+ ## Limits and timeouts
27
+
28
+ | Symptom | Setting to check |
29
+ | --- | --- |
30
+ | `ResourceExhausted` or message too large | Raise the receiver's limit first, then the sender's: kernel `maxReceiveMessageSize`, client `MaxReceiveMessageSize` and `MaxSendMessageSize` |
31
+ | Client times out connecting at startup | `ConnectTimeout` (5 seconds), `RegistrationRetry`; kernel not yet ready |
32
+ | Short-lived client keeps a connection open or pings | `SkipKeepAlive` |
33
+ | Version incompatibility error on connect | `SkipCompatibilityCheck` only after confirming the versions are intended |
34
+
35
+ ## Observers and replay
36
+
37
+ | Symptom | Setting to check |
38
+ | --- | --- |
39
+ | Subscriber call times out on slow handlers | `observers.subscriberTimeout` (30 seconds in code); development file sets 5 |
40
+ | Observer quarantined after repeated failures | `observers.maxRetryAttempts`, backoff settings; fix the handler first |
41
+ | Replay did not start after a definition change | `observers.replayOnDefinitionChange`, `observers.definitionEvolution` |
42
+ | Reactor or reducer processes one partition at a time or races | Client `Reactors` / `Reducers` `MaxConcurrentPartitions` |
43
+ | Replay overloads a sink | `readModels.maxBatchSize`, `jobs.maxParallelSteps` |
44
+
45
+ ## Startup and storage
46
+
47
+ | Symptom | Setting to check |
48
+ | --- | --- |
49
+ | Appends fail on a local MongoDB | MongoDB must be a replica set; the bundled development image already is |
50
+ | Kernel starts with empty storage connection | `storage.connectionDetails` or `connectionDetailsFile` (empty by default in production) |
51
+ | Webhook or capture destination rejected locally | `Validation` mode differs per image; `AllowInsecureHttp` works only in the `Development` runtime environment |
52
+ | Several applications indistinguishable in logs | Client `ProgramIdentifier` |
53
+ | Tenant resolved wrongly behind a gateway | `NamespaceHttpHeader`, `ClaimsBasedNamespaceResolverClaimType`; never trust a caller-set header or `Host` alone |
@@ -277,6 +277,7 @@
277
277
  "cratis-arc-command-execution",
278
278
  "cratis-arc-command-operation",
279
279
  "cratis-arc-command-validation",
280
+ "cratis-arc-configuration",
280
281
  "cratis-arc-hosting",
281
282
  "cratis-arc-neo4j",
282
283
  "cratis-arc-observable-query-http",
@@ -531,6 +532,7 @@
531
532
  "availableTargets": [
532
533
  "cratis-commits-and-pull-requests",
533
534
  "cratis-rtk",
535
+ "cratis-chronicle-configuration",
534
536
  "cratis-chronicle-decision-reads",
535
537
  "cratis-chronicle-event-constraints",
536
538
  "cratis-chronicle-event-modeling",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "7.149.0",
3
+ "version": "7.150.0",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [