@cratis/pi 8.4.1 → 8.5.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 (137) hide show
  1. package/package/corpus/harnesses/copilot/instructions/ai-distribution.instructions.md +2 -1
  2. package/package/corpus/harnesses/copilot/instructions/exit-codes-and-wrappers.instructions.md +1 -1
  3. package/package/corpus/harnesses/copilot/instructions/scripting.instructions.md +2 -1
  4. package/package/corpus/hooks/scripts/cratis-guard-secrets.sh +131 -9
  5. package/package/corpus/rules/ai-distribution.md +2 -1
  6. package/package/corpus/rules/exit-codes-and-wrappers.md +1 -1
  7. package/package/corpus/rules/scripting.md +2 -1
  8. package/package/corpus/skills/cratis-application-growth/references/csharp.md +1 -1
  9. package/package/corpus/skills/cratis-arc-authorize-request/SKILL.md +3 -3
  10. package/package/corpus/skills/cratis-arc-authorize-request/references/authproxy.md +28 -3
  11. package/package/corpus/skills/cratis-arc-authorize-request/references/csharp-query-security.md +3 -3
  12. package/package/corpus/skills/cratis-arc-authorize-request/references/csharp.md +1 -1
  13. package/package/corpus/skills/cratis-arc-authorize-request/references/typescript.md +2 -0
  14. package/package/corpus/skills/cratis-arc-connect-storage/references/csharp.md +1 -0
  15. package/package/corpus/skills/cratis-arc-connect-storage/references/elixir.md +9 -2
  16. package/package/corpus/skills/cratis-arc-declare-command/references/csharp-chronicle.md +1 -1
  17. package/package/corpus/skills/cratis-arc-declare-command/references/csharp-history.md +2 -2
  18. package/package/corpus/skills/cratis-arc-declare-command/references/csharp.md +7 -7
  19. package/package/corpus/skills/cratis-arc-declare-operation/references/csharp-abilities.md +2 -2
  20. package/package/corpus/skills/cratis-arc-declare-operation/references/csharp-recovery.md +6 -4
  21. package/package/corpus/skills/cratis-arc-declare-operation/references/csharp.md +2 -2
  22. package/package/corpus/skills/cratis-arc-diagnose-live-query/SKILL.md +1 -1
  23. package/package/corpus/skills/cratis-arc-diagnose-live-query/references/csharp.md +6 -6
  24. package/package/corpus/skills/cratis-arc-diagnose-live-query/references/java.md +1 -1
  25. package/package/corpus/skills/cratis-arc-diagnose-live-query/references/kotlin.md +1 -1
  26. package/package/corpus/skills/cratis-arc-expose-mcp-operation/references/csharp-diagnose-tool-call.md +9 -7
  27. package/package/corpus/skills/cratis-arc-expose-mcp-operation/references/csharp.md +3 -1
  28. package/package/corpus/skills/cratis-arc-expose-query/SKILL.md +1 -1
  29. package/package/corpus/skills/cratis-arc-expose-query/references/csharp.md +10 -7
  30. package/package/corpus/skills/cratis-arc-expose-query/references/go.md +2 -2
  31. package/package/corpus/skills/cratis-arc-expose-query/references/typescript.md +6 -3
  32. package/package/corpus/skills/cratis-arc-generate-proxies/references/csharp.md +7 -5
  33. package/package/corpus/skills/cratis-arc-host-application/references/csharp-identity.md +3 -2
  34. package/package/corpus/skills/cratis-arc-host-application/references/csharp.md +7 -0
  35. package/package/corpus/skills/cratis-arc-invoke-command/references/csharp-extensions.md +4 -0
  36. package/package/corpus/skills/cratis-arc-isolate-tenant/SKILL.md +1 -1
  37. package/package/corpus/skills/cratis-arc-isolate-tenant/references/csharp.md +4 -2
  38. package/package/corpus/skills/cratis-arc-react-bind-slice/SKILL.md +17 -22
  39. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-commands.md +11 -1
  40. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-host.md +10 -3
  41. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-identity.md +7 -3
  42. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-queries.md +1 -1
  43. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript.md +1 -1
  44. package/package/corpus/skills/cratis-arc-testing-typescript/references/typescript.md +2 -2
  45. package/package/corpus/skills/cratis-arc-validation-typescript/SKILL.md +1 -0
  46. package/package/corpus/skills/cratis-chronicle-cli-operations/SKILL.md +5 -5
  47. package/package/corpus/skills/cratis-chronicle-cli-operations/references/inspection.md +11 -3
  48. package/package/corpus/skills/cratis-chronicle-cli-operations/references/project-tooling.md +22 -0
  49. package/package/corpus/skills/cratis-chronicle-cli-operations/references/recovery-and-comparison.md +17 -3
  50. package/package/corpus/skills/cratis-chronicle-cli-operations/references/setup-and-target.md +8 -2
  51. package/package/corpus/skills/cratis-chronicle-connect-application/references/python.md +2 -2
  52. package/package/corpus/skills/cratis-chronicle-constrain-append/SKILL.md +1 -1
  53. package/package/corpus/skills/cratis-chronicle-deploy-kernel/SKILL.md +4 -3
  54. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/configuration.md +86 -16
  55. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/kernel-options.md +3 -3
  56. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/network-and-tls.md +14 -6
  57. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/storage.md +33 -1
  58. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/upgrade-and-recovery.md +27 -1
  59. package/package/corpus/skills/cratis-chronicle-evolve-event/references/csharp.md +2 -2
  60. package/package/corpus/skills/cratis-chronicle-inspect-observer/SKILL.md +4 -4
  61. package/package/corpus/skills/cratis-chronicle-inspect-observer/references/csharp.md +8 -7
  62. package/package/corpus/skills/cratis-chronicle-inspect-observer/references/go.md +2 -2
  63. package/package/corpus/skills/cratis-chronicle-mcp-inspection/SKILL.md +1 -1
  64. package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/deployment.md +1 -1
  65. package/package/corpus/skills/cratis-chronicle-project-view/SKILL.md +1 -1
  66. package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-fluent.md +1 -1
  67. package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-model-bound.md +1 -1
  68. package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-reading.md +2 -0
  69. package/package/corpus/skills/cratis-chronicle-project-view/references/java.md +1 -1
  70. package/package/corpus/skills/cratis-chronicle-project-view/references/kotlin.md +3 -3
  71. package/package/corpus/skills/cratis-chronicle-project-view/references/typescript.md +2 -0
  72. package/package/corpus/skills/cratis-chronicle-protect-decision/SKILL.md +1 -1
  73. package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp-scopes.md +1 -1
  74. package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp.md +2 -2
  75. package/package/corpus/skills/cratis-chronicle-protect-personal-data/SKILL.md +1 -1
  76. package/package/corpus/skills/cratis-chronicle-protect-personal-data/references/csharp.md +4 -2
  77. package/package/corpus/skills/cratis-chronicle-publish-contract/SKILL.md +6 -5
  78. package/package/corpus/skills/cratis-chronicle-publish-contract/references/elixir-integrations.md +3 -3
  79. package/package/corpus/skills/cratis-chronicle-react-to-fact/SKILL.md +2 -1
  80. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp-pages.md +1 -1
  81. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp.md +3 -3
  82. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/java.md +1 -1
  83. package/package/corpus/skills/cratis-chronicle-record-event/SKILL.md +2 -2
  84. package/package/corpus/skills/cratis-chronicle-reduce-state/references/typescript.md +1 -1
  85. package/package/corpus/skills/cratis-chronicle-web-workbench/SKILL.md +1 -1
  86. package/package/corpus/skills/cratis-ci-pipeline-performance/SKILL.md +4 -3
  87. package/package/corpus/skills/cratis-ci-pipeline-performance/references/publish-pipelines.md +19 -4
  88. package/package/corpus/skills/cratis-code-review/SKILL.md +6 -2
  89. package/package/corpus/skills/cratis-code-review/references/csharp.md +3 -3
  90. package/package/corpus/skills/cratis-commits-and-pull-requests/SKILL.md +6 -38
  91. package/package/corpus/skills/cratis-commits-and-pull-requests/references/pr-description.md +2 -0
  92. package/package/corpus/skills/cratis-commits-and-pull-requests/references/pr-labels-and-release.md +5 -4
  93. package/package/corpus/skills/cratis-commits-and-pull-requests/references/workflow-inputs.md +39 -0
  94. package/package/corpus/skills/cratis-components-submit-form/SKILL.md +6 -6
  95. package/package/corpus/skills/cratis-components-submit-form/references/typescript-commanddialog.md +21 -1
  96. package/package/corpus/skills/cratis-components-submit-form/references/typescript.md +2 -2
  97. package/package/corpus/skills/cratis-fundamentals-concept/references/csharp-serialization.md +2 -1
  98. package/package/corpus/skills/cratis-fundamentals-concept/references/csharp.md +1 -0
  99. package/package/corpus/skills/cratis-fundamentals-concept/references/go.md +1 -1
  100. package/package/corpus/skills/cratis-fundamentals-concept/references/java-json.md +3 -2
  101. package/package/corpus/skills/cratis-fundamentals-concept/references/kotlin-json.md +3 -2
  102. package/package/corpus/skills/cratis-fundamentals-concept/references/typescript-serialization.md +8 -2
  103. package/package/corpus/skills/cratis-fundamentals-name-value/SKILL.md +8 -7
  104. package/package/corpus/skills/cratis-fundamentals-type-discovery/SKILL.md +3 -3
  105. package/package/corpus/skills/cratis-fundamentals-type-discovery/references/csharp-diagnostics.md +3 -0
  106. package/package/corpus/skills/cratis-fundamentals-type-discovery/references/csharp.md +2 -2
  107. package/package/corpus/skills/cratis-platform-deliver-slice/references/typescript.md +14 -1
  108. package/package/corpus/skills/cratis-platform-prepare-release-pr/SKILL.md +8 -8
  109. package/package/corpus/skills/cratis-platform-prepare-release-pr/references/product-release-checks.md +16 -2
  110. package/package/corpus/skills/cratis-release-notes/SKILL.md +1 -1
  111. package/package/corpus/skills/cratis-release-notes/references/publish-repair.md +6 -3
  112. package/package/corpus/skills/cratis-screenplay-accept-model/references/csharp.md +5 -3
  113. package/package/corpus/skills/cratis-screenplay-accept-model/references/read-the-evidence.md +2 -2
  114. package/package/corpus/skills/cratis-screenplay-declare-slice/SKILL.md +6 -10
  115. package/package/corpus/skills/cratis-screenplay-declare-slice/references/commands.md +8 -4
  116. package/package/corpus/skills/cratis-screenplay-declare-slice/references/projections.md +2 -0
  117. package/package/corpus/skills/cratis-screenplay-declare-slice/references/structure-and-imports.md +19 -1
  118. package/package/corpus/skills/cratis-screenplay-edit-workspace/SKILL.md +2 -1
  119. package/package/corpus/skills/cratis-screenplay-edit-workspace/references/mcp-tools.md +1 -1
  120. package/package/corpus/skills/cratis-screenplay-handoff-slice/references/csharp.md +13 -1
  121. package/package/corpus/skills/cratis-screenplay-model-translation/SKILL.md +1 -1
  122. package/package/corpus/skills/cratis-screenplay-model-translation/references/boundary-diagnostics.md +1 -1
  123. package/package/corpus/skills/cratis-screenplay-onboard-workspace/SKILL.md +26 -48
  124. package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/studio.md +5 -0
  125. package/package/corpus/skills/cratis-screenplay-specify-outcome/SKILL.md +8 -12
  126. package/package/corpus/skills/cratis-screenplay-specify-outcome/references/running-mcp.md +12 -0
  127. package/package/corpus/skills/cratis-screenplay-specify-outcome/references/scenarios.md +2 -2
  128. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-command-results.md +1 -1
  129. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-events.md +6 -0
  130. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-integration.md +3 -2
  131. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-reactors.md +15 -2
  132. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-read-models.md +4 -2
  133. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp.md +1 -1
  134. package/package/corpus/skills/cratis-specifications-exercise-backend/references/typescript.md +4 -2
  135. package/package/corpus/skills/cratis-stage-render-slice/SKILL.md +6 -0
  136. package/package/corpus/skills/cratis-stage-render-slice/references/semantic-conformance.md +64 -0
  137. package/package.json +1 -1
@@ -15,6 +15,7 @@
15
15
  - Alerts and telemetry
16
16
  - Named sinks and graphs
17
17
  - Memory and back-pressure
18
+ - Constraint index repair
18
19
  - Occurrences, imports and pattern capture
19
20
  - Federation
20
21
  - Sections with their own reference
@@ -140,10 +141,8 @@ been subscribed to them in any namespace for `observers.unseenRemovalAfter`
140
141
  jobs. Resolve those first.
141
142
  - An observer with no recorded last-seen time gets its clock started by the
142
143
  first sweep, so it is removed only a full period later.
143
- - Confirm each removal through its `Information` log (event store, namespace,
144
- observer id) and the `chronicle.observers.unseen_removed` metric. Silos
145
- sweep without coordinating, so one removal can be logged and counted by
146
- more than one silo.
144
+ - Each removal is logged at `Information` and counted in the
145
+ `chronicle.observers.unseen_removed` metric, possibly by more than one silo.
147
146
 
148
147
  ## Per-observer retry overrides
149
148
 
@@ -300,12 +299,49 @@ is a sound floor); a platform that kills after 10 seconds leaves no margin.
300
299
  | `clustering.gatewayEnabled` | `true` | Off when nothing connects through the gateway |
301
300
  | `clustering.advertisedIP` | detected | The address other nodes should use, when detection picks the wrong interface |
302
301
  | `clustering.responseTimeout` | 30 seconds | Node-to-node call timeout |
302
+ | `clustering.roles.eventSequences`, `clustering.roles.observers` | `true` | `false` makes this node leave itself out when it is the node that places new event sequences or observers. Best-effort only: a node knows just its own roles, so another node can still place that work here. Treat roles as a scheduling hint, never promise that a node will not run the work, and size every node to host any workload |
303
303
  | `clustering.defunctSiloCleanupPeriod`, `clustering.defunctSiloExpiration` | 1 hour, 3 hours | Cleanup of dead membership entries only |
304
304
 
305
305
  `Sql` clustering needs PostgreSQL or SQL Server storage; `MongoDB` clustering
306
306
  needs MongoDB storage. SQLite and in-memory storage are single-node. Two
307
307
  `Localhost` kernels on the same database do not form a cluster: a single-writer
308
- lease lets only one of them become ready.
308
+ lease lets only one of them serve. The other stays not ready, or reports
309
+ `Standby` with standby on.
310
+
311
+ ### Start-before-stop rollouts of a single node
312
+
313
+ Run one `Localhost` replica and keep the lease enabled. Some platforms start
314
+ the replacement and wait for it to be ready before stopping the old instance:
315
+ Azure Container Apps in single-revision mode, Cloud Run, and a one-replica
316
+ Kubernetes rolling update with `maxSurge: 1` and `maxUnavailable: 0`. There
317
+ the replacement waits for the lease, never becomes ready, and the rollout times
318
+ out. Set `clustering.singleWriterLease.standby` to `true`
319
+ (`Cratis__Chronicle__Clustering__SingleWriterLease__Standby=true`). It matters
320
+ only when the readiness probe (on Cloud Run, the startup probe) targets the
321
+ readiness path: `/health` or `/health/ready`, moved by `healthCheckEndpoint`.
322
+ Handover on Cloud Run is unverified; test a rollout first. Do not disable the
323
+ lease or add a replica to get past the timeout. Platforms that stop the old
324
+ instance first (`Recreate`, or `maxSurge: 0`) need no standby. What standby
325
+ costs:
326
+
327
+ - The replacement answers readiness with 200 and the body `Standby` while it
328
+ waits for the lease and until its startup completes, unless another
329
+ readiness check is unhealthy. That 200 does not mean it accepts traffic: it
330
+ processes nothing until it holds the lease and has started, and application traffic gets HTTP 503 with
331
+ `Retry-After` or gRPC `Unavailable`. Clients must retry through the whole
332
+ handover, including the replacement's startup and rehydration, which can
333
+ take minutes on a large store.
334
+ - Readiness no longer gates the rollout: the old instance stops before the
335
+ replacement has shown it can start, so a broken release takes the service
336
+ down. Validate images in staging against a copy of production data, and
337
+ keep the previous image or revision ready to redeploy.
338
+ - `standbyStartupTimeout` (default 10 minutes) bounds how long readiness
339
+ reports `Standby` after the lease is taken. Past it, readiness reports
340
+ `Unhealthy` (503); startup is not aborted and the kernel keeps the lease. Set it above your longest startup, including
341
+ rehydration of the largest store.
342
+ - `acquireTimeout` (default 2 minutes) still bounds the wait for the lease;
343
+ the kernel exits when it expires. Set it to cover the platform's time to stop
344
+ the old instance plus `ttl` (default 30 seconds).
309
345
 
310
346
  ## Alerts and telemetry
311
347
 
@@ -314,10 +350,8 @@ conditions such as a failing partition; `alerts.conditions.<name>.raiseAfter`
314
350
  (default 5 minutes) and `.enabled` tune one condition, and
315
351
  `alerts.excludeObservers` lists observer ids or `*` / `?` patterns to leave
316
352
  out. Open incidents are also exported as a gauge (`chronicle_alerts_open_incidents`
317
- in Prometheus under the default names). Exporting
318
- kernel traces, metrics and logs, and writing Prometheus or other backend alert
319
- rules on observer failure metrics or incidents, is taught by the
320
- `cratis-observability` skill.
353
+ in Prometheus under the default names). Exporting telemetry and writing alert
354
+ rules are taught by the `cratis-observability` skill.
321
355
 
322
356
  ## Named sinks and graphs
323
357
 
@@ -352,7 +386,7 @@ graph server.
352
386
  }
353
387
  ```
354
388
 
355
- Names here are illustrative. The environment form is
389
+ The environment form is
356
390
  `Cratis__Chronicle__Sinks__Configurations__<name>__Type`.
357
391
 
358
392
  ## Memory and back-pressure
@@ -368,6 +402,31 @@ All three are on by default; change them only against a measured problem.
368
402
  A projection observes nothing until its registration has been applied; it
369
403
  then receives every event from its own position.
370
404
 
405
+ ## Constraint index repair
406
+
407
+ When a constraint-index write fails or runs out of time, the event sequence
408
+ repairs the index from the event log; the committed append is not failed.
409
+ Until the index is repaired, an append of an event type it governs can
410
+ return `ConstraintIndexUnavailable` and write nothing; retry it unchanged.
411
+ Keep the defaults unless storage latency calls for a change.
412
+
413
+ | Setting | Default | Allowed | Trade-off |
414
+ | --- | --- | --- | --- |
415
+ | `updateAttempts` | 3 | 1–10 | Each retry delays the append; more attempts mean fewer repairs |
416
+ | `attemptTimeout` | 1 second | above zero | How long Chronicle waits for one index write. When it does not finish in time, the attempt is cancelled and the wait abandoned, though storage may still complete the write. Lower for fast storage, raise for slow or distant storage |
417
+ | `postCommitBudget` | 2 seconds | above zero | Time to update indexes after an append commits; the rest is left to repair |
418
+ | `timerTurnBudget` | 2 seconds | at least 500 ms | One timer-driven repair turn; a catch-up turn gets this minus 250 ms |
419
+ | `appendRepairBudget` | 5 seconds | at least 500 ms | Added to the append that triggers the repair; more means faster convergence and slower appends |
420
+ | `appendRepairInterval` | 5 seconds | not negative | Minimum time between repairs started by appends; zero lets every append repair |
421
+ | `poisonThreshold` | 5 | at least 2 | Consecutive identical failures at the same event position before it is settled as poison. Only non-transient failures count, and only in an attempt where another storage call succeeded; lower settles sooner but may settle a failure that would have cleared |
422
+
423
+ The kernel refuses to start when a value is out of range, and the error names
424
+ the setting, for example `ConstraintIndexRepair.UpdateAttempts`. One append
425
+ turn can take up to about `timerTurnBudget` + 2 × `attemptTimeout` +
426
+ `appendRepairBudget` + 2 × `postCommitBudget` + 4 seconds: 17 seconds with the
427
+ defaults. Keep it well below `clustering.responseTimeout` (30 seconds).
428
+ Startup does not check the sum; recompute it before changing either.
429
+
371
430
  ## Occurrences, imports and pattern capture
372
431
 
373
432
  | Section | What it controls |
@@ -386,7 +445,7 @@ inbound port. It is off by default and never uses the main port.
386
445
  | --- | --- |
387
446
  | `federation.enabled` | Opens the federation listener and runs consumer bindings. `false` stops every link |
388
447
  | `federation.port` | Listener port, default 35100. Must differ from the main and health ports |
389
- | `federation.certificatePath`, `certificatePasswordPath` | PKCS#12 certificate for the listener and a **file** holding its password. Required; the main TLS certificate is not reused |
448
+ | `federation.certificatePath`, `certificatePasswordPath` | PKCS#12 certificate for the listener and a **file** holding its password. Required for pinned federation; with `federation.hosted.enabled` and no path, the kernel issues its own listener certificate. The main TLS certificate is never reused |
390
449
  | `federation.grants.<name>` | Producer side: which peer (`clientPin`) may read which `eventStore` and `namespaces`, and either `allPublic` or a list of `eventTypes` |
391
450
  | `federation.certificates.<name>` | Consumer side: a named client certificate, `path` and `passwordPath` |
392
451
  | `federation.bindings.<name>` | Consumer side: maps the `logicalSource` name application code uses to an `endpoint` (HTTPS), the peer's `serverPin`, the name of a `clientCertificate`, `remoteEventStore` / `remoteNamespace` and `targetEventStore` / `targetNamespace` |
@@ -397,15 +456,26 @@ inbound port. It is off by default and never uses the main port.
397
456
  - Peers are identified by a pin, `sha256:<base64 of the SHA-256 of the
398
457
  certificate's public key>`, not by a shared certificate authority. The
399
458
  listener requires a client certificate.
400
- - A grant never delivers private event types, whatever it lists.
459
+ - A grant never delivers private event types, whatever it lists, nor any
460
+ event whose schema declares personal-data or `[Encrypted]` properties: the
461
+ producer skips it and moves on. Undeclared personal data is not detected.
462
+ - The consumer's `targetEventStore` must have a different name from the
463
+ producer's store: an event whose origin is the receiving store is rejected.
401
464
  - The kernel refuses to start when federation is enabled without a
402
- certificate or when the port collides with another listener.
465
+ certificate (unless hosted federation issues one) or when the port collides
466
+ with another listener.
403
467
  - Grants and bindings can also be changed at runtime from the Workbench
404
- Federation page or the CLI; revoking a link stops delivery at once.
468
+ Federation page. A revoked grant no longer authorizes later pulls, but
469
+ another active grant that covers the same peer, store and namespace still
470
+ does. A pull already authorized is not checked again. Runtime
471
+ state wins: configuration only seeds a grant or binding whose name has no
472
+ history yet. Once it has any (its first seeding, a runtime change, removal or
473
+ revocation), editing configuration and restarting changes nothing and never
474
+ brings back a removed or revoked entry; change it at runtime.
405
475
  - `federation.hosted`, `federation.enrollment` and `federation.dial` serve
406
476
  hosted federation, where one kernel is the certificate authority for many
407
- customer kernels and enrols each with a one-time code instead of a pin. Their options are listed in the
408
- [option index](kernel-options.md).
477
+ customer kernels and enrols each with a one-time code instead of a pin. See
478
+ the [option index](kernel-options.md).
409
479
 
410
480
  ## Sections with their own reference
411
481
 
@@ -275,7 +275,7 @@ Each entry is keyed by the full observer key `<observer id>#<event store>#<names
275
275
  ## constraintIndexRepair
276
276
 
277
277
  - `updateAttempts` — The total number of in-turn attempts, the first try included, to write a constraint index update.
278
- - `attemptTimeout` — The longest a single index write may run before it is abandoned.
278
+ - `attemptTimeout` — How long Chronicle waits for a single index write before it cancels the attempt and abandons the wait; storage may still complete the write.
279
279
  - `postCommitBudget` — The time budget for updating the constraint indexes after an append has committed.
280
280
  - `timerTurnBudget` — The time budget for one timer-driven repair or catch-up turn.
281
281
  - `appendRepairBudget` — The time budget for a repair performed in the turn of an append.
@@ -429,8 +429,8 @@ Each entry is keyed by the full observer key `<observer id>#<event store>#<names
429
429
 
430
430
  ## clustering.roles
431
431
 
432
- - `eventSequences` — Whether Event Sequences can be placed on this node.
433
- - `observers` — Whether Observers can be placed on this node.
432
+ - `eventSequences` — When `false`, this node leaves itself out when it places Event Sequences. Best-effort: another node can still place them here.
433
+ - `observers` — When `false`, this node leaves itself out when it places Observers. Best-effort: another node can still place them here.
434
434
 
435
435
  ## clustering.singleWriterLease
436
436
 
@@ -109,10 +109,16 @@ kernel published directly needs none of this.
109
109
  | Path | Answers 200 when | Use for |
110
110
  | --- | --- | --- |
111
111
  | `/health/live` | The listener accepts requests, even during startup | Startup and liveness probes |
112
- | `/health/ready`, `/health` | Startup completed, storage checks pass and shutdown has not begun; otherwise 503 | Readiness and traffic gating |
112
+ | `/health/ready`, `/health` | No check reports unhealthy. Checks report unhealthy, for example, until startup completes, once shutdown begins, and on MongoDB while no server is connected. A degraded check, such as an overloaded kernel, a recorded storage authorization failure or MongoDB without a writable server, still answers 200 and names the status in the body. An unhealthy check answers 503. With lease standby on, also 200 with the body `Standby` while the kernel waits for the lease and starts, unless another check is unhealthy; it serves nothing yet | Readiness and traffic gating |
113
113
 
114
- `healthCheckEndpoint` (default `/health`) moves all three paths together. Until
115
- ready, the kernel refuses other traffic with HTTP 503 or gRPC `Unavailable`.
114
+ `healthCheckEndpoint` (default `/health`) moves all three paths together.
115
+
116
+ The probe status and traffic acceptance are separate. The kernel serves other
117
+ requests once startup has completed and until shutdown begins, whatever the
118
+ readiness status. Before that, and throughout standby, it refuses them with
119
+ HTTP 503 (`Retry-After: 1`) or gRPC `Unavailable`. So a started kernel can
120
+ answer 503 on readiness while it still serves requests, and a standby kernel
121
+ can answer 200 while it refuses them.
116
122
  **Ready does not mean observers have caught up**; projections and reactors keep
117
123
  catching up in the background.
118
124
 
@@ -130,9 +136,11 @@ cluster-internal. gRPC is never served there. The production image contains no
130
136
  shell or `curl`; probe from the orchestrator over HTTP, not with an exec
131
137
  command.
132
138
 
133
- On a single node with persistent storage, readiness also requires that this
134
- process holds the single-writer lease; a second kernel on the same storage
135
- stays not ready.
139
+ On a single node with persistent storage, the kernel finishes startup only
140
+ after it holds the single-writer lease. A second kernel on the same storage
141
+ serves nothing and stays not ready. With lease standby on, it instead reports
142
+ `Standby` with 200 while it waits, unless another check is unhealthy, and
143
+ still serves nothing (see [Clustering](configuration.md#clustering)).
136
144
 
137
145
  ## Message size limits
138
146
 
@@ -35,7 +35,7 @@ SQL Server storage.
35
35
 
36
36
  | Other setting | Default | Meaning |
37
37
  | --- | --- | --- |
38
- | `storage.databaseNamePrefix` | empty | Prefix on every MongoDB database name, to share a server between environments. MongoDB only |
38
+ | `storage.databaseNamePrefix` | empty | Prefix on every MongoDB database name the kernel derives (not on a name from connection resolution), to share a server between environments. Decide it before the first start: changing it later selects different databases and moves no data. MongoDB only |
39
39
  | `storage.systemDatabaseName` | `_system` | Name of the System event store's MongoDB databases. MongoDB only; same on every node |
40
40
  | `storage.schema` | the user's default schema | SQL schema that holds the kernel's tables. PostgreSQL and SQL Server |
41
41
  | `storage.createIfMissing` | `true` | Whether the kernel creates missing databases and schemas. Set `false` when the platform provisions them |
@@ -86,6 +86,38 @@ the binding is permanent, so adding a namespace never moves an existing
86
86
  database. The database user therefore needs the right to create databases
87
87
  unless `createIfMissing` is `false` and the platform creates them.
88
88
 
89
+ On MongoDB the kernel derives these names, with `storage.databaseNamePrefix`
90
+ in front of each. A database name returned by connection resolution is used
91
+ as is, without the prefix; grant that name. Some access ignores the resolver
92
+ and always uses `storage.connectionDetails` with the prefixed derived name:
93
+ jobs use the namespace database, and Orleans reminders and MongoDB cluster
94
+ membership use `chronicle+main`. When a resolver redirects storage, grant
95
+ those databases on the configured connection as well.
96
+
97
+ | Holds | Database name |
98
+ | --- | --- |
99
+ | Cluster state, membership and reminders | `chronicle+main` |
100
+ | Event store state shared by its namespaces | `<store>+es` |
101
+ | Events, observer state, jobs and constraints of a namespace | `<store>+es+<namespace>` |
102
+ | Read models of the `Default` namespace | `<store>` |
103
+ | Read models of a named namespace | `<store>+<namespace>` |
104
+ | Global confidentiality keys, only when encryption keys use global scope | `!chronicle-encrypted!+es+!chronicle-encrypted!` |
105
+
106
+ The kernel's own System event store uses three databases. Their derived
107
+ default names come from `storage.systemDatabaseName` (default `_system`):
108
+ `_system`, `_system+es` and `_system+es+Default`, each with the prefix;
109
+ connection resolution can replace them, and then you grant the resolved names.
110
+ A credential limited to the application's databases fails at startup with
111
+ `not authorized on _system` (or the System name in use). On a server shared with others, grant
112
+ `readWrite` on every database above under its actual names: the cluster
113
+ database, all three System databases, every store and namespace database, and
114
+ the global confidentiality-key database when it applies. MongoDB cannot grant by name prefix, so add the grants for a new event store or
115
+ namespace before creating it. On a server dedicated to Chronicle, grant
116
+ `readWriteAnyDatabase` instead; it covers new databases automatically. With
117
+ either role, removing a namespace also needs `dropDatabase` (for example
118
+ `dbAdmin` on that database): neither `readWrite` nor `readWriteAnyDatabase`
119
+ includes it.
120
+
89
121
  ## Resolve shared database ownership
90
122
 
91
123
  The bindings live in the cluster database's `DatabaseNames` table: `Kind`
@@ -3,6 +3,7 @@
3
3
  ## Contents
4
4
 
5
5
  - Choose the upgrade shape
6
+ - Cross major versions
6
7
  - Roll out a multi-node upgrade
7
8
  - When a new node does not come up
8
9
  - Back up and restore
@@ -38,6 +39,31 @@ Always take a restorable backup first. A starting node may migrate the storage
38
39
  schema, and there is no schema downgrade: the only way back is a restore.
39
40
  Reverting the image does not undo storage writes.
40
41
 
42
+ ## Cross major versions
43
+
44
+ Skipping majors is allowed, but the work is every boundary in between, so
45
+ read each major's upgrade notes in order before starting. Compile-time changes
46
+ accumulate and are fixed once against the target. Stored-state changes are
47
+ ordered and still apply when skipped: 6 → 7 (observer keys), 10 → 11 (job
48
+ state) and 13 → 14 (read-model and event-type layout). Across any of them,
49
+ take a backup you have restored from at least once, and rehearse the whole
50
+ path on a copy of production data, not on an empty database.
51
+
52
+ - Crossing 10 → 11 leaves in-flight job state unreliable. Let jobs whose
53
+ completion matters finish first.
54
+ - Do not land on 14.0.0 or 17.0.0. If your target is major 14 or 17, use
55
+ 14.0.1 or 17.0.1; they are not stops you must make on the way past.
56
+ - Compatibility runs one way and only within a major: the release gate checks
57
+ each kernel's wire contract against the first stable release of every
58
+ earlier minor of its major. It compares contracts; it does not run old
59
+ clients. A newer client against an older kernel is not checked, so upgrade
60
+ the kernel first or with its clients. Excluded releases are not covered: 16.x before
61
+ 16.45.0, 17.0.0 and 18.4.0. Across a major there is no guarantee. One
62
+ boundary was documented as compatible (8 → 9), but do not rely on that:
63
+ upgrade the kernel and its clients together across a major. 16 → 17 and
64
+ 17 → 18 change the wire contract. The TypeScript client has its own version
65
+ line, so test it against the kernel version you run.
66
+
41
67
  ## Roll out a multi-node upgrade
42
68
 
43
69
  1. Confirm the releases can share a cluster (above); otherwise stop every node
@@ -76,7 +102,7 @@ migrated on first access, while the cluster is serving.
76
102
  | `DatabaseMigrationIncomplete` | An object already exists but migrations are still pending | Restart once. If it repeats, repair the schema from a backup and verified evidence; do not delete migration history |
77
103
  | A startup step reports exhausted retries | The node could not reach its siblings | Check the silo and gateway ports between nodes and that no other node is restarting |
78
104
  | A startup step reports an incompatible release, or `Unable to resolve type alias` | Old and new versions cannot share a cluster | Roll the new node back, stop every node, then start the new version |
79
- | Live but never ready on a single node | Another kernel holds the single-writer lease on the same storage | Stop the other kernel; do not run two single-node kernels on one store |
105
+ | Live but never ready on a single node | Another kernel holds the single-writer lease on the same storage | Stop the other kernel; do not run two single-node kernels on one store. If the platform starts the replacement before stopping the old instance, enable lease standby ([Start-before-stop rollouts](configuration.md#start-before-stop-rollouts-of-a-single-node)) |
80
106
 
81
107
  ## Back up and restore
82
108
 
@@ -41,7 +41,7 @@ Do not combine the historical marker with `[EventType]`. For a third shape, poin
41
41
  - Each directional operation takes the **target first**. Unchanged paths pass through; use an empty override body if nothing changes in that direction. `RenamedFrom` reads a source property, including a nested selector such as `s => s.Address.Zone`. Paths follow serialized member names, including `[JsonPropertyName]` overrides.
42
42
  - `Split` takes a separator and zero-based part; `PropertySeparator.Space` is available for a single space. An integer such as `2` selects the third part. `Combine` joins sources in argument order. Reject or explicitly account for historic data with missing, extra or embedded separators.
43
43
  - `DefaultValue` writes a constant, not a computed value or a schema default. For a new member of every existing collection element, use `p.DefaultValue(t => t.Stops.Select(stop => stop.Mode), "rail")` with `System.Linq`. Do not use a null constant: the builder inspects the value's runtime type. Test the serialized form of concepts and complex literals.
44
- - For different forward and reverse tables, replace the paired `MapValues` override with directional calls inside `Properties`: `p.MapValues(t => t.State, s => s.State, m => m.Map("Q", "queued"))` on upcast, and `p.MapValues(t => t.State, s => s.State, m => m.Map("queued", "Q"))` on downcast. In a paired table, `For` takes current then previous selectors but `Map` takes previous then current values. First match wins; unmapped values pass through. Test absent separately from explicit null. Many-to-one pairs cannot recover the original value on reverse lookup.
44
+ - For different forward and reverse tables, replace the paired `MapValues` override with directional calls inside `Properties`: `p.MapValues(t => t.State, s => s.State, m => m.Map("Q", "queued"))` on upcast, and `p.MapValues(t => t.State, s => s.State, m => m.Map("queued", "Q"))` on downcast. In a paired table, `For` takes current then previous selectors but `Map` takes previous then current values. First match wins; unmapped values pass through. Test absent separately from explicit null. Many-to-one pairs cannot recover the original value on reverse lookup: the first pair declared for a current value supplies the previous value. Map the literal JSON value the migration reads. Enum values in a map are always written as their underlying numbers, which matches payloads under the default client serializer, so pass enum members. Keep enum properties of migrated events on that numeric serialization: if names are stored as strings, the migration sees names in some paths and numbers in others, because Chronicle converts recognized names to numbers for integer-enum properties during pinned delivery migration and for protected (for example PII) values.
45
45
 
46
46
  ## Register and validate
47
47
 
@@ -73,7 +73,7 @@ For this variant change the migration class header to `public class ParcelRoutin
73
73
  - Upcast `("west/42", "express", "Q")` and assert `("west", "42", "express", "queued", "rail")`; append that current payload and assert the old reader sees the original three values. Keep constraints on their corresponding paths. For personal data, retain `[property: PII]` (`Cratis.Chronicle.Compliance.GDPR`) on both old and renamed record parameters. Test release for the original subject, not just equality of unprotected fields.
74
74
  - Registration starts add-only historical backfill in the default namespace's event log. Check an old stored event there, and inventory other namespaces and sequences separately. Reading a transiently derived representation does not prove it was persisted.
75
75
  - Compatibility delivery (default) is not a pin. Set `options.EventGenerationDelivery = EventGenerationDelivery.Pinned` (`Cratis.Chronicle.Observation`) for pinned delivery. Declare exactly one generation per event ID for that observer: a pinned reactor, reducer, projection or subscription that names two generations of one ID is refused with `MultipleGenerationsOfEventTypeInObserver`. To consume two generations, use two observers. For explicit event-store subscriptions use `subscription.WithGenerationDelivery(EventGenerationDelivery.Pinned).WithEventType("parcel-routed", 1)`; webhook definition builders also accept `WithGenerationDelivery`. Verify the actual generation and business values on live and catch-up delivery.
76
- - The client-wide option pins reactors, reducers and typed materialized projections; a projection pins the generation each `From`, join, child, key and removal clause names, one generation per event ID across all clauses. It does not pin subscriptions, webhooks, or immediate, passive or wildcard projections. In a handler, `EventContext.EventType.Generation` is the delivered generation and `EventContext.AppendedGeneration` the original one (null when unknown). A pin that is unregistered or unreachable by migration fails with `PinnedEventTypeGenerationUnavailable`. Changing a pin or delivery mode does not replay; request a replay to rebuild prior state.
76
+ - The client-wide option pins reactors, reducers and typed materialized projections; a projection pins the generation each `From`, join, child, key and removal clause names, one generation per event ID across all clauses. It does not pin subscriptions, webhooks, or immediate, passive or wildcard projections. In a handler, `EventContext.EventType.Generation` is the delivered generation and `EventContext.AppendedGeneration` the original one (null when unknown). A delivery migrated to the pin at delivery time has `EventContext.Hash == EventHash.NotSet` (`Cratis.Chronicle.Events`). This happens when the pinned generation is not stored yet, or when a revised event's latest revision is at another generation, even if the original pinned representation is stored. Otherwise the delivery carries the hash stored for the selected representation, if one was recorded. Do not deduplicate retries on the hash. For reactor side-effect receipts, declare a `ReactorDelivery` handler parameter (`Cratis.Chronicle.Reactors`) and key on its `Id`; it is the same on retry and replay, so do not use that receipt to skip rebuilding state. A revision keeps the sequence number and requests a replay only for affected observers marked replayable. A pin that is unregistered or unreachable by migration fails with `PinnedEventTypeGenerationUnavailable`. Changing a pin or delivery mode does not replay; request a replay to rebuild prior state.
77
77
  - The kernel checks pins again when a client observer, subscription or webhook is registered, and refuses it with: `ObserverPinsMultipleGenerationsOfEventType` (two generations of one ID; use two observers), `EventTypeGenerationNotRegisteredForObserver` (the exact pinned generation is not registered; register the generation and its migration first) or `EventGenerationDeliveryNotSupported` (pinned delivery asked of an observer that cannot provide it, such as a projection over all events or a graph projection; use compatibility delivery there).
78
78
  - A pinned event store subscription must name at least one pin, or it is refused with `EventStoreSubscriptionHasNoGenerationPins`, and each pinned generation must be registered in both the source and the target store. If a generation becomes unavailable during delivery, the failure is `EventStoreSubscriptionGenerationUnavailable` and the partition is parked: register the generation in both stores, then retry the partition.
79
79
  - `ReactorScenario` and `ReadModelScenario` exercise the handler with the type you feed them; they do not emulate kernel generation selection, migration or protected-value release. Prove pinned delivery with a real client against a kernel.
@@ -17,7 +17,7 @@ For authorized recovery, use the client reference if it covers the operation; ot
17
17
  1. Start from the accepted event: record store, namespace, sequence, actual position, event type and source ID. Identify the expected observer and its partition key; do not assume that every observer partitions by source ID.
18
18
  2. List registrations in that store and namespace. Match the observer ID **and sequence**. A successful list without the observer calls for checking scope and registration, not waiting for catch-up. A failed read does not establish absence.
19
19
  3. Compare its **last handled** actual position to the accepted position. Ignore reserved positions, not zero. A smaller position can indicate lag; confirm the observer handles this event type. A position at or beyond the write does not establish that this partition succeeded.
20
- 4. Read failed partitions for that observer and match the partition. Check the attempt position and time, and distinguish an unresolved failure from recorded history. An empty result means no recorded failure in this lookup, not proof of delivery.
20
+ 4. Read failed partitions for that observer and match the partition. Check the attempt position and time. A returned record is usually unresolved, but honor a reported resolved flag. It is usually a failure; a deferred partition (such as a webhook waiting out its target) can have no failed attempt. Chronicle normally deletes the record once the partition recovers or the observer is fast-forwarded past it, so there is no resolved history to read. An empty result means only that this lookup found no matching record, not recovery or delivery.
21
21
  5. Report scope, observer, running state, actual positions, partition and last relevant failure category without payloads, raw messages or stacks. If progress has reached the event without a matching failure, verify the expected persisted result or external effect separately. Stop before changing state.
22
22
 
23
23
  ## Inspection catalog
@@ -28,9 +28,9 @@ For authorized recovery, use the client reference if it covers the operation; ot
28
28
  - **Running state** distinguishes active, suspended, replaying, disconnected, quarantined and unknown; use the state-change time when available to correlate a transition with the incident.
29
29
  - **Last handled, next expected and sequence tail** answer different questions: compare actual positions only within the same sequence. The next position is not a completed delivery.
30
30
  - **Lag measurement**, where the SDK offers it, reports tail minus last handled per observer; it summarises the same positions and is no substitute for the partition check.
31
- - **Handled count** measures activity, not the position of a particular event. **Replayability** describes policy, not whether a replay has run.
31
+ - **Handled count** is an approximate diagnostic, not bookkeeping: it can lag or drift from the events actually handled and can over-count after an ambiguous storage acknowledgement. The server never uses it to decide delivery, catch-up or replay; those use sequence positions. Never use it for billing or as proof of completion or delivery: judge progress from positions and failed partitions, and count business outcomes from records the application writes. **Replayability** describes policy, not whether a replay has run.
32
32
  - **Observer-scoped failures** identify affected partitions; list failures across the namespace only to investigate an incident spanning observers.
33
- - **Failure record ID, observer ID and partition** identify a failure history. Resolution and partition quarantine are independent; an unavailable flag does not mean false.
33
+ - **Failure record ID, observer ID and partition** identify a partition record: a failure or a deferral. Deferring adds no attempt, but earlier attempts remain. A reported resolved flag means the record is no longer outstanding. Partition quarantine is a separate flag; an unavailable flag does not mean false.
34
34
  - **Attempt history** gives time, sequence position, messages and stack for private diagnosis. Where classified, handling means subscriber rejection, timeout means no timely reply, disconnected means no subscriber at delivery, and unknown supplies no cause.
35
35
  - **Registration wait**, on the process that registers the observer, tells whether its definitions reached the server; it does not show that the observer is subscribed or caught up.
36
36
  - **Append-completion wait**, for a write already accepted, asks the server to wait within a time budget until observers on the write's sequence reach its position or record a failed partition. The SDKs differ in what it needs (the original append result or a known accepted position), whether it narrows to the appended event types, and whether a timeout returns outstanding observers or only an error: check Append-completion wait in your language reference before relying on it. Success is also reported when no observer matches, so it proves neither registration nor handling by the expected observer; a reported failed partition can predate this write; a timeout without a recorded failure is inconclusive. Never append again to obtain a result.
@@ -54,4 +54,4 @@ Global projections receive a recommendation rather than an automatic rebuild. Fo
54
54
 
55
55
  Retry, quarantine clearance, replay, fast-forward, failure deletion, observer removal and job changes are **not inspection**. Fast-forward skips work; retry or replay may repeat effects. Hand the evidence to the operator before choosing a repair.
56
56
 
57
- Inspect any returned outcome: a call that completes is not a repair that happened. Stopping or resuming a job is refused when the job is not found, has already completed, is not running, could not be saved or was not taken forward; completed and failed jobs cannot be deleted. Observer removal applies to the whole event store, not one namespace, and is refused while the observer runs or a client still subscribes or declares it anywhere; it deletes the observer's bookkeeping and leaves read-model data in place. Removal is not a reset: an observer registered again afterwards starts from the beginning.
57
+ Inspect any returned outcome: a call that completes is not a repair that happened. Stopping a job is refused when the job is not found, has failed or completed, is not running or could not be saved; a resume is refused only as not taken forward, and resuming a completed job whose record is still kept reports acceptance; the delete command refuses completed and failed jobs, but retention cleanup can still remove them. Observer removal applies to the whole event store, not one namespace. A reactor or reducer is refused while it runs or has a subscribed client in any namespace. A projection is refused while it is kernel-owned or a connected client is tracked as declaring it; an active kernel subscription alone does not block it, and older clients that send no connection identifier are not tracked. Removal deletes the observer's bookkeeping and leaves read-model data in place. Removal is not a reset: an observer registered again afterwards is treated as new and follows its initial-position policy, usually the beginning, but the tail for a reactor configured to start at the tail.
@@ -27,7 +27,7 @@ var activity = (row.Type, row.RunningState, row.RunningStateChangedAt, row.Handl
27
27
 
28
28
  Don't turn a failed read into an empty list. On the registering host, `await eventStore.WaitForRegistration()` (`Cratis.Chronicle.Registrations`) waits for the local registration run: inspect its `IsSuccess`, `Failure` and `Failures` rather than treating a wait timeout as an artifact failure.
29
29
 
30
- `RunningState` is `Active`, `Suspended`, `Replaying`, `Disconnected`, `Quarantined` or `Unknown`; a null transition time means unavailable. `HandledEventCount` measures activity. `next` is expected, not handled. Check `IsActualValue` before displaying or comparing any position: zero is real; `BeforeFirst`, `Max` and `Unavailable` are not. Even `behind == false` does not prove partition success.
30
+ `RunningState` is `Active`, `Suspended`, `Replaying`, `Disconnected`, `Quarantined` or `Unknown`; a null transition time means unavailable. `HandledEventCount` is approximate (it can lag, drift or over-count); never bill from it or use it to prove completion. `next` is expected, not handled. Check `IsActualValue` before displaying or comparing any position: zero is real; `BeforeFirst`, `Max` and `Unavailable` are not. Even `behind == false` does not prove partition success.
31
31
 
32
32
  ## Inspect subscription and tail
33
33
 
@@ -53,7 +53,7 @@ var failures = await eventStore.FailedPartitions.GetFailedPartitionsFor(row.Id);
53
53
  foreach (var failure in failures.Where(f => f.Partition.Value == key))
54
54
  {
55
55
  var identity = (failure.Id, failure.ObserverId, failure.Partition);
56
- var flags = (failure.IsResolved, failure.IsQuarantined);
56
+ var quarantined = failure.IsQuarantined; // null = unknown
57
57
  foreach (var attempt in failure.Attempts.OrderBy(a => a.Occurred))
58
58
  {
59
59
  var evidence = (attempt.Occurred, attempt.SequenceNumber, attempt.Kind);
@@ -62,7 +62,7 @@ foreach (var failure in failures.Where(f => f.Partition.Value == key))
62
62
  }
63
63
  ```
64
64
 
65
- `IsResolved` separates history from unresolved failures; `IsQuarantined` can be null (unknown). A different partition or attempt position does not identify this write. `Kind` is `Handling`, `Timeout`, `Disconnected` or `Unknown` (default); don't infer rejection from a timeout. With no matching failure, verify the persisted result or external effect independently.
65
+ A returned record is usually unresolved; if `IsResolved` is true, treat it as resolved. It is usually a failure, but a deferred partition (such as a webhook waiting out its target) can have empty `Attempts` or keep earlier ones. Chronicle normally deletes a record when the partition recovers or the observer is fast-forwarded past it; absence means only that the lookup found no match, not recovery. `IsQuarantined` can be null (unknown). A different partition or attempt position does not identify this write. `Kind` is `Handling`, `Timeout`, `Disconnected` or `Unknown` (default); don't infer rejection from a timeout. With no matching failure, verify the persisted result or external effect independently.
66
66
 
67
67
  - For a cross-observer incident use `await eventStore.FailedPartitions.GetAllFailedPartitions()` in this namespace. For a known reactor or reducer use its collection's `GetFailedPartitionsFor<T>()` or `GetFailedPartitionsFor(typeof(T))`.
68
68
  - For projections use `eventStore.Projections.GetFailedPartitionsFor<StockListingProjection>()` or `GetFailedPartitionsForModel<StockListing>()`; the latter accepts a runtime model `Type` too. `GetFailedPartitionsFor(Type)` accepts either projection or model type.
@@ -91,13 +91,14 @@ These are not inspection. Run one only on an explicit, authorized request, after
91
91
 
92
92
  | Call | Result to check |
93
93
  | --- | --- |
94
- | `await eventStore.Jobs.Stop(jobId)` / `Resume(jobId)` | `JobCommandResult`: `Accepted`, otherwise `Refusal` is `NotFound`, `JobIsCompleted`, `JobIsNotRunning`, `CouldNotPersist` or `NotResumed`. Accepted is not finished |
94
+ | `await eventStore.Jobs.Stop(jobId)` | `JobCommandResult`: `Accepted`, otherwise `Refusal` is `NotFound` (also reported for a `Failed` job), `JobIsCompleted`, `JobIsNotRunning` or `CouldNotPersist`. Accepted is not finished |
95
+ | `await eventStore.Jobs.Resume(jobId)` | `JobCommandResult`: `Accepted`, otherwise `Refusal` is always `NotResumed`, including for a missing or `Failed` job. Resuming a completed job reports `Accepted` while its record is still kept, so read its status before reporting it resumed |
95
96
  | `await eventStore.Jobs.Delete(jobId)` | Nothing; a later `GetJob` returning null does not tell success from cleanup |
96
97
  | `await eventStore.Observers.Remove(observerId)` | `ObserverRemovalResult`: `IsRemoved`, otherwise `Outcome` is `ObserverNotFound`, `ObserverActive` or `ObserverSubscribed`, and `BlockingNamespace` names where |
97
98
 
98
99
  - **Job status** is `PreparingJob`, `PreparingSteps`, `StartingSteps`, `Running`, `CompletedSuccessfully`, `CompletedWithFailures`, `Stopped`, `Failed` or `Removing`.
99
- - **Waiting for a job** (`Cratis.Chronicle.Jobs`): `await eventStore.Jobs.WaitTillJobProgressCompleted(jobId, timeout)` returns the job once its progress is complete, which can include failed steps: check `Status`. `WaitForJobsToDrainSuccessfully(timeout)` waits for no jobs to remain and throws `JobFailedWhileWaiting` (with the failed `Job`) as soon as one fails. The default timeout is the same as for the append-completion wait. An expired wait throws `TaskCanceledException`; a job that was cleaned up before the wait saw it also ends that way.
100
- - **Removing an observer** is for one whose declaring code is gone and that stays `Disconnected`. It covers every namespace of the store and is refused while the observer runs or has a subscribed client anywhere: stop the declaring application first. Read model data and sink storage are left untouched.
100
+ - **Waiting for a job** (`Cratis.Chronicle.Jobs`): both waits act only on what each poll of the job list returns, and a failed job-storage read can come back as an empty list. `await eventStore.Jobs.WaitTillJobCompletesOrIsDeleted(jobId, timeout)` returns the job once a poll sees it `CompletedSuccessfully`, `CompletedWithFailures` or `Failed`, or `null` once a poll does not find it. `null` means not found, not successful: a job that succeeds is normally removed (replay included), a deleted job is gone, and a `RetryFailedPartition` job that ends `CompletedWithFailures` is removed too (one that ends `Failed` is kept until cleanup). Confirm with the observer's state and failed partitions. A stopped job does not end the wait. Don't use `WaitTillJobProgressCompleted`: it waits for the job's progress to report completed, not for a final status, and times out when the job is already gone. `WaitForJobsToDrainSuccessfully(timeout)` returns once a poll finds no jobs and throws `JobFailedWhileWaiting` (with the `Job`) when a poll sees one `Failed` or `CompletedWithFailures`; a job removed between polls goes unseen, so a drain is not proof of success or that no jobs remain. The default timeout is the same as for the append-completion wait. The timeout cancels only the delay between polls: an expired wait throws `TaskCanceledException` and is inconclusive, and a poll already in progress can still return a result after the deadline.
101
+ - **Removing an observer** is for one whose declaring code is gone and that stays `Disconnected`. It covers every namespace of the store. A reactor or reducer is refused while it runs or has a subscribed client in any namespace; a projection is refused while a connected client is tracked as declaring it, not merely because its kernel subscription is active. Stop the declaring application first. Read model data and sink storage are left untouched.
101
102
  - Retry, quarantine clearance, replay and fast-forward for a reactor are in `cratis-chronicle-react-to-fact`.
102
103
 
103
104
  ## Not supported in this SDK
@@ -122,7 +123,7 @@ public static class Recovery
122
123
  }
123
124
  ```
124
125
 
125
- `Started` means recovery started; `Accepted` means a job was accepted. Neither proves completion. `PartitionNotFound` means no matching failure; `ObserverQuarantined` and `PartitionQuarantined` identify different fences. Treat `Unknown` and unrecognized values as inconclusive. Re-read `await store.Reactors.GetFailedPartitionsFor<T>()` and inspect `IsResolved`, `IsQuarantined` and `Attempts` on the matching `Partition`.
126
+ `Started` means recovery started; `Accepted` means a job was accepted. Neither proves completion. `PartitionNotFound` means no matching failure; `ObserverQuarantined` and `PartitionQuarantined` identify different fences. Treat `Unknown` and unrecognized values as inconclusive. Re-read `await store.Reactors.GetFailedPartitionsFor<T>()`. A record for the `Partition` with `IsResolved` false means it is still unresolved: inspect `IsQuarantined` and `Attempts`. Absence only means the record is gone; fast-forward also deletes it without delivering anything. Verify the partition's persisted result or external effect before reporting recovery.
126
127
 
127
128
  With explicit authorization, `await store.Reactors.ClearFailedPartitionQuarantineFor<T>(partition, retryImmediately: false)` requests clearance of only the partition fence, without an immediate retry; automatic retries then resume on the normal retry schedule. The default also requests an immediate retry. Read `Outcome` (`Cleared`, `NotFound`, `NotQuarantined`, `Accepted`, `Unknown`); `Accepted` does not confirm clearance. Examine `RetryOutcome` only for `Cleared` when an immediate retry was requested; it does not prove recovery completed. These extensions require an `IReactors` implementation supporting `IReactorPartitionRecovery`.
128
129
 
@@ -62,7 +62,7 @@ failures, err := obs.FailedPartitions(ctx, id)
62
62
  if err != nil { return err }
63
63
  for _, f := range failures {
64
64
  if f.Observer() != id || f.Partition() != partition { continue }
65
- fmt.Printf("record=%s resolved=%t quarantined=%t\n", f.ID(), f.IsResolved(), f.IsQuarantined())
65
+ fmt.Printf("record=%s resolved=%t reportedQuarantined=%t\n", f.ID(), f.IsResolved(), f.IsQuarantined())
66
66
  for _, a := range f.Attempts() {
67
67
  if p := a.Position(); p.IsActualValue() {
68
68
  fmt.Printf("position=%d at=%v kind=%d\n", p, a.Occurred(), a.Kind())
@@ -71,7 +71,7 @@ for _, f := range failures {
71
71
  }
72
72
  ```
73
73
 
74
- Attempts retain server order. Correlate their times and positions with the write, including earlier failures blocking the partition. `HandlingFailure`, `TimeoutFailure`, `DisconnectedFailure` and `UnknownFailure` distinguish handler error, timeout, disconnect and unspecified cause; preserve unrecognized numeric kinds. Reserve `a.Messages()` and `a.StackTrace()` for private diagnosis. Clearing quarantine does not imply resolution; resolved history is not a current blocker. No matching failure is not proof of delivery.
74
+ Attempts retain server order. Correlate their times and positions with the write, including earlier failures blocking the partition. `HandlingFailure`, `TimeoutFailure`, `DisconnectedFailure` and `UnknownFailure` distinguish handler error, timeout, disconnect and unspecified cause; preserve unrecognized numeric kinds. Reserve `a.Messages()` and `a.StackTrace()` for private diagnosis. Clearing quarantine does not imply resolution. `IsQuarantined()` returns `false` both when the partition is not quarantined and when the server did not report the flag, so treat `false` as possibly unknown. A returned record is usually unresolved; if `IsResolved()` is true, treat it as resolved. It is usually a failure, but a deferred partition (such as a webhook waiting out its target) can have no attempts or keep earlier ones. Chronicle normally deletes a record once its partition recovers or the observer is fast-forwarded past it; absence means only that the lookup found no match, not recovery. No matching failure is not proof of delivery.
75
75
 
76
76
  ## Append-completion wait
77
77
 
@@ -155,7 +155,7 @@ Configure a server only when setup is the task; `cratis ai` does not register it
155
155
  | `ModelCatalog.Roots` | none | Map aliases to read-only directories of Screenplay models (up to 16) |
156
156
  | `ModelCatalog.Models` | none | Publish up to 64 manifests as an indexed array, each with `Name`, `Root`, `Entry` and `Files` (1–16 `.play` paths). Needs Linux with `openat2` and operator-controlled read-only roots; every audit caller can select every published name |
157
157
 
158
- - `--config /absolute/path.json` or `CHRONICLE_MCP_CONFIG` — select one JSON configuration file; environment options override it.
158
+ - `--config /absolute/path.json`, or `CHRONICLE_MCP_CONFIG` set to an absolute path — select one existing, valid JSON configuration file; the flag wins if both are set. An environment variable overrides only the matching file key; lists merge by index rather than being replaced, so define each authorization list in one source. Any other server argument fails startup.
159
159
  - `CHRONICLE_CONNECTION_STRING` — destination used when no `ConnectionString` option is set.
160
160
  - `CHRONICLE_CONNECT_TIMEOUT_SECONDS` — connect timeout for a slow server (5 seconds unless set).
161
161
 
@@ -33,7 +33,7 @@ The server runs as the `cratis/chronicle-mcp` container image and speaks MCP ove
33
33
 
34
34
  A connection string alone is not enough unless it embeds credentials. In `ReadOnly` the server starts and lists its tools without resolving the connection, so a missing destination, missing credentials or an unreadable CLI configuration file surfaces as an error on the first tool call; `Mutation` resolves the connection at startup and refuses to start when it cannot. On macOS and Windows a kernel on the host is reached from the container at `host.docker.internal`, not `localhost`. The container has its own filesystem: mount a CLI configuration file or model catalog directory read-only if the server must read it. After registering, request `tools/list` and call `get_server_version` to confirm the profile and the connection.
35
35
 
36
- Configuration comes only from environment variables and, optionally, one JSON file selected by `--config /absolute/path.json` (or `CHRONICLE_MCP_CONFIG`; the argument wins). Environment options override the file. No `appsettings.json` is discovered from the working directory, relative paths are rejected, and the file is read once at startup: restart the server after changing the file, the environment or the profile.
36
+ Configuration comes only from environment variables and, optionally, one JSON file selected by `--config /absolute/path.json` (or `CHRONICLE_MCP_CONFIG`; the argument wins). An environment variable overrides only the matching file key; it does not replace a list, because list entries merge by index across sources. Define each authorization list in one source. A selected file must exist and contain valid JSON, or the server does not start. The only accepted argument is `--config` followed by an absolute path; any other argument, including a `--Section:Key=value` override, fails startup, so set such values in the file or in an environment variable named by the setting's full key with `__` between segments: `Cratis__Chronicle__Mcp__<Option>` for MCP options, `Logging__LogLevel__Default` for the log level. No `appsettings.json` is discovered from the working directory, relative paths are rejected, and the file is read once at startup: restart the server after changing the file, the environment or the profile.
37
37
 
38
38
  ## Target and credentials
39
39
 
@@ -66,7 +66,7 @@ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Nod
66
66
  | Event sequence | Read one other sequence instead of the event log (for example an inbox), by exactly the id the appends use. Sequences never merge: append every mapped event type there (the same type appended elsewhere never reaches it), or use one projection per sequence. |
67
67
  | Passive | Compute on read, store nothing; event-source-id key only. |
68
68
  | NotRewindable | Mark the definition as non-rewindable; this flag alone does not prevent observer replay. |
69
- | Container name | Store under an explicit collection or table name. Changing it for an existing read model is refused unless done as a coordinated migration. |
69
+ | Container name | Store under an explicit collection or table name. Changing it for an existing read model, even only its casing, makes ordinary registration reject the client's whole read-model batch. To change it on purpose, update the definition with the kernel's `UpdateDefinition` operation, then deploy matching clients; no data is moved or rebuilt. |
70
70
  | Initial values | Starting defaults, captured once in the definition, not a callback per event. Every new instance starts from them, also when child events reached it first; event mappings apply on top. Prefer them to a constant set by one creating event, which misses instances other events create. They never fill a Children collection. |
71
71
  | AutoMap / NoAutoMap | AutoMap is on and copies same-named properties; NoAutoMap limits a scope or one property to explicit mappings. |
72
72
  | NotProjected | The property is filled by the query, not by the projection. |
@@ -153,7 +153,7 @@ public class ProductSalesProjection : IProjectionFor<ProductSales>
153
153
  .Set(m => m.CustomerName).To(e => e.Name))
154
154
  ```
155
155
 
156
- `On` names the read-model member holding the match value; live joins match the joined event’s source ID by default, or its explicit `UsingKey` value. `On` does not rename anything: map each differently named property with `Set`. A join updates existing instances and never creates one. In a child scope, `children.Join<TEvent>()` joins on the child’s identity and takes the same property operations.
156
+ `On` names the read-model member holding the match value; live joins match the joined event’s source ID by default, or its explicit `UsingKey` value; a root join falls back to the source ID when that value is null. `On` does not rename anything: map each differently named property with `Set`. A join-only event updates existing instances and never creates a root; an independent keyed `From` for the same event can create one. In a child scope, `children.Join<TEvent>()` joins on the child’s `IdentifiedBy` member and takes the same property operations; it has no `On`. Call `IdentifiedBy` before `Join`; otherwise building the projection throws `MissingIdentifiedByPropertyExpressionWhenJoiningWithEvent` at startup.
157
157
 
158
158
  Root backfill looks up earlier joined events by source ID, not by `UsingKey`. Use source IDs for joins that must work in either event order. If the explicit key differs, create the root with its match value before appending the joined event. Backfill runs after local mappings and can overwrite them, so give each field one owner.
159
159
 
@@ -84,7 +84,7 @@ public record OrderBalance(
84
84
  [SubtractFrom<AmountRefunded>(nameof(AmountRefunded.Amount))] decimal Charged);
85
85
  ```
86
86
 
87
- A member with `[ClearWith]` must be nullable; the analyzer reports a non-nullable one and building the projection throws `CannotClearNonNullableMember`.
87
+ A scalar clear (`[ClearWith]` or `[SetValue<TEvent>(null)]` on an ordinary member) needs a nullable member: `string?`, `DateTimeOffset?`. A `[ClearWith]` on a `[Nested]` member is different: it clears the whole nested object and is not subject to this check. On a non-nullable member with a scalar clear the analyzer reports CHR0048, and building the projection throws `CannotClearNonNullableMember` at startup even when CHR0048 is suppressed. A reference type compiled with nullable analysis disabled is not checked, so `#nullable disable` hides the problem for `string`; a value type that is not `Nullable<T>` (`DateTimeOffset`) always fails. Make the member nullable; do not use a placeholder such as `""` for "no value".
88
88
 
89
89
  ## Every handled event and all events
90
90
 
@@ -19,6 +19,8 @@
19
19
  | `ReadModels.Materialized.GetInstances<Order>(skip, take)` | A page from the sink; default skip 0, take 50 (also for observed pages). |
20
20
  | `ReadModels.GetSnapshotsById<Order>(key)` | `ReadModelSnapshot<Order>` per correlation group: `Instance`, `Events`, `Occurred`, `CorrelationId`. |
21
21
 
22
+ `key` is a `ReadModelKey`; a `string`, `Guid` or `EventSourceId` converts to it implicitly. A composite key record does not convert, and a string form of it is not a safe `GetInstanceById` key on MongoDB or SQL. Look a composite-keyed instance up by its named key parts instead: the kernel's `FindByCompositeKey` read-model lookup (gRPC service `ReadModelLookups`, also used by the Workbench) takes the read model id and each part by name as a JSON literal, for a materialized read model on either sink. It reports not found, invalid key or ambiguous legacy key rather than guessing. The C# client has no wrapper for it.
23
+
22
24
  Use `ReadModelSessionId.New()` for a reusable read session: pass `sessionId` to `GetInstanceById<Order>(key, sessionId)` and finish with `await models.DehydrateSession(sessionId, typeof(Order), key)` on the same `IReadModels models`. This does not guard an append.
23
25
 
24
26
  A source can declare a named stream with `[Cratis.Chronicle.EventSources.EventStream("Shipments")]` on its `IEventSource` definition. Scope a model to one such stream:
@@ -58,7 +58,7 @@ Thrown while the definition is built or registered; fix the declaration.
58
58
 
59
59
  | Exception | Cause |
60
60
  | --- | --- |
61
- | `InvalidPropertyForType` | A model-bound annotation names a property that does not exist (names are unchecked strings) |
61
+ | `InvalidPropertyForType` | A validated model-bound path names an event or event-context property whose first path segment (compared case-insensitively) does not exist, including a name defaulted from the annotated property (such as `@Join` without `eventPropertyName` on a Kotlin model property). Not checked: `@Join`'s `on` (a read-model property), `@SetFrom` without an event type, and the payload `property` of `@FromEvery` or `@FromAll` |
62
62
  | `UnknownReadModelProperty` | A builder call names a property the target type does not have |
63
63
  | `ChildrenOrderingAlreadyDefined`, `ConflictingChildrenOrdering` | A child collection given more than one ordering |
64
64
  | `VariantMustDeclareEntersOnEvent` | A variant without the event that activates it |
@@ -28,7 +28,7 @@ Append `TicketOpened("Replace valve")` on source `t1`; after processing, `store.
28
28
 
29
29
  ## Event and property operations
30
30
 
31
- - On a target field `@Join(TeamNamed::class, on = "teamId", eventPropertyName = "name")` follows the stored team ID. Fluent equivalent: `builder.join(TeamNamed::class) { it.on("teamId").set<String>("teamName").toProperty("name") }`. Join supports `setOnce` as well as `set`.
31
+ - Put `@Join` on a Kotlin property, not with `@field:`, which the reader misses. A join needs the team ID already stored on the ticket. `TicketOpened` above carries none, so declare `@EventType data class TicketAssigned(val teamId: String)`, add `@FromEvent(TicketAssigned::class)` and `val teamId: String = ""` to `Ticket` (matching names auto-map) and append it on the ticket's source. Then `@Join(TeamNamed::class, on = "teamId", eventPropertyName = "name") val teamName: String = ""` follows the stored team ID. `on` names the read-model property that holds the joined source's ID; Chronicle matches it against the joined event's event source ID, so the event payload need not repeat that ID. Every `@Join` for one event type shares a single `on`, taken from the first mapping, so give them all the same `on`. `on` and `eventPropertyName` both default to the annotated property's own name; set `eventPropertyName` whenever the event field you want has a different name. If the defaulted name is missing from the event, registration throws `InvalidPropertyForType`; if the event has a field with that name, that field is mapped without error. Fluent equivalent: `builder.join(TeamNamed::class) { it.on("teamId").set<String>("teamName").toProperty("name") }`; `on`, `set` and `setOnce` also accept property references such as `it.on(Ticket::teamId)`.
32
32
  - `@RemovedWith(TicketClosed::class)` deletes by key; `@RemovedWithJoin(TeamDeleted::class)` deletes by join. Fluent `removedWith` accepts `usingKey` and `usingParentKey`; `removedWithJoin` accepts `usingKey`.
33
33
  - `@SetValue(TicketClosed::class, "closed")` assigns a literal (write numeric and boolean constants as text); `clear = true` instead of a value clears a nullable field. `@SetFromContext(TicketOpened::class, "occurred")` copies context. Add `setOnce = true` to `SetFrom` or `SetFromContext` for first nonempty assignment.
34
34
  - In a `from` block use `it.set(Ticket::id).toEventSourceId()`; other assignment sources include `toValue("open")`, `toProperty("subject")`, `toEventContextProperty("occurred")`, and `toCausedBy(CausedByProperty.SUBJECT)` (`NAME` and `USER_NAME` are for display). Use `setOnce` instead of `set` for first assignment.
@@ -62,8 +62,8 @@ Thrown while the definition is built or registered; fix the declaration.
62
62
 
63
63
  | Exception | Cause |
64
64
  | --- | --- |
65
- | `InvalidPropertyForType` | A model-bound annotation names a property that does not exist (names are unchecked strings) |
66
- | `UnknownReadModelProperty` | A builder call names a property the target type does not have |
65
+ | `InvalidPropertyForType` | A validated model-bound path names an event or event-context property whose first path segment (compared case-insensitively) does not exist, including a name defaulted from the annotated property (such as `@Join` without `eventPropertyName`). Not checked: `@Join`'s `on` (a read-model property), `@SetFrom` without an event type, and the payload `property` of `@FromEvery` or `@FromAll` |
66
+ | `UnknownReadModelProperty` | A builder call names a property the target type does not have, or `@ChildrenFrom`'s `orderBy` or `orderByDescending` names a property the child type does not have |
67
67
  | `ChildrenOrderingAlreadyDefined`, `ConflictingChildrenOrdering` | A child collection given more than one ordering |
68
68
  | `VariantMustDeclareEntersOnEvent` | A variant without the event that activates it |
69
69
  | `GlobalHandlerPropertyNotOnVariant` | A shared (global) handler maps a property one variant lacks |
@@ -218,6 +218,8 @@ if (!completion.isSuccess) throw new Error('Observer did not complete');
218
218
  const order = await store.readModels.findInstanceById(Order, orderId);
219
219
  ```
220
220
 
221
+ In an Arc application these are different tools (see `cratis-arc-expose-query`). `ChronicleReadConsistency.Immediate` is a read mode only for passive model-bound projections; it is rejected for active ones. A command's `completionTimeoutMs` opts it into waiting for observer completion after the append; the wait also blocks on observers that do not handle the appended events.
222
+
221
223
  For a readiness barrier, start consuming the watcher, await `watcher.subscribed` before appending and `watcher.dispose()` in `finally`. `resume: true` reconnects but does not replay missed updates; registering an `onResubscribed` callback also enables resume. `maxBuffered` sets a fail-on-overflow limit rather than default backpressure.
222
224
 
223
225
  ## Operate