@cratis/pi 7.14.0 → 7.14.2

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 (24) hide show
  1. package/package/corpus/agents/security-reviewer.md +2 -1
  2. package/package/corpus/rules/application-profile.md +1 -1
  3. package/package/corpus/rules/concepts.md +13 -7
  4. package/package/corpus/rules/glossary.md +2 -1
  5. package/package/corpus/rules/vertical-slices.md +6 -4
  6. package/package/corpus/skills/cratis-arc-command/SKILL.md +13 -1
  7. package/package/corpus/skills/cratis-arc-command/references/read-model-injection.md +4 -1
  8. package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +3 -1
  9. package/package/corpus/skills/cratis-arc-ef-core-migration/SKILL.md +2 -1
  10. package/package/corpus/skills/cratis-chronicle-compliance/SKILL.md +11 -2
  11. package/package/corpus/skills/cratis-chronicle-event-modeling/SKILL.md +2 -2
  12. package/package/corpus/skills/cratis-fundamentals-concept/SKILL.md +3 -3
  13. package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +15 -8
  14. package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +1 -1
  15. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/renderability-gate.md +1 -1
  16. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +2 -2
  17. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/chronicle-boundaries.md +2 -2
  18. package/package/corpus/skills/cratis-screenplay-toolchain/references/doc-contradictions.md +1 -1
  19. package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +2 -2
  20. package/package/corpus/skills/cratis-screenplay-toolchain/references/provenance.md +2 -2
  21. package/package/corpus/skills/cratis-screenplay-toolchain/references/renderable-subset.md +1 -1
  22. package/package/corpus/skills/cratis-screenplay-toolchain/references/versions.md +3 -5
  23. package/package/corpus/skills/cratis-security-review/SKILL.md +13 -8
  24. package/package.json +1 -1
@@ -45,7 +45,8 @@ Your responsibility is to perform a structured **security review** of all change
45
45
 
46
46
  ### Sensitive Data Exposure
47
47
 
