@cratis/pi 7.148.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.
Files changed (36) hide show
  1. package/package/corpus/hooks/scripts/cratis-guard-secrets.sh +30 -16
  2. package/package/corpus/product-sync.json +2 -0
  3. package/package/corpus/skills/cratis-arc-command/references/proxy-generation.md +28 -0
  4. package/package/corpus/skills/cratis-arc-configuration/SKILL.md +89 -0
  5. package/package/corpus/skills/cratis-arc-configuration/references/arc-options.md +93 -0
  6. package/package/corpus/skills/cratis-arc-configuration/references/data-and-protection-keys.md +52 -0
  7. package/package/corpus/skills/cratis-arc-configuration/references/frontend-and-routes.md +53 -0
  8. package/package/corpus/skills/cratis-arc-configuration/references/symptoms.md +23 -0
  9. package/package/corpus/skills/cratis-chronicle-client-dotnet/references/connection-options.md +29 -4
  10. package/package/corpus/skills/cratis-chronicle-configuration/SKILL.md +87 -0
  11. package/package/corpus/skills/cratis-chronicle-configuration/references/client-options.md +80 -0
  12. package/package/corpus/skills/cratis-chronicle-configuration/references/development-inner-loop.md +77 -0
  13. package/package/corpus/skills/cratis-chronicle-configuration/references/environment-variables.md +66 -0
  14. package/package/corpus/skills/cratis-chronicle-configuration/references/kernel-options.md +87 -0
  15. package/package/corpus/skills/cratis-chronicle-configuration/references/symptoms.md +53 -0
  16. package/package/corpus/skills/cratis-screenplay-reverse-engineering/SKILL.md +22 -4
  17. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/behavior-catalog.md +5 -0
  18. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/evidence-format.md +23 -0
  19. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/executable-intake.md +13 -0
  20. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/fidelity-check.md +13 -2
  21. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/probing-and-naming.md +29 -4
  22. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/process-drift.md +56 -0
  23. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/provenance.md +1 -1
  24. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/scoping.md +6 -0
  25. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/synthesis-rules.md +38 -3
  26. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/target-and-first-validation.md +3 -0
  27. package/package/corpus/skills/cratis-screenplay-reverse-engineering/scripts/drift-scope-self-test.mjs +87 -0
  28. package/package/corpus/skills/cratis-screenplay-reverse-engineering/scripts/drift-scope.mjs +155 -0
  29. package/package/corpus/skills/cratis-screenplay-reverse-engineering/scripts/fixtures/solocrm-drift/README.md +23 -0
  30. package/package/corpus/skills/cratis-screenplay-reverse-engineering/scripts/fixtures/solocrm-drift/change.diff +131 -0
  31. package/package/corpus/skills/cratis-screenplay-reverse-engineering/scripts/fixtures/solocrm-drift/evidence-map.json +39 -0
  32. package/package/corpus/skills/cratis-screenplay-reverse-engineering/scripts/fixtures/solocrm-drift/expected.json +52 -0
  33. package/package/corpus/skills/cratis-screenplay-reverse-engineering/verification.json +3 -1
  34. package/package/profile-catalog.json +2 -0
  35. package/package.json +1 -1
  36. package/src/index.ts +47 -35
@@ -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.