@cratis/pi 7.3.2 → 7.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package/corpus/rules/reactors.md +1 -1
- package/package/corpus/skills/cratis-chronicle-cli-operations/SKILL.md +6 -2
- package/package/corpus/skills/cratis-chronicle-client-dotnet/SKILL.md +6 -6
- package/package/corpus/skills/cratis-chronicle-compliance/SKILL.md +7 -0
- package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +4 -2
- package/package.json +1 -1
|
@@ -195,7 +195,7 @@ The default is fire-and-forget. When a caller's correctness depends on all obser
|
|
|
195
195
|
2. **Use event data directly** — Never query the read model back inside a reactor. The event contains all the information you need.
|
|
196
196
|
3. **Return events and commands instead of injecting the plumbing** — If the reactor needs to produce new events, return them directly as `Task<TEvent>`, `Task<EventForEventSourceId>`, or a collection thereof. For intent in another slice, return the `[Command]` (Arc executes it; a denied or invalid result fails the partition) — or inject `ICommandPipeline` and inspect the result. Either way the handler is `[OnceOnly]`. Avoid injecting `IEventLog` directly into a reactor.
|
|
197
197
|
4. **Single responsibility** — Each reactor class should have a focused purpose. Multiple handler methods in one reactor are fine if they serve the same automation concern.
|
|
198
|
-
5. **Failure behavior** — If a reactor throws, *or* a returned side-effect event fails to append (constraint violation, concurrency violation, or error), the failing event-source partition pauses until the issue is resolved. Repeated failures can **quarantine** the observer: once `QuarantineOnFailedPartitionCount`/`QuarantineOnFailedPartitionPercentage` (under `Observers`) is crossed, the observer enters the `Quarantined` state — reminders cancelled, retries stopped, automatic recovery suppressed. **A
|
|
198
|
+
5. **Failure behavior** — If a reactor throws, *or* a returned side-effect event fails to append (constraint violation, concurrency violation, or error), the failing event-source partition pauses until the issue is resolved. Repeated failures can **quarantine** the observer: once `QuarantineOnFailedPartitionCount`/`QuarantineOnFailedPartitionPercentage` (under `Observers`) is crossed, the observer enters the `Quarantined` state — reminders cancelled, retries stopped, automatic recovery suppressed. **A quarantine ends when an operator clears it (`ClearObserverQuarantine()`), or when the observer is subscribed again** — for an application observer that is when the client connects again, for example after a redeploy; Kernel-owned observers are subscribed again when the Kernel starts. A periodic watchdog (default 60s, `WatchdogInterval`) re-routes stuck/dead observers but does not rescue quarantined ones. Design for resilience.
|
|
199
199
|
6. **Don't throw to validate malformed inbound events** — reactors are not data-quality validators; invalid payloads must be rejected at the command/append site. When a malformed cross-service fact reaches a consumer, throwing just to reject it pauses the partition and can quarantine the whole observer. Instead append a clear failure/dead-letter event (e.g. `ProvisioningFailed`) or surface it via the operational failure path, and skip partial side effects.
|
|
200
200
|
7. **No state** — Reactors should be stateless. Inject dependencies via primary constructor, but do not store mutable state on the class.
|
|
201
201
|
8. **An unattended, irreversible pass reads the log, not the sink — and carries a fuse.** A reactor that deletes, revokes, bills or notifies *because a read model says something is absent* is trusting a materialized sink that is only as current as its observer: a paused partition, a replay in progress or a lagging projection makes "absent" true of the sink and false of the world. Decide from a **`[Passive]`** read model (computed on demand from the events at the moment the reactor runs) or from the events themselves. And the code shape cannot tell an **empty subject set** ("nothing to consider" — fail-safe) from an **empty qualifying set** ("nothing survived the filter" — fail-destructive: every subject is about to be acted on), so an unattended pass states its expected population, refuses when the count is implausible, and caps how many subjects one run may touch — the same discipline as [guards-and-fuses.md](./guards-and-fuses.md), applied to a reactor.
|
|
@@ -134,8 +134,12 @@ list|show`, `failed-partitions list|show`, `projections list|show`,
|
|
|
134
134
|
from the outside.
|
|
135
135
|
- **Fix the cause before replaying.** Replaying into an unfixed handler fails the
|
|
136
136
|
same way and buries the original error under a newer one.
|
|
137
|
-
- **A quarantined observer does not resume by itself.**
|
|
138
|
-
|
|
137
|
+
- **A quarantined observer does not resume by itself.** A quarantine ends when
|
|
138
|
+
an operator clears it, or when the observer is subscribed again — for an
|
|
139
|
+
application observer, when the client reconnects, for example after a
|
|
140
|
+
redeploy. Clearing the quarantine is an explicit operation and the last step,
|
|
141
|
+
not the first. A redeploy that restarts the client can also end the quarantine
|
|
142
|
+
as a side effect, so check the observer's state before and after a redeploy.
|
|
139
143
|
|
|
140
144
|
## Before you change anything
|
|
141
145
|
|
|
@@ -140,12 +140,12 @@ credentials (`:57`). Query options: `apiKey`, `auth`, `skipTlsValidation`,
|
|
|
140
140
|
from `string` (`:158`) and a `Redacted` form for logging (`:152`).
|
|
141
141
|
|
|
142
142
|
> **Certificate validation is skipped by default, and that is deliberate.** The
|
|
143
|
-
> Chronicle
|
|
144
|
-
>
|
|
145
|
-
>
|
|
146
|
-
> production connection string must set
|
|
147
|
-
> `Tls.SkipCertificateValidation = false`)
|
|
148
|
-
> actually verifiable.
|
|
143
|
+
> development Chronicle images (`latest-development` and `latest-development-slim`)
|
|
144
|
+
> generate a self-signed certificate on every start, so a development pair
|
|
145
|
+
> connects with no setup. The production image does not: it refuses to start with
|
|
146
|
+
> TLS enabled (the default) and no configured certificate. **A production connection string must set
|
|
147
|
+
> `skipTlsValidation=false`** (or `Tls.SkipCertificateValidation = false`)
|
|
148
|
+
> against a server whose certificate is actually verifiable.
|
|
149
149
|
|
|
150
150
|
### In a host
|
|
151
151
|
|
|
@@ -214,6 +214,13 @@ storage, configured under `Cratis:Chronicle:Compliance:Encryption`.
|
|
|
214
214
|
> migration flag before switching stores, and confirm a known subject still
|
|
215
215
|
> reads after the switch.
|
|
216
216
|
|
|
217
|
+
> **Restore order.** The erasure fence is kept inside the key store, so a key
|
|
218
|
+
> store restored from *before* an erasure brings the key back without its fence
|
|
219
|
+
> and the erased personal data reads again; a key store older than the storage
|
|
220
|
+
> also lacks keys for newer subjects, and their values read as empty. Restore
|
|
221
|
+
> the certificate ring first, then the storage, then the key store to the
|
|
222
|
+
> storage's point in time.
|
|
223
|
+
|
|
217
224
|
## Modeling rules that follow from erasure
|
|
218
225
|
|
|
219
226
|
- Prefer **one subject per event stream** for person-level personal data. The
|
|
@@ -313,8 +313,10 @@ If a handler throws, or a returned side-effect event fails to append — a
|
|
|
313
313
|
constraint violation, a concurrency violation, or an error — the failing
|
|
314
314
|
event-source partition **pauses** until the cause is resolved. Repeated failures
|
|
315
315
|
can **quarantine** the observer, which stops retries and suppresses automatic
|
|
316
|
-
recovery. **A
|
|
317
|
-
|
|
316
|
+
recovery. **A quarantine ends when an operator clears it
|
|
317
|
+
(`ClearObserverQuarantine()`), or when the observer is subscribed again** — for an
|
|
318
|
+
application observer that is when the client connects again, for example after a
|
|
319
|
+
redeploy; Kernel-owned observers are subscribed again when the Kernel starts.
|
|
318
320
|
|
|
319
321
|
Do not throw to reject a malformed inbound event. A reactor is not a data-quality
|
|
320
322
|
gate; invalid payloads belong at the command or append site. When a malformed
|