48
- - [ ] No passwords, secrets, API keys, tokens stored in event properties or read models
48
+ - [ ] Credentials used for authentication (passwords, bearer/session tokens) are never stored; keep a hash or a reference
49
+ - [ ] Operational secrets the system must retain (third-party API key, a company's bank account number) are stored only as `[Encrypted]` + `[NotAudited]` concepts, never in a read model returned to clients in plaintext
49
50
  - [ ] No PII (email, phone, national ID, etc.) returned to clients that did not provide it
50
51
  - [ ] Query results are scoped to the requesting tenant/user — never return all-tenant data in a paged list
51
52
 
@@ -35,7 +35,7 @@ Tagged **[contract]** (framework-enforced) or **[convention]** (house default).
35
35
  3. **[contract] Event-source id resolution:** `ICanProvideEventSourceId` first; else the first qualifying property in declaration order — an `EventSourceId`/`EventSourceId<T>`-derived value *or* a `[Key]` property (no priority between them; two candidates is `ARCCHR0002`); else Arc generates one. A value actually used as a Chronicle stream identity derives from `EventSourceId<T>` with the underlying `IComparable` primitive — never `ConceptAs<Guid>` for that stream identity. `NotSet`, `New()`, and primitive→derived-id operators are optional domain/API conveniences, not Chronicle requirements; typed empty/zero values are real specified stream IDs, not `EventSourceId.Unspecified`.
36
36
  4. **[contract] Events never carry the event-source id** — it is implicit in the event context.
37
37
  5. **[contract] `[Key]` / `[Subject]` are distinct.** `[Key]` is for event-source/read-model/projection key resolution; `[Subject]` is compliance identity only. Don't put either on an `EventSourceId<T>` value (it already is both); use them only for non-`EventSourceId<T>` values.
38
- 6. **[contract] Avoid nullable event properties** — Chronicle's analyzer warns on them. Model optional facts as a separate event; resolve nullable command inputs to a non-null sentinel before constructing the event.
38
+ 6. **[contract] Avoid nullable event properties** — Chronicle's analyzer warns on them. Model optional facts as a separate event; resolve nullable command inputs to a non-null sentinel before constructing the event. **Likewise `Handle()` never returns a nullable event or `null` for "nothing to do"** — Arc treats a `null` result as success with nothing appended, so the caller is told a command succeeded that never happened. Missing state or a failed rule is a rejection: return `Result<TEvent, ValidationResult>` with `ValidationResult.Error(...)`, or reject in a validator or `Provide()`. Optional `ICommandOperation` returns are a separate contract and unaffected.
39
39
  7. **[contract] `[EventType]` takes no arguments for new events** — the type name is the identifier. Use `generation:`/id only when evolving an existing contract; schema changes get a new generation + an `EventTypeMigration<TUpgrade,TPrevious>` (never edit stored-event semantics silently). An enum that only gains a member, or has one renamed, is the exception — Chronicle accepts that in place; a *removed* or *renumbered* member still needs a generation, plus a value map saying what the old values became.
40
40
  8. **[convention] Every `[EventType]` has an XML `<summary>`** — a Cratis C# documentation convention (not a Chronicle rule); events live in the log forever, so record why they exist.
41
41
  9. **[convention] `[ReadModel]` properties carry no default values** except semantically meaningful enum initial states and `[SetValue<T>]`-driven `bool` flags. False defaults hide missing projection wiring.
@@ -39,15 +39,20 @@ does not need a `ConceptAs<T>` wrapper.
39
39
  - `NotSet` or `Empty` is optional domain policy. Add one only when the backing
40
40
  value is impossible or explicitly reserved in that domain. Do not assume
41
41
  empty string, zero, or `Guid.Empty` is universally invalid.
42
- - Mark a concept that holds **personal data** `[PII]` and one that holds a
43
- **secret** `[NotAudited]`. Both markings travel with the type, so marking it
42
+ - Mark a concept that holds **personal data** `[PII]` alone, and one that holds an
43
+ **operational secret** (API key, token, password, a company's bank account
44
+ number) `[Encrypted]` (`Cratis.Chronicle.ProtectedValues`, Chronicle 19.32.0+)
45
+ **plus** `[NotAudited]`. The markings travel with the type, so marking it
44
46
  once covers every command and event that uses it - which is the point of
45
47
  having the concept. A command's property values are written to the causation
46
48
  chain of every event it appends, so an unmarked `ApiKey` or `AccessToken`
47
- concept reaches the event log in the clear and stays there. The two are not
48
- interchangeable: `[PII]` also encrypts and enrolls the value in erasure, which
49
- is wrong for a password, and `[NotAudited]` does nothing for an erasure
50
- request, which is wrong for a name.
49
+ concept reaches the event log in the clear and stays there. `[Encrypted]`
50
+ protects the value at rest on the event; `[NotAudited]` keeps the command
51
+ input off the causation chain - either alone leaves a gap. `[PII]` already
52
+ encrypts, enrolls the value in erasure and withholds it from the chain, so
53
+ never combine it with `[Encrypted]` (analyzer `CHR0053`). The two kinds are
54
+ not interchangeable: `[PII]` is wrong for a password because it enrolls it in
55
+ erasure, and `[Encrypted]` does not erase a name.
51
56
 
52
57
  ```csharp
53
58
  public record AuthorName(string Value) : ConceptAs<string>(Value)
@@ -77,7 +82,8 @@ public record AuthorId(Guid Value) : EventSourceId<Guid>(Value)
77
82
  `EventSourceId<T>` property does not select the stream.
78
83
  - Do not put `[Key]` or `[Subject]` on an `EventSourceId<T>`-derived member;
79
84
  Chronicle analyzer `CHR0026` reports it.
80
- - Do not put `[PII]` on an event-source ID; analyzer `CHR0034` rejects it.
85
+ - Do not put `[PII]` or `[Encrypted]` on an event-source ID; analyzers `CHR0034`
86
+ and `CHR0052` reject them.
81
87
  Sensitive natural identifiers use a random surrogate stream ID and a separate
82
88
  compliance-managed value.
83
89
  - `EventSourceId.Unspecified` is the untyped string-backed sentinel. Typed empty
@@ -51,7 +51,8 @@ One precise line per load-bearing term, so the same word means the same thing ev
51
51
 
52
52
  - **Subject / `[Subject]`** — the natural person a piece of PII belongs to (for GDPR erasure); defaults to the `EventSourceId<T>` identity.
53
53
  - **`[PII]`** — marks an inherently personal value so Chronicle can manage/erase it.
54
- - **`[NotAudited]`** — an **Arc** marking (`Cratis.Arc.Chronicle.Commands`, not a Chronicle type) for a value that is secret but *not* personal data (password, token, API key), so it is never written to the causation chain. Withholds only; it does not encrypt or enroll the value in erasure the way Chronicle's `[PII]` does.
54
+ - **`[NotAudited]`** — an **Arc** marking (`Cratis.Arc.Chronicle.Commands`, not a Chronicle type) for a value that is secret but *not* personal data (password, token, API key), so it is never written to the causation chain. Withholds only; it does not encrypt the value, so pair it with `[Encrypted]` for an operational secret. It never enrolls a value in erasure the way Chronicle's `[PII]` does.
55
+ - **`[Encrypted]`** — a Chronicle marking (`Cratis.Chronicle.ProtectedValues`, Chronicle 19.32.0+) that encrypts an **operational secret** (API key, token, a company's bank account number) at rest on the event, without erasure. It does not keep a command input off the causation chain, so a secret gets `[Encrypted]` **plus** `[NotAudited]`. Never combine it with `[PII]` (`CHR0053`); never put it on an event source id (`CHR0052`).
55
56
  - **`[OnceOnly]`** — marks a reactor handler (or the whole reactor class) as non-replayable: Chronicle skips it for every event arriving as part of a **replay** — observer rewind, redaction, revision. Replay-exclusion only, not exactly-once and not per-event-source deduplication; recovering a failed partition re-delivers the event as an ordinary observation and the handler runs again. Use a `ReactorDelivery` receipt for that case.
56
57
  - **Namespace / tenant** — Chronicle isolates tenants by **namespace**; each namespace has its own events, observers, and read models.
57
58
 
@@ -105,18 +105,19 @@ for the versioned boundary and supported alternatives.
105
105
 
106
106
  A command's **property values** are recorded on the causation of every event it appends, alongside the command's name, so an event says not only which command produced it but what that command was asked to do. The causation is written into the event log and stays there for as long as the events do — a value recorded there cannot be taken back out by changing code.
107
107
 
108
- Two markings keep a value off the chain, and both are honored on the property, the declaring type, the positional record parameter, **and the property's type**:
108
+ Two markings keep a value off the chain (`[PII]` from Chronicle, `[NotAudited]` from Arc), and both are honored on the property, the declaring type, the positional record parameter, **and the property's type**:
109
109
 
110
110
  | Marking | For | Also does |
111
111
  | --- | --- | --- |
112
112
  | `[PII]` | personal data | encrypts it in the event, enrolls it in erasure |
113
- | `[NotAudited]` | a secret that is not personal data — password, token, API key, card number | nothing else; it only withholds |
113
+ | `[NotAudited]` | a secret that is not personal data — a password or token given as a command input, an API key, a card number | nothing else; it only withholds. A credential (password, token) is never put on an event: store a hash or a reference. A secret the system must retain on an event is also `[Encrypted]` |
114
114
 
115
- They are **not interchangeable**: `[PII]` on a password would encrypt it and enroll it in GDPR erasure, which is wrong; `[NotAudited]` on a name does nothing for an erasure request, which is also wrong.
115
+ They are **not interchangeable**: `[PII]` on a password would encrypt it and enroll it in GDPR erasure, which is wrong; `[NotAudited]` on a name does nothing for an erasure request, which is also wrong. An operational secret the system retains on an event (a third-party API key, a company's bank account number) needs **both** `[Encrypted]` (`Cratis.Chronicle.ProtectedValues`, Chronicle 19.32.0+; at rest, no erasure) and `[NotAudited]` (off the chain); either alone leaves a gap. A credential used for authentication is never retained: the command marks it `[NotAudited]` and the event carries only a hash or a reference. Never combine `[PII]` with `[Encrypted]` (`CHR0053`), and neither goes on an event source id (`CHR0034`, `CHR0052`).
116
116
 
117
117
  **Prefer marking the concept**, exactly as with `[PII]` — mark `ApiKey` once and every command taking one is covered:
118
118
 
119
119
  ```csharp
120
+ [Encrypted]
120
121
  [NotAudited]
121
122
  public record ApiKey(string Value) : ConceptAs<string>(Value);
122
123
  ```
@@ -204,6 +205,7 @@ Apply authorization attributes on the `[Command]` record or query method. **[con
204
205
  - **[contract] No arguments for new events** — the type name is the identifier. Use `generation:`/id only when evolving an existing contract (invoke the **cratis-chronicle-event-type-migration** skill).
205
206
  - **[contract] Past-tense, one-purpose names** (`AuthorRegistered`, not `Updated`/`FormSubmitted`) — Chronicle requires past-tense, single-purpose facts. Self-describing without slice context.
206
207
  - **[contract] Avoid nullable properties** — Chronicle's analyzer warns on nullable event members; model optional facts as a separate event, or resolve a nullable command input to a non-null sentinel before constructing the event.
208
+ - **[contract] `Handle()` never returns a nullable event or `null` for "nothing to do"** — Arc treats a `null` result as success with nothing appended, so the caller is told a command succeeded that never happened. Missing state or a failed rule is a rejection: return `Result<TEvent, ValidationResult>` with `ValidationResult.Error(...)`, or reject in a validator or `Provide()`. Optional `ICommandOperation` returns are a separate contract and unaffected.
207
209
  - **[contract] Never carry the event-source id** — it's implicit in the event context.
208
210
  - **[convention] No `DateTimeOffset`/`DateTime` properties** that duplicate `EventContext.Occurred` — Chronicle records the wall-clock timestamp of every event there. Read it in projections/reducers via `[SetFromContext<T>]` or fluent `.Set(m => m.X).ToEventContextProperty(c => c.Occurred)`. Use `DateOnly` only for a business date the user explicitly supplies.
209
211
  - **[convention] Every `[EventType]` has an XML `<summary>`** (Cratis C# doc convention) recording why the event exists and what each value means.
@@ -331,7 +333,7 @@ public Task AuthorRegistered(AuthorRegistered @event, EventContext context) => .
331
333
  **[contract]** Chronicle encrypts `[PII]`-marked values per subject; decryption is transparent to observers and queries (read models injected into a `CommandValidator<T>` or `Handle()` decrypt transparently under the command's resolved subject before validation/handler logic runs).
332
334
 
333
335
  - Prefer **concept-level `[PII]`** (on the `ConceptAs<T>` type) so the marker travels everywhere automatically; use property-level `[PII]` only when a value is personal in one event context but not everywhere.
334
- - `[PII]` also keeps the value **off the causation chain** when it is a command property — see [Causation](#causation--what-a-command-records-contract). A secret that is not personal data needs `[NotAudited]` instead; `[PII]` is the wrong tool for a password.
336
+ - `[PII]` also keeps the value **off the causation chain** when it is a command property — see [Causation](#causation--what-a-command-records-contract). A retained operational secret that is not personal data needs `[Encrypted]` plus `[NotAudited]` instead; `[PII]` is the wrong tool for it, and a password is never retained at all (store a hash).
335
337
  - **`[PII]` is found at any nesting depth, and may mark a whole value object.** A `[PII]` concept inside a value object is encrypted where it sits (siblings stay readable). Marking the **value object type** (or a property typed as one) with `[PII]` classifies every value it holds — Chronicle pushes the marker down to the individual values, so the document keeps its shape and each value is separately encrypted rather than fused into one blob.
336
338
  - Projection-backed read models inherit PII lineage automatically — don't add `[PII]` to their properties. Reducer-backed models: a `[PII]`-concept-typed property is detected automatically; add property-level `[PII]` only for a primitive/non-PII-concept property populated from PII source data.
337
339
  - ⚠️ **`[PII]` cannot be applied to `EventSourceId`/`EventSourceId<T>`** — Chronicle throws `PIINotSupportedOnEventSourceId` at runtime because the identifier is the encryption-key lookup. If the identifier itself is sensitive, use a random `Guid`-backed surrogate as the event source id and store the sensitive value in a `[PII]` property.
@@ -105,6 +105,15 @@ after-commit work belongs in reactors/outboxes/workflows. Use
105
105
  `cratis-arc-command-operation` rather than a custom response handler or rollback
106
106
  stack for this application work.
107
107
 
108
+ **Never return a nullable event or `null` to mean "nothing to do".** Arc only
109
+ processes a non-null result, so a `null` is success with nothing appended and the
110
+ caller is told a command succeeded that never happened. Missing state or a failed
111
+ rule is a rejection: return `Result<TEvent, ValidationResult>` with
112
+ `ValidationResult.Error(...)`, or reject in a validator or `Provide()`. Optional
113
+ `ICommandOperation` returns are a separate contract and unaffected. A nullable
114
+ read-model parameter (`ARC0006`) is handled by rejecting, never by returning a
115
+ nullable event.
116
+
108
117
  Two consequences worth knowing before writing the first command:
109
118
 
110
119
  - **The tuple is how a create command returns its new id.** An
@@ -208,7 +217,10 @@ property is added.
208
217
  | Marking | Use for | Effect |
209
218
  | --- | --- | --- |
210
219
  | `[PII]` (Chronicle) | personal data | encrypted in the event and enrolled in erasure; already withheld from causation |
211
- | `[NotAudited]` (Arc Chronicle) | a secret that is not personal data — password, token, API key | withheld from causation, nothing else |
220
+ | `[Encrypted]` (Chronicle, `Cratis.Chronicle.ProtectedValues`, 19.32.0+) | an operational secret the system retains — a third-party API key, a company's bank account number | encrypted at rest on the event, no erasure; does not withhold it from causation |
221
+ | `[NotAudited]` (Arc Chronicle) | the same operational secret, and any credential given as a command input | withheld from causation, nothing else |
222
+
223
+ A retained operational secret needs **both** `[Encrypted]` and `[NotAudited]`; either alone leaves a gap. A credential used for authentication (password, token) is marked `[NotAudited]` on the command and reaches an event only as a hash or a reference, never encrypted. Never combine `[PII]` with `[Encrypted]` (`CHR0053`).
212
224
 
213
225
  ```csharp
214
226
  [Command]
@@ -46,7 +46,10 @@ failure rather than a server fault.
46
46
  `ARC0006` warns when a read-model parameter is non-nullable, precisely because a
47
47
  command-scoped read model can be missing. Make it nullable when absence is part
48
48
  of the command's valid behavior; keep it non-nullable when absence really is a
49
- rejection.
49
+ rejection. When absence is a rejection, check the nullable parameter and return
50
+ `ValidationResult.Error(...)` through `Result<TEvent, ValidationResult>`; never
51
+ return a nullable event or `null` from `Handle()`, which Arc treats as success
52
+ with nothing appended.
50
53
 
51
54
  ## `null` is not always what absence looks like
52
55
 
@@ -196,7 +196,9 @@ var other = await readModels.GetInstanceById<Other>((EventSourceId)otherId);
196
196
  A missing instance resolves to `null`, never to a default object. A nullable
197
197
  parameter receives that `null`; a non-nullable one is **rejected as a validation
198
198
  failure (400)**, not crashed. `ARC0006` warns on a non-nullable command-scoped
199
- read-model parameter for exactly this reason. `cratis-arc-command` carries the
199
+ read-model parameter for exactly this reason. Handle a nullable parameter by rejecting (a validator,
200
+ `Provide()`, or `Result<TEvent, ValidationResult>`), never by returning a
201
+ nullable event from `Handle()`. `cratis-arc-command` carries the
200
202
  full resolution and nullability reference, including the passive-projection case
201
203
  where absence is *not* `null`.
202
204
 
@@ -117,7 +117,8 @@ from the command's resolved key; a composite key throws
117
117
  (HTTP 400) rather than a server fault.
118
118
 
119
119
  `ARC0006` warns when such a parameter is non-nullable, because a command-scoped
120
- read model can be missing. It is the only Arc diagnostic that touches EF Core
120
+ read model can be missing; reject a missing one rather than returning a nullable
121
+ event from `Handle()`. It is the only Arc diagnostic that touches EF Core
121
122
  read models, and only because they share `[ReadModel]`.
122
123
 
123
124
  ## Write the migration
@@ -63,6 +63,14 @@ well-known `ComplianceMetadataType`. Chronicle has no `[Redact]`, `[Erase]`,
63
63
  `[Anonymize]`, `[Encrypt]`, or `[NotAudited]` attribute; do not write one into
64
64
  an example. Redaction is an API call, not an annotation.
65
65
 
66
+ `[Encrypted]` (`Cratis.Chronicle.ProtectedValues`, Chronicle 19.32.0+) is a
67
+ security marker, not a compliance category: it encrypts an operational secret
68
+ (API key, token, a company's bank account number) at rest with no data subject
69
+ and no erasure. Never put it on a value that is also `[PII]` (analyzer
70
+ **CHR0053**, which `[PII]` alone already covers), nor on an event source id
71
+ (**CHR0052**). Arc's `[NotAudited]` is not a Chronicle attribute either; a secret
72
+ that is also a command property takes both `[Encrypted]` and `[NotAudited]`.
73
+
66
74
  Mark only genuinely personal values. Business metadata, identifiers of
67
75
  non-persons, and amounts stay unmarked — every marked value costs an encryption
68
76
  round trip and becomes unreadable the moment the subject is erased.
@@ -232,8 +240,9 @@ storage, configured under `Cratis:Chronicle:Compliance:Encryption`.
232
240
  - Bearer tokens, magic links, and signed URLs are secrets, not durable facts.
233
241
  Store a keyed hash or an opaque reference. Chronicle has no attribute that
234
242
  withholds a secret from the log (Arc's `[NotAudited]` keeps a *command
235
- property* out of the causation chain — see **cratis-arc-command** — but a
236
- secret placed in an event payload is in the log for good).
243
+ property* out of the causation chain — see **cratis-arc-command**), and a
244
+ secret placed in an event payload is in the log for good; `[Encrypted]`
245
+ protects it at rest but it stays recoverable, so prefer a hash or reference.
237
246
  - **Erasure is wider than the event log.** Crypto-shredding removes readability
238
247
  of `[PII]` values in events and read models. It does nothing for a copy that
239
248
  left Chronicle: an exported CSV, a generated PDF, a search index, an email
@@ -124,8 +124,8 @@ operates on the subject and the subject follows the stream.
124
124
  - Set `[Subject]` only when the person is not the event source. A stored
125
125
  read-model document carries one subject — do not mix several people's personal
126
126
  data into one document.
127
- - Never place `[PII]` on an event-source id: Chronicle cannot encrypt it, and
128
- analyzer `CHR0034` rejects it. When the natural identifier is itself
127
+ - Never place `[PII]` or `[Encrypted]` on an event-source id: Chronicle cannot encrypt it, and
128
+ analyzers `CHR0034` and `CHR0052` reject them. When the natural identifier is itself
129
129
  sensitive, model a surrogate stream id and carry the sensitive value as a
130
130
  `[PII]` property.
131
131
  - Do not place `[Key]` or `[Subject]` on an `EventSourceId<T>` value — it is
@@ -167,8 +167,8 @@ Pass the typed identity as the append/read event-source ID. Merely declaring an
167
167
  `EventSourceId<T>` property does not select the event stream.
168
168
 
169
169
  Do not add `[Key]` or `[Subject]` to an `EventSourceId<T>`-derived member;
170
- Chronicle analyzer `CHR0026` reports that misuse. Do not add `[PII]` to an
171
- event-source ID; analyzer `CHR0034` rejects it.
170
+ Chronicle analyzer `CHR0026` reports that misuse. Do not add `[PII]` or
171
+ `[Encrypted]` to an event-source ID; analyzers `CHR0034` and `CHR0052` reject them.
172
172
 
173
173
  ## Placement is an application convention
174
174
 
@@ -191,7 +191,7 @@ repository structure.
191
191
  the domain.
192
192
  - An `EventSourceId<T>` type represents a real Chronicle stream identity.
193
193
  - The typed identity is passed explicitly to Chronicle operations.
194
- - No `[Key]`, `[Subject]`, or `[PII]` attribute is placed on the stream identity.
194
+ - No `[Key]`, `[Subject]`, `[PII]`, or `[Encrypted]` attribute is placed on the stream identity.
195
195
  - Sensitive natural identifiers use a surrogate stream ID.
196
196
  - The file carries the repository license header.
197
197
  - The project builds and its relevant specifications pass against the verified
@@ -434,13 +434,20 @@ require portable data-subject semantics"), so a `@pii` model stops at authorable
434
434
  keep the attribute, because the classification is the point, and never drop it to bind
435
435
  or render.
436
436
 
437
- ⚠️ **Identifiers are not `@pii`.** `@pii` on a concept that types an identifier
438
- compiles silently, but Chronicle rejects PII on an event source id (`CHR0034`). Keep
439
- the stream identity a surrogate `Uuid` concept and carry the personal value (name,
440
- email) as a separate `@pii` property. **`@sensitive` is unverified:** it has no
441
- defined portable meaning (Screenplay#384). Stage 4.24.0's legacy syntax renderer maps
442
- `@sensitive` to `[PII]` (`ConceptRenderer.cs:84`, Stage#197), while the current
443
- `cratis render` path rejects the model with `PLAY0268`. Do not promise a behaviour for it; both issues are open.
437
+ `@pii` is personal data (erasable); `@sensitive` is an **operational secret** (API key,
438
+ token, a company's bank account number): encrypted at rest without erasure and withheld
439
+ from the causation chain (Screenplay decision 0034, Screenplay#384). C# providers render
440
+ `@sensitive` as `[Encrypted]` + `[NotAudited]`, `@pii` as `[PII]`, and `@pii @sensitive`
441
+ as `[PII]` only, because Chronicle rejects `[PII]` with `[Encrypted]` (`CHR0053`); Stage
442
+ renders this from v4.29.0. The executable model still stops at `PLAY0268` for either.
443
+
444
+ ⚠️ **Identifiers are neither `@pii` nor `@sensitive`.** Chronicle rejects `[PII]` on an
445
+ event source id (`CHR0034`) and `[Encrypted]` on one (`CHR0052`); Screenplay reports
446
+ `PLAY0515` for `@pii` from Screenplay 4.69.1 and for `@sensitive` from 4.84.1, on a
447
+ command identifier, an explicit `for` destination or an event source identifier; earlier
448
+ versions compile it silently and only Chronicle catches it. Keep the stream identity a surrogate `Uuid`
449
+ concept and carry the personal value (name, email) as a separate `@pii` property and a
450
+ secret as a `@sensitive` property.
444
451
 
445
452
  ⚠️ **Enum trap.** A value literally named `validate` is read as an empty validate
446
453
  block. Write `@validate` for the value; the compiler warns when it sees the
@@ -521,7 +528,7 @@ Four contexts, and **what each omits is load-bearing** — read
521
528
  - [ ] Constraints are `unique` forms; no `file` constraint stands in for another rule.
522
529
  - [ ] Each policy has one `require` or one implementation, not both.
523
530
  - [ ] Personal data is `@pii` on the concept, with a reason; no identifier concept is `@pii`;
524
- no behaviour is claimed for `@sensitive`.
531
+ operational secrets are `@sensitive` (never `@pii`), and no identifier concept carries either.
525
532
  - [ ] No `handler` where the model must bind, and no bodied construct described as
526
533
  runnable or renderable without saying which tool admits it.
527
534
  - [ ] No event carries an optional property covering two situations.
@@ -85,7 +85,7 @@ the format in `worked-example.md`.
85
85
  | C2 | A fact, not a request, a running calculation, a UI action or a technical step | names and payloads | D |
86
86
  | C3 | No speculative or pending events ("MayBe...", "...Pending") where a decision is meant | names | Q |
87
87
  | C4 | No nullable or optional event property by default: a required value, or a separate event for the second situation (CHR0012; a `null` in a specification value is PLAY0350); a kept `optional` has its reason in the `description` | `optional` members | D |
88
- | C5 | Sensitive members marked (`@pii`/`@sensitive`) and not mixed across data subjects; no PII on the event-source id (no `@pii` identifier concept; use a surrogate id, CHR0034); one data subject per event or stream | concepts and members | D; removal to pass tools = critical |
88
+ | C5 | Sensitive members marked (`@pii`/`@sensitive`) and not mixed across data subjects; operational secrets are `@sensitive`, not `@pii`; no `@pii` or `@sensitive` on the event-source id (no such identifier concept; use a surrogate id; Chronicle CHR0034 and CHR0052, and Screenplay PLAY0515 from 4.69.1 for `@pii` and 4.84.1 for `@sensitive`, only on tools at those versions - the pinned tools do not report it); one data subject per event or stream | concepts and members | D; removal to pass tools = critical |
89
89
  | C6 | No secret or bearer values as facts (tokens, magic links, signed URLs): record a keyed hash or a reference | event payloads | D |
90
90
  | C7 | No two events of one kind of event source mean the same thing (a shared property set is a signal, not a defect: distinct facts may share a shape and historical generations are exempt; major only when meaning is lost, a rule bypassed or consumers ambiguous); one fact is not recorded twice (aggregate event plus per-item fan-out) | event declarations side by side | D |
91
91
  | C8 | Corrections are new facts that name what they correct; redaction and crypto-erasure are compliance tools, not corrections | event names | D |
@@ -48,7 +48,7 @@ ESM). Only the probe answers renderability. `PLAY0270` entries are information,
48
48
  Read at the time of writing (all open): portable query semantics Stage#58 (list, observable and
49
49
  filtered queries); Automation and Translate slices Stage#79; mapping expressions and projection
50
50
  blocks Stage#117; modeled authentication Stage#120; event generation v4 Stage#165; per-persona
51
- screens Stage#194; compliance attributes Stage#197. Check that an issue is still open before citing
51
+ screens Stage#194. Check that an issue is still open before citing
52
52
  it, and cite only numbers you have just read. A closed issue is a trigger to probe again.
53
53
 
54
54
  ## Reference outcomes
@@ -100,8 +100,8 @@ option, mark it `ASSUMED` in the slice or module `description` and in the sessio
100
100
  is a fact the business recognises. Different meanings get different events, not a flag with
101
101
  nullable siblings. Event properties are required by default (CHR0012, PLAY0350): an optional
102
102
  detail is a separate event, and any deviation is justified in the description. One data
103
- subject per event and stream; never personal data or a `@pii` concept as the identifier (CHR0034):
104
- use a surrogate `Uuid` and a `@pii` property.
103
+ subject per event and stream; never personal data, a secret, or a `@pii` or `@sensitive` concept as the identifier (CHR0034, CHR0052):
104
+ use a surrogate `Uuid` and a `@pii` or `@sensitive` property.
105
105
  5. **Plan evolution** with `references/evolution.md`: classify each event change (additive,
106
106
  meaning change, rename, removal, split or merge) and write its compatibility scenarios before
107
107
  editing. Renames and other identity-affecting edits are made by the identity owner (the
@@ -44,8 +44,8 @@ whether uniqueness and completion are per tenant or genuinely cross-tenant.
44
44
 
45
45
  Decide the data subject before the event and view shape. One data subject per event and per
46
46
  stream; one per read-model instance. Never put PII on the event-source id and never mark the
47
- identifier's concept `@pii`: Chronicle cannot encrypt a source id (analyzer CHR0034). Use a surrogate `Uuid`
48
- identity and carry the sensitive value as a `@pii` property. Bearer tokens, magic links and
47
+ identifier's concept `@pii` or `@sensitive`: Chronicle cannot encrypt a source id (analyzers CHR0034 and CHR0052; Screenplay PLAY0515 reports it from 4.69.1 for `@pii` and 4.84.1 for `@sensitive`, not on the pinned tools). Use a surrogate `Uuid`
48
+ identity and carry the value as a `@pii` property (personal data) or a `@sensitive` property (operational secret). Bearer tokens, magic links and
49
49
  signed URLs are never facts; record a keyed hash or a reference.
50
50
 
51
51
  Redaction (payload replacement keeping the sequence slot) and crypto-erasure serve compliance
@@ -27,7 +27,7 @@ read from source or documentation.
27
27
  | 14 | `$causedBy` | not evaluable (#4119), not ESM | showcase only |
28
28
  | 15 | literal keys | `key literal "global"` vs `key "global"` | both compile; prefer `literal` |
29
29
  | 16 | query admission | `D/queries.md:74` now says live, filtered, scoped and performer queries are not admitted | the binder also rejects collection queries and a missing `by`, which stay undocumented [probed] |
30
- | 17 | `@pii` | `D/concepts.md:3,33` "Chronicle applies `@pii` and `@sensitive` rules automatically" | the binder rejects any compliance attribute (PLAY0268); keep it, report V3 blocked. `@sensitive` has no verified portable meaning (Screenplay#384); `@pii` on an event-source identifier is CHR0034 in Chronicle |
30
+ | 17 | `@pii` | `D/concepts.md:3,33` "Chronicle applies `@pii` and `@sensitive` rules automatically" | the binder rejects any compliance attribute (PLAY0268); keep it, report V3 blocked. `@sensitive` means an operational secret (`[Encrypted]` + `[NotAudited]`; Screenplay decision 0034); the pinned tools (standalone 4.68.0, bundle 4.66.0) do **not** report `PLAY0515` (`@pii` from 4.69.1, `@sensitive` from 4.84.1): there only Chronicle catches either attribute on an event-source identifier, at build time of the generated code (CHR0034 for `@pii`, CHR0052 for `@sensitive`) |
31
31
  | 18 | read-model identity | `D/readmodels.md:32` "from the keyed query" | the `by` name must also equal a read-model property (the doc still omits it) |
32
32
  | 19 | `$strings` constraint messages | `D/constraints.md:31` vs `D/internationalization.md:55` | the compiler keeps the key; realization localizes |
33
33
  | 20 | composite key braces | optional in the EBNF; both forms in docs | both fine |
@@ -142,7 +142,7 @@ bodies still leave their owner non-executable.
142
142
  | --- | --- | --- |
143
143
  | `Automation` or `Translate` slice, `reaction`, `capture`, `trigger`; `given clock`, `when clock`, `when trigger`, `when capture` | PLAY0268 | **cratis before 3.28.2 bundles only** (4.60.1); messages in `versions.md` |
144
144
  | Unquoted `import Other.Contract` | PLAY0268 | external contract import is not bound |
145
- | `@pii` or `@sensitive` on any concept | PLAY0268 | "Concept '<n>' compliance attributes require portable data-subject semantics." Same message at 4.60.1 and 4.66.0. `@sensitive` has no verified portable meaning (Screenplay#384, open) |
145
+ | `@pii` or `@sensitive` on any concept | PLAY0268 | "Concept '<n>' compliance attributes require portable data-subject semantics." Same message at 4.60.1 and 4.66.0. `@sensitive` means an operational secret, rendered `[Encrypted]` + `[NotAudited]` (Screenplay decision 0034) |
146
146
  | `query` returning a collection (`RM[]`), or without exactly one caller-supplied `by` | PLAY0268 | "must declare one caller-supplied 'by' argument" or "must return one optional read model" |
147
147
  | `observable`, `filter`, `scoped to`, `performer` queries | PLAY0268 | "uses delivery, filtering, scope, or implementation behavior outside the first ESM v1 vertical." `observable` goes in the return position (`=> observable RM optional`); as a body line it is PLAY0048 |
148
148
  | `contains` or `starts with` in conditions | PLAY0268 | equality and numeric ordering only |
@@ -186,4 +186,4 @@ bodies still leave their owner non-executable.
186
186
  Do not remove `@pii`, `@sensitive`, `authorize` or policies, list queries, automations or
187
187
  rules a domain needs just to make binding pass. Report `V3 blocked: <codes>` and record the
188
188
  slice in the gap list. A `@pii` or `@sensitive` attribute blocks V3 and rendering, and
189
- `@pii` on an event-source identifier is rejected by Chronicle (CHR0034) in addition.
189
+ either attribute on an event-source identifier is not reported by the pinned tools (`PLAY0515` ships for `@pii` in Screenplay 4.69.1 and for `@sensitive` in 4.84.1); only Chronicle rejects it, at build time of the generated code (CHR0034 for `[PII]`, CHR0052 for `[Encrypted]`).
@@ -39,8 +39,8 @@ is adapted with the agreement of Martin Dilger and Nebulit GmbH.
39
39
  - cratis `v3.28.2` (`141c499`; `Render/`, `Run/`, `Prologue/` and `Screenplay/Generate*` are unchanged since `v3.27.1`, `a327e89`): `Source/Cli/Commands/Render/`, `ScreenplayMcpRoot.cs`,
40
40
  `Documentation/reference/screenplay.md`.
41
41
  - Arc `v22.50.5` and Chronicle `v19.32.0` for the code-level facts cited in `versions.md`.
42
- - Open issues cited as limits: cli#242, #243, #244, #245; Screenplay#377, #379, #383, #384,
43
- #388; Stage#79, #165, #178, #197; Chronicle#3744, #4123, #4131.
42
+ - Open issues cited as limits: cli#242, #243, #244, #245; Screenplay#377, #379, #383,
43
+ #388; Stage#79, #165, #178; Chronicle#3744, #4123, #4131.
44
44
 
45
45
  ## Changes from the earlier toolkit
46
46
 
@@ -39,7 +39,7 @@ whole automation is hand-written (gap-fill).
39
39
  | Constraints | unique property value, unique event occurrence; admitted even though Chronicle#4123 means index updates run after commit | intra-command multi-event change to one constraint; multi-claim in one command: 014 |
40
40
  | Authorization | authenticated, role, claim and logical policies; caller fixtures; ownership claims against text-backed targets | opaque policy code, role-claim URIs, a claim matched against a Uuid-backed subject or path: 015 |
41
41
  | Specifications | command-action scenarios: given events, `when <Command>`, `then` events (ordered or any order), `then readmodel`, `then query`, `then error` (naming a rendered constraint or message), `then denied`, `given caller`. Two narrow when-less routes: an unprotected single `then query` seeded by exactly one `given readmodel` whose key and values match (no given events, no caller), and a query-only denial (`given caller`, one `then query` with no results, `then denied`, a protected query, no role claims) | `then no readmodel`, `when append`, composite values, error codes not naming a rendered constraint: 011. Any other when-less specification (for example given events with `then query`) fails 011 |
42
- | Compliance | none | any `@pii` or `@sensitive` already fails binding (PLAY0268). Stage's `[PII]` attribute comes only from the legacy syntax renderer, which renders `@sensitive` as `[PII]` too (Stage#197) |
42
+ | Compliance | none | any `@pii` or `@sensitive` already fails binding (PLAY0268). The C# provider mapping (Stage v4.29.0, Stage#197) is `@pii` to `[PII]`, `@sensitive` to `[Encrypted]` + `[NotAudited]`, both to `[PII]` only |
43
43
 
44
44
  ## Authoring consequences in renderable mode
45
45
 
@@ -130,13 +130,11 @@ MCP loop procedure and proposals: `cratis-screenplay-model-authoring`.
130
130
  the source-identity helper (`cratis-screenplay-modeling-lifecycle` `references/verdicts-and-modes.md` "Source identity"). Keep it apart from the MCP `modelRevision`.
131
131
  - `description` and `documentation` never reach rendered code (Stage#178, open).
132
132
 
133
- ## Roadmap items that would change a verdict (all open at the pin)
133
+ ## Roadmap items that would change a verdict (all open at the pin; the `@sensitive` meaning, Screenplay#384, and the identifier refusal and C# mapping, Stage#197, are settled in decision 0034; the pinned tools predate `PLAY0515`)
134
134
 
135
135
  Screenplay#377 (run specifications from MCP or the tool), #388 (completeness and lineage
136
- report), #383 (identity for an `invokes` caller), #384 (`@pii` on identifiers, `@sensitive`
137
- meaning), #379 (`visualize-model` counts reactions); Stage#79 (render Automation and
138
- Translate slices), Stage#165 (admit ESM v4), Stage#197 (`@pii` identifier renders as
139
- `[PII]` event source id); cli#242 (false PLAY0285 on the 4.60.1 bundle; fixed in effect by the 4.66.0 bundle but still open on GitHub), cli#243 (`validate --executable`),
136
+ report), #383 (identity for an `invokes` caller), #379 (`visualize-model` counts reactions); Stage#79 (render Automation and
137
+ Translate slices), Stage#165 (admit ESM v4); cli#242 (false PLAY0285 on the 4.60.1 bundle; fixed in effect by the 4.66.0 bundle but still open on GitHub), cli#243 (`validate --executable`),
140
138
  cli#244 (file mode ignores imports), cli#245 (`render --check`). The standalone tool at
141
139
  4.68.0 has only the compile command and `mcp` (no `test`; `screenplay --help` checked); the reference runner is library
142
140
  only. Until these land, "specifications written" or "bound" is never "specifications
@@ -18,6 +18,7 @@ first.
18
18
  | --- | --- | --- |
19
19
  | `Cratis.Arc.Chronicle` | `22.16.0` | `[NotAudited]` in `Cratis.Arc.Chronicle.Commands`; the `ARCCHR0009` analyzer |
20
20
  | `Cratis.Chronicle` | `18.3.0` | `[PII]`, `[Subject]`, redaction, namespace isolation |
21
+ | `Cratis.Chronicle` | `19.32.0` | `[Encrypted]` in `Cratis.Chronicle.ProtectedValues`; analyzers `CHR0052`, `CHR0053` |
21
22
  | `Cratis.Arc.Core` | `22.16.0` | Authorization filters, `CommandResult.Unauthorized` |
22
23
 
23
24
  > Re-verified at the versions above by **symbol and signature**: every type, attribute and member this skill names exists at that tag, and the public surface it describes is unchanged since the previous verification (Chronicle 16.45.x / Arc 22.10.4 — the Chronicle 16→18 client diff is converters, options and doc comments; no type was removed or renamed). Behavior claims were verified at the earlier tag unless a section says otherwise.
@@ -52,18 +53,22 @@ command's properties as well as grepping them.
52
53
 
53
54
  ## Step 1 — Event sourcing: the permanent-record checks
54
55
 
55
- - **Every `[Command]` property holding a secret is marked `[NotAudited]`.** A
56
+ - **Every `[Command]` property holding a secret or credential is marked `[NotAudited]`; a retained operational secret is also `[Encrypted]` on the event, and a credential reaches the event only as a hash or a reference.** A
56
57
  command's property values are written to the causation of every event it
57
58
  appends, and causation is as permanent as the events. Prefer the marking on
58
- the concept type so it travels everywhere the value appears.
59
+ the concept type so it travels everywhere the value appears. `[NotAudited]`
60
+ alone leaves the secret in plaintext on events; `[Encrypted]` alone leaves the
61
+ command input on the causation chain.
59
62
  `ARCCHR0009` catches properties whose *names* read as secrets — so read the
60
63
  properties whose names do not say what they hold, because the analyzer cannot.
61
- - **Personal data is `[PII]`, not `[NotAudited]`.** They are different
62
- mechanisms with different consequences: `[NotAudited]` withholds a value from
63
- the causation chain; `[PII]` enrolls it in per-subject encryption and erasure.
64
- A password is `[NotAudited]`. An email address is `[PII]`. Neither substitutes
65
- for the other.
66
- - No secret, token, API key or password in an event property or a read model.
64
+ - **Personal data is `[PII]` alone, a secret is `[Encrypted]` plus `[NotAudited]`.**
65
+ They are different mechanisms with different consequences: `[NotAudited]`
66
+ withholds a value from the causation chain; `[Encrypted]` encrypts it at rest
67
+ without erasure; `[PII]` encrypts, enrolls it in per-subject erasure and
68
+ withholds it. A third-party API key is `[Encrypted]` + `[NotAudited]`. An email address is
69
+ `[PII]`. A password is stored as a hash, never as a retained secret. Never combine `[PII]` with `[Encrypted]` (`CHR0053`), and neither goes
70
+ on an event-source id (`CHR0034`, `CHR0052`).
71
+ - Credentials used for authentication (passwords, bearer or session tokens) are never stored; keep a hash or a reference. An operational secret the system must retain and use (a third-party API key, a company's bank account number) is stored only as an `[Encrypted]` + `[NotAudited]` concept, and never in a read model returned to clients in plaintext.
67
72
  - Event-source ids are generated server-side, never accepted from an untrusted
68
73
  client where the id grants access to a stream.
69
74
  - Upcasting and event-type migration logic cannot introduce a property the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "7.14.0",
3
+ "version": "7.14.2",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [