@cratis/pi 7.61.0 → 7.63.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.
- package/package/corpus/agents/spec-writer.md +2 -2
- package/package/corpus/harnesses/copilot/instructions/application-profile.instructions.md +2 -2
- package/package/corpus/harnesses/copilot/instructions/glossary.instructions.md +2 -2
- package/package/corpus/harnesses/copilot/instructions/specs.scenarios.csharp.instructions.md +7 -4
- package/package/corpus/harnesses/copilot/instructions/vertical-slices.instructions.md +22 -13
- package/package/corpus/product-sync.json +11 -10
- package/package/corpus/prompts/add-business-rule.prompt.md +1 -1
- package/package/corpus/rules/application-profile.md +2 -2
- package/package/corpus/rules/glossary.md +2 -2
- package/package/corpus/rules/specs.scenarios.csharp.md +7 -4
- package/package/corpus/rules/vertical-slices.md +22 -13
- package/package/corpus/skills/cratis-application-slice-conformance/SKILL.md +1 -1
- package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +4 -3
- package/package/corpus/skills/cratis-application-slice-specifications/references/query-and-decision-scenarios.md +12 -3
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/SKILL.md +12 -7
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authorization.md +11 -11
- package/package/corpus/skills/cratis-arc-command/SKILL.md +3 -2
- package/package/corpus/skills/cratis-arc-command/references/decisions-and-routing.md +95 -51
- package/package/corpus/skills/cratis-arc-command/references/fresh-identifiers.md +5 -2
- package/package/corpus/skills/cratis-arc-command/references/generated-values.md +27 -12
- package/package/corpus/skills/cratis-arc-command/references/read-model-injection.md +9 -5
- package/package/corpus/skills/cratis-arc-command/references/shop-generation.md +17 -6
- package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +99 -52
- package/package/corpus/skills/cratis-chronicle-decision-reads/SKILL.md +37 -15
- package/package/corpus/skills/cratis-chronicle-decision-reads/references/admission-and-ownership.md +3 -2
- package/package/corpus/skills/cratis-chronicle-decision-reads/references/choosing-how-a-rule-holds.md +277 -138
- package/package/corpus/skills/cratis-chronicle-event-constraints/SKILL.md +4 -4
- package/package/corpus/skills/cratis-chronicle-event-modeling/SKILL.md +6 -4
- package/package/corpus/skills/cratis-chronicle-read-model/SKILL.md +2 -1
- package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +6 -3
- package/package/corpus/skills/cratis-code-review/SKILL.md +6 -3
- package/package/corpus/skills/cratis-fundamentals-concept/SKILL.md +10 -2
- package/package/corpus/skills/cratis-fundamentals-concept/references/shop-generation.md +49 -6
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +43 -41
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/cases-to-specify.md +11 -2
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/integration-interview.md +24 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/public-events-and-direction.md +76 -10
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/realization-and-gap-fill.md +5 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/todo-list-example.md +1 -1
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translate-example.md +39 -23
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translation-patterns.md +35 -12
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +51 -81
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/atomic-batches-and-source-mappings.md +83 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/capture-map-and-example.md +14 -4
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/reaction-forms.md +59 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/record-capture-specifications.md +60 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/specifying-triggers-and-clock.md +5 -1
- package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +26 -28
- package/package/corpus/skills/cratis-screenplay-command-surface/references/described-handlers.md +82 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/generated-values-and-responses.md +82 -28
- package/package/corpus/skills/cratis-screenplay-command-surface/references/protected-reads.md +113 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/shop-generation.md +45 -12
- package/package/corpus/skills/cratis-screenplay-command-surface/references/text-and-match-rules.md +119 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/validate-rules.md +14 -4
- package/package/corpus/skills/cratis-screenplay-command-surface/verification.json +10 -3
- package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +12 -12
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +5 -3
- package/package/corpus/skills/cratis-screenplay-event-modeling/verification.json +5 -1
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +2 -2
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/evidence-table-template.md +1 -1
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/generated-recovery.md +51 -14
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/intent-example.md +5 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/loss-report-template.md +2 -1
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/rule-modeling.md +6 -3
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/signal-to-intent.md +1 -1
- package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +22 -28
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/choosing-generation.md +20 -7
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +12 -6
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-loop.md +9 -1
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +58 -10
- package/package/corpus/skills/cratis-screenplay-model-authoring/verification.json +4 -2
- package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +2 -5
- package/package/corpus/skills/cratis-screenplay-model-review/references/anti-patterns.md +2 -2
- package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +2 -2
- package/package/corpus/skills/cratis-screenplay-model-review/references/quick-self-check.md +2 -1
- package/package/corpus/skills/cratis-screenplay-model-review/references/review-questions.md +3 -2
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/principles.md +1 -1
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md +1 -1
- package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +2 -3
- package/package/corpus/skills/cratis-screenplay-read-surface/references/named-keys.md +3 -1
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +8 -3
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +8 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/renderability-gate.md +6 -4
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +36 -29
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/berth-reservations.md +6 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/invoicing-dues-design.md +15 -4
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/invoicing-dues-example.md +25 -20
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/public-event-coverage.md +14 -3
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-examples.md +9 -3
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/spec-forms-by-mode.md +7 -3
- package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +3 -1
- package/package/corpus/skills/cratis-screenplay-slice-design/references/command-inventory.md +4 -4
- package/package/corpus/skills/cratis-screenplay-slice-design/references/rule-layers.md +4 -2
- package/package/corpus/skills/cratis-screenplay-slice-design/references/slicing.md +4 -3
- package/package/corpus/skills/cratis-screenplay-slice-design/references/worked-example.md +8 -8
- package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +49 -47
- package/package/corpus/skills/cratis-screenplay-specifications/references/actions-beyond-commands.md +11 -1
- package/package/corpus/skills/cratis-screenplay-specifications/references/generated-fixtures.md +48 -17
- package/package/corpus/skills/cratis-screenplay-specifications/references/vocabulary.md +14 -1
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +25 -21
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md +2 -2
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/consistency-and-concurrency.md +14 -6
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/multi-service-models.md +4 -3
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/streams-example.md +7 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +30 -22
- package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet-example.md +3 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet.md +47 -2
- package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostic-arguments.md +60 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +65 -5
- package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +50 -22
- package/package/corpus/skills/cratis-screenplay-toolchain/references/generation-checks.md +93 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/generation-strategies-example.md +117 -35
- package/package/corpus/skills/cratis-screenplay-toolchain/references/language-admission.md +46 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/preferred-syntax.md +3 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/renderable-subset.md +25 -10
- package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.json +1800 -50
- package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.version +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/traps.md +5 -3
- package/package/corpus/skills/cratis-screenplay-toolchain/verification.json +6 -1
- package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +8 -53
- package/package/corpus/skills/cratis-screenplay-ui-composition/references/file-references.md +2 -2
- package/package/corpus/skills/cratis-screenplay-ui-composition/references/interaction-example.md +54 -0
- package/package/corpus/skills/cratis-screenplay-ui-composition/verification.json +6 -3
- package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +3 -2
- package/package/corpus/skills/cratis-specifications-csharp/references/application-scenarios.md +1 -1
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +30 -29
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +36 -9
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/choosing-generation.md +28 -8
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/publication-and-recovery.md +31 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/sandbox-and-specrunner.md +8 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/verification.json +4 -1
- package/package.json +1 -1
package/package/corpus/skills/cratis-screenplay-command-surface/references/described-handlers.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<!-- Copyright (c) Cratis. All rights reserved. -->
|
|
2
|
+
<!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
|
|
3
|
+
|
|
4
|
+
# Described command handlers
|
|
5
|
+
|
|
6
|
+
Requires Screenplay 4.182.0 or later (`screenplay --version`); older compilers refuse pending handlers with PLAY0268.
|
|
7
|
+
|
|
8
|
+
Use a described command when payload computation needs words rather than an invented
|
|
9
|
+
expression. Prefer ordinary `produces` when the logic is declarative. Do not use a
|
|
10
|
+
described body to reject a command or decide how many events to emit.
|
|
11
|
+
|
|
12
|
+
Complete model:
|
|
13
|
+
|
|
14
|
+
```screenplay
|
|
15
|
+
domain Billing
|
|
16
|
+
module Invoices
|
|
17
|
+
feature Fees
|
|
18
|
+
slice StateChange ApplyLateFee
|
|
19
|
+
command ApplyLateFee
|
|
20
|
+
invoiceId String identifier
|
|
21
|
+
daysOverdue Int
|
|
22
|
+
validate
|
|
23
|
+
daysOverdue >= 1 message "The invoice must be overdue"
|
|
24
|
+
handler
|
|
25
|
+
implementation
|
|
26
|
+
hint "Calculate the late fee from overdue days using the agreed daily rate"
|
|
27
|
+
produces LateFeeApplied
|
|
28
|
+
for invoiceId
|
|
29
|
+
event LateFeeApplied
|
|
30
|
+
amount Decimal
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
A pending `implementation` has no `file` or fence. Bare `implementation` is valid;
|
|
34
|
+
optional `hint` lines are ordered, nonblank quoted strings, decoded without trimming.
|
|
35
|
+
One wrapper and at most one payload are permitted. Attaching a file or fence stops
|
|
36
|
+
being a described command: attached handlers still fail binding with PLAY0268 and
|
|
37
|
+
cannot coexist with `produces`.
|
|
38
|
+
|
|
39
|
+
## Result contract v1
|
|
40
|
+
|
|
41
|
+
| Part | Owner |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| Events, count, order | Declarative; each unconditional `produces` means exactly one event |
|
|
44
|
+
| Destination, routes, allocation, tags and metadata | Declarative |
|
|
45
|
+
| Generated values and response | Declarative; generation precedes the body |
|
|
46
|
+
| Authorization and validation | Declarative; denial or refusal never reaches the body |
|
|
47
|
+
| Event payload values | Body; mappings are non-normative hints, required properties may be unmapped |
|
|
48
|
+
|
|
49
|
+
Mapping type checks still apply. Neither a renderer nor reference execution evaluates
|
|
50
|
+
these payload mappings. Conditional productions, repeated/occurrence productions,
|
|
51
|
+
body-decided cardinality and body rejection are outside this contract.
|
|
52
|
+
|
|
53
|
+
The command selects ESM v23 with `handler: { requirementId, resultVersion: 1 }`.
|
|
54
|
+
The requirements sidecar carries a Pending CommandHandler requirement with ordered
|
|
55
|
+
hints, context/result versions 1, and provisional/ambiguous flags. Consumers must
|
|
56
|
+
explicitly admit this version, never silently drop the body.
|
|
57
|
+
|
|
58
|
+
| Diagnostic | Meaning and action |
|
|
59
|
+
| --- | --- |
|
|
60
|
+
| PLAY0695 (information) | Described command admitted; command and RequirementId name the missing body |
|
|
61
|
+
| PLAY0696 (error) | No productions, including response-only; add unconditional productions |
|
|
62
|
+
| PLAY0697 (error) | Conditional productions; result v1 needs unconditional events |
|
|
63
|
+
| PLAY0698 (error) | Pending intent plus another handler; keep one handler |
|
|
64
|
+
| PLAY0492–0494 | Invalid wrapper, hint or payload composition; fix the source shape |
|
|
65
|
+
|
|
66
|
+
## Execution and realization
|
|
67
|
+
|
|
68
|
+
Reference execution runs the gates, routing and generation in ordinary order, then
|
|
69
|
+
returns Unsupported (`ImplementationBody`) on reaching the body, naming command and
|
|
70
|
+
RequirementId. This also applies through an invoking reaction. No payload mapping runs
|
|
71
|
+
and no event is emitted. Denial and validation specifications still execute. Unsupported
|
|
72
|
+
specifications are counted separately; an all-Unsupported run is never green.
|
|
73
|
+
|
|
74
|
+
Stage admits v23 but refuses described handlers with STAGE-IMPL-002 in the renderer,
|
|
75
|
+
Host and specification executor, including Stub mode: it emits no stubs. Hand-write
|
|
76
|
+
the body against the declared contract as authorized gap-fill; do not claim that a
|
|
77
|
+
pending requirement is implementation evidence. Moving the body into `handler file`
|
|
78
|
+
keeps its RequirementId but does not admit that attached handler alongside `produces`.
|
|
79
|
+
|
|
80
|
+
Validate the model root with `screenplay <root> --warnaserror`; expect no errors or
|
|
81
|
+
warnings and PLAY0695 information. Run `screenplay test <root>` separately: body-reaching
|
|
82
|
+
specifications must be reported Unsupported, not passed. Target tests are separate.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Generated values
|
|
1
|
+
# Generated values, rule proofs and responses
|
|
2
2
|
|
|
3
3
|
## Contents
|
|
4
4
|
|
|
@@ -28,16 +28,17 @@ Only the released generation phase is taught here.
|
|
|
28
28
|
## Choosing a strategy
|
|
29
29
|
|
|
30
30
|
Use the [threaded shop model](shop-generation.md): CustomerId is `cus_` + ULID,
|
|
31
|
-
OrderId is TypeID, InviteCode is NanoID
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
OrderId is TypeID, InviteCode is NanoID, InvoiceNumber is a readable pattern with
|
|
32
|
+
Luhn check digit, and TicketNumber is a random Int value. Keep short references
|
|
33
|
+
separate from event-source identities. The table below owns exact strategy shapes.
|
|
34
34
|
|
|
35
35
|
## When not to
|
|
36
36
|
|
|
37
37
|
Client-minted values remain inputs. Generation is not authorization, idempotency,
|
|
38
|
-
gapless invoice allocation or a credential contract.
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
gapless/sequential invoice allocation or a credential contract. A pattern is not
|
|
39
|
+
an allocator; check digits catch typing mistakes, not forgery. Preserve ApiKey's
|
|
40
|
+
`secret` classification without generated properties: generated secrets remain
|
|
41
|
+
refused, not a reason to strip protection.
|
|
41
42
|
|
|
42
43
|
## The concept declares how; the property declares that
|
|
43
44
|
|
|
@@ -46,7 +47,7 @@ strategies on concepts and `generated`/`generated identifier` on properties.
|
|
|
46
47
|
It includes whole-value fixture pins and returned IDs.
|
|
47
48
|
|
|
48
49
|
A generated property must be a required scalar **concept**, not a bare primitive,
|
|
49
|
-
optional value or collection.
|
|
50
|
+
optional value or collection. Uuid/String generation and Int `random` are executable.
|
|
50
51
|
A Uuid concept implicitly generates `uuid`; String needs an explicit strategy.
|
|
51
52
|
Each concept owns at most one `generate` line; there is no per-property override.
|
|
52
53
|
Generated identifiers need Uuid or String backing and at least 64 random bits.
|
|
@@ -59,6 +60,9 @@ Generated identifiers need Uuid or String backing and at least 64 random bits.
|
|
|
59
60
|
| `typeid "user"` | String | TypeID 0.3, lowercase Crockford UUIDv7 suffix; 74 random bits; prefix 1–63 lowercase letters/underscores, no leading/trailing underscore; empty prefix omits separator |
|
|
60
61
|
| `nanoid [size]` | String | Default 21 symbols from `A-Za-z0-9_-`; size 1–256; entropy is size × log2(alphabet size) |
|
|
61
62
|
| `bytes <count> base64url` / `hex` / `base32` | String | Count 1–512; 8 × count random bits; RFC 4648 without padding; hex lowercase, base32 uppercase; unused trailing bits zero |
|
|
63
|
+
| `pattern "INV-{yyyy}{MM}-#{7}" checksum luhn` | String | Finite readable reference; UTC dates and check digits add no entropy |
|
|
64
|
+
| `random 100000..999999` | Int | Inclusive signed Int64 interval; numeric value, not an identifier |
|
|
65
|
+
| `rule Name` | String | Exactly one file or tagged fence; opaque ValueGeneration implementation with language-neutral Now/Tenant context, String result and unknown entropy |
|
|
62
66
|
|
|
63
67
|
Modifiers occur once each, in any authored order. `prefix "text"` is printable
|
|
64
68
|
ASCII, at most 32 characters, on uuid/uuidv7/ulid/nanoid/bytes; UUID prefixes need
|
|
@@ -71,17 +75,31 @@ identifier; non-identifiers warn PLAY0683 unless a single-property unique
|
|
|
71
75
|
constraint covers the mapped event property. That suppression is not a runtime collision guarantee; use the constraint when
|
|
72
76
|
collisions must reject the command.
|
|
73
77
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
Requires Screenplay 4.172.0 or later (`screenplay --version`) for pattern/random/rule
|
|
79
|
+
and String-concept `validate checksum luhn|mod11|mod97` (ESM v21); older compilers
|
|
80
|
+
refuse them with PLAY0268. Pattern `#` draws a digit, `?` an uppercase letter,
|
|
81
|
+
`*` an uppercase letter or digit; positive ASCII classes and `{n}`/`{m,n}` repeats
|
|
82
|
+
up to 64 are supported. `{yyyy}`, `{yy}`, `{MM}`, `{dd}` use one UTC date.
|
|
83
|
+
The expanded value, including check digits, is at most 256 characters. Only pattern
|
|
84
|
+
accepts `checksum`; write literals/classes rather than prefix/case/alphabet modifiers.
|
|
85
|
+
Read Cratis/Screenplay `Documentation/screenplay/generated-values/patterns.md`
|
|
86
|
+
for escaping and support limits. PLAY0691 means support counting exhausted its
|
|
87
|
+
budget; PLAY0692 means some date in the 100-year assessment horizon has empty
|
|
88
|
+
support. Neither is a proof warning or permission to redraw.
|
|
89
|
+
|
|
90
|
+
Checksum generation appends one Luhn/Mod11 digit or two Mod97 digits over preceding
|
|
91
|
+
ASCII digits, including date/literal digits. Author `validate checksum` separately
|
|
92
|
+
for arithmetic validation of supplied/stored values and fixtures; generation alone
|
|
93
|
+
checks only suffix shape on fixtures. `generate sequence` stays reserved (PLAY0682),
|
|
94
|
+
and compliance markers on generated concepts, including secrets, remain refused.
|
|
95
|
+
Never remove classification to make a model bind.
|
|
78
96
|
|
|
79
97
|
## Inspect and edit generation through MCP
|
|
80
98
|
|
|
81
99
|
A concept `generation` summary and entropy repairs are available.
|
|
82
100
|
Use `screenplay_declaration_details` with `kind: "Concept"`, `view: "summary"`:
|
|
83
101
|
only authored `generate` gets a block, with strategy, set modifiers,
|
|
84
|
-
|
|
102
|
+
`arguments`, `supportCount`, `entropyBits`, `entropyUnknownReason` when null,
|
|
85
103
|
`valuesAtOnePercentCollision` and `executable.status`. Status is `admitted` only
|
|
86
104
|
after whole-model binding, `refused` for errors at this concept/generation, or
|
|
87
105
|
`notAssessed` with a reason for unrelated binding failures. Empty local codes do
|
|
@@ -91,7 +109,7 @@ Set/change/remove `generate` through `screenplay_propose_ast` (replace the conce
|
|
|
91
109
|
`GenerationSyntax`, omit/null `generation` to remove) or reviewed
|
|
92
110
|
`screenplay_propose_source`; do not hand-edit the text. Inspect executable
|
|
93
111
|
diagnostics independently of authoring acceptance: sequence PLAY0682;
|
|
94
|
-
|
|
112
|
+
support failures PLAY0691/0692; generated-rule proofs PLAY0688/0689. Review, run candidate
|
|
95
113
|
specifications where executable, then apply with revisions.
|
|
96
114
|
|
|
97
115
|
`screenplay_repair_capabilities` advertises PLAY0683/0684; workspace repairs supply
|
|
@@ -104,12 +122,19 @@ individual review and `CanonicalizeTouchedDocuments`, with no pinned evidence.
|
|
|
104
122
|
Length changes affect all concept uses; uniqueness changes append-time behavior.
|
|
105
123
|
PLAY0688 repair replaces a refuted rule with the strategy-derived `matches`
|
|
106
124
|
pattern. Review input/stored-value uses because this changes their validation,
|
|
107
|
-
not just generation.
|
|
125
|
+
not just generation. A deterministic bounded pattern repair also adds the declared
|
|
126
|
+
checksum validation if absent; review both rule changes. Ambiguous derived regexes
|
|
127
|
+
have no repair. Date/checksum digit shapes alone do not prove containment.
|
|
108
128
|
A CLI-bundled MCP can lack this summary and these repairs; it still
|
|
109
129
|
supports existing typed concept proposals.
|
|
110
130
|
|
|
111
|
-
Requires Screenplay 4.
|
|
112
|
-
|
|
131
|
+
Requires Screenplay 4.173.0 or later (`screenplay --version`) for `arguments`,
|
|
132
|
+
exact support counts, `derivedPattern` and authored-order `rules[]`; older servers
|
|
133
|
+
can expose `previewArguments` instead. Read `rules[].status`, `witness` and `reason`
|
|
134
|
+
instead of parsing diagnostic text. Use `derivedPattern` as `matches` through a
|
|
135
|
+
typed proposal; use the discovered PLAY0688 repair to replace a refuted rule.
|
|
136
|
+
A refuted rule without `diagnosticCode` was not checked by the compiler (for example,
|
|
137
|
+
an unused UUID concept), so do not invent a repair. Full fields and mapping limits: [MCP generation guide](../../cratis-screenplay-model-authoring/references/mcp-tools.md#concept-generation).
|
|
113
138
|
Sources: Cratis/Screenplay `Documentation/screenplay/generated-values.md`,
|
|
114
139
|
`Source/DotNET/Screenplay.Mcp/McpGenerationDetails.cs`,
|
|
115
140
|
`Source/DotNET/Screenplay/Workspaces/WorkspaceGenerationRepairs.cs`.
|
|
@@ -135,20 +160,27 @@ that cannot backtrack on generated values. Passing samples alone prove nothing.
|
|
|
135
160
|
Providers validate generated values too: a failing fixture is a Contract violation,
|
|
136
161
|
not client rejection or a reason to redraw. Opaque rules need a target.
|
|
137
162
|
|
|
138
|
-
|
|
163
|
+
Generated-concept validation rules select ESM v20 even on implicit UUID generation.
|
|
164
|
+
No proof status is serialized;
|
|
139
165
|
strategy changes do not silently change rules on stored/input values.
|
|
140
166
|
|
|
167
|
+
Tool and renderer authors: read the toolchain's
|
|
168
|
+
[generation checks](../../cratis-screenplay-toolchain/references/generation-checks.md)
|
|
169
|
+
for declaration checks, value checks, strategy discovery and rule proofs.
|
|
170
|
+
Proof status is not serialized; the reference evaluator always requires pins.
|
|
171
|
+
|
|
141
172
|
## Version and freshness
|
|
142
173
|
|
|
143
174
|
A serialized concept `generation` member selects **v15**. Implicit Uuid generation
|
|
144
175
|
and explicit unmodified Uuid `generate uuid` omit it and preserve earlier executable
|
|
145
|
-
bytes/revision.
|
|
146
|
-
implicit UUIDs. An append whose destination equals any value generated in that
|
|
176
|
+
bytes/revision. Any model with a serialized strategy guards **all** generated destinations,
|
|
177
|
+
including its implicit UUIDs; ESM version alone does not enable the guard. An append whose destination equals any value generated in that
|
|
147
178
|
invocation requires the **whole source** to have no existing facts, regardless
|
|
148
179
|
of stream or event type. Multiple initial facts in one invocation are allowed;
|
|
149
180
|
a skipped production makes no freshness claim. Reuse rejects the whole command
|
|
150
181
|
with `Concurrency`, appends nothing and does not silently regenerate or retry.
|
|
151
|
-
|
|
182
|
+
Models without a serialized strategy are Unguarded and retain legacy fixture
|
|
183
|
+
reuse, even if rules select v20.
|
|
152
184
|
|
|
153
185
|
Freshness is neither authorization nor idempotency. Client-minted identifiers
|
|
154
186
|
remain inputs; protect their invariants with constraints. Never use generation
|
|
@@ -158,7 +190,12 @@ Specifications pin values, not seeds: `for` pins a generated identifier;
|
|
|
158
190
|
`generated <name> = <value>` pins another generated property. The reference
|
|
159
191
|
evaluator draws no randomness. From v15 every pin must match exact strategy
|
|
160
192
|
encoding, size, case, UUID version/variant and zero trailing bits. Invalid pins
|
|
161
|
-
are Contract rejections, not client validation failures.
|
|
193
|
+
are Contract rejections, not client validation failures. Rule-bearing concepts
|
|
194
|
+
also check rules, including implicit UUID. Pin date segments with `given clock`;
|
|
195
|
+
all segments must match the same UTC instant. Without a clock only digit widths
|
|
196
|
+
are checked, never the wall clock. Opaque generation rules consume String pins
|
|
197
|
+
without executing attached code; opaque validation still yields Unsupported.
|
|
198
|
+
Older rule-free implicit-UUID models retain
|
|
162
199
|
canonical UUID checks without a version check. Complete executable examples:
|
|
163
200
|
[generated responses](../../cratis-screenplay-toolchain/references/generated-responses-example.md)
|
|
164
201
|
and [generation strategies](../../cratis-screenplay-toolchain/references/generation-strategies-example.md).
|
|
@@ -188,7 +225,7 @@ and [generation strategies](../../cratis-screenplay-toolchain/references/generat
|
|
|
188
225
|
## What the CLI and Stage realize
|
|
189
226
|
|
|
190
227
|
Stage emits strategy-specific `IGeneratable<T>.New()` factories over Fundamentals
|
|
191
|
-
7.
|
|
228
|
+
7.25.0 or later for pattern/random/checksum (via the Arc scaffold pin in Stage's `references/rendered-application.md`). v15 generated destinations use explicit
|
|
192
229
|
`EventsWithConcurrencyScopes` with `BeforeFirst` whole-source scopes; Chronicle
|
|
193
230
|
checks atomically at append: a batch's scopes are checked once against the state before
|
|
194
231
|
the batch, all or nothing, and a storage retry that renumbers the append checks them again. Generated rejection specs assert
|
|
@@ -201,10 +238,12 @@ Requires Stage 4.94.0 or later for receipt-time generation; older factories use
|
|
|
201
238
|
|
|
202
239
|
| Refusal | Still unsupported |
|
|
203
240
|
| --- | --- |
|
|
204
|
-
| STAGE-ESM-028 |
|
|
205
|
-
| STAGE-ESM-011 | A
|
|
206
|
-
| STAGE-ESM-038 | Routing combined with generation/responses; generated-property rules/requirements
|
|
207
|
-
| STAGE-ESM-038 | Unpinned generation with unordered event
|
|
241
|
+
| STAGE-ESM-028 | `generate rule`, unknown strategies, non-concepts, optional/collection generation; every explicit strategy on the legacy syntax engine |
|
|
242
|
+
| STAGE-ESM-011 | A fixture that does not match its strategy shape or concept rules |
|
|
243
|
+
| STAGE-ESM-038 | Routing combined with generation/responses; generated-property rules/requirements; occurrence parameter/response/factory name collisions; unsupported response sources/composites/collections; generated identifier plus destination-less plain production |
|
|
244
|
+
| STAGE-ESM-038 | Unpinned generation with any Unproven/Refuted concept rule, production-condition reads, unordered event/read-model/query expectations or collision-sensitive generated constraints |
|
|
245
|
+
| STAGE-ESM-042 | Unsupported concept-rule kinds; checksum remains refused only on the legacy syntax path |
|
|
246
|
+
| STAGE-ESM-005 | Opaque/unsupported generated-concept rules, before pin evaluation |
|
|
208
247
|
| STAGE-ESM-004 / -006 | StateChange slices without commands / expression or enum production conditions |
|
|
209
248
|
|
|
210
249
|
Sequence generation is refused at binding (PLAY0682) and never reaches Stage;
|
|
@@ -213,7 +252,22 @@ command `given clock` fixtures render when whole milliseconds at or after 1970;
|
|
|
213
252
|
|
|
214
253
|
Requires Stage 4.95.0 for command clock fixtures, 4.98.0 for multiple commands and
|
|
215
254
|
conditional productions, and 4.100.0 for generated text unique constraints; older
|
|
216
|
-
renderers refuse those shapes.
|
|
255
|
+
renderers refuse those shapes.
|
|
256
|
+
|
|
257
|
+
Requires Stage 4.109.0 for ESM v20 factories plus `ConceptValidator`; older renderers refuse v20.
|
|
258
|
+
Requires Stage 4.115.0 for ESM v21 admission and all-Proven unpinned generation;
|
|
259
|
+
older renderers require pins even for Proven rules. Unproven/Refuted rules still
|
|
260
|
+
require pins (-038), and invalid pins fail -011.
|
|
261
|
+
Requires Stage 4.117.0 for warning/info-severity generated-concept rules; older
|
|
262
|
+
renderers refuse them with -038. Every severity is enforced as a generation defect.
|
|
263
|
+
Requires Stage 4.118.0 for semantic checksum validation and 4.119.0 for
|
|
264
|
+
pattern/random factories, Host sampling and executor fixture checks; older
|
|
265
|
+
renderers refuse those constructs with -042/-028. Dated patterns use receipt-time
|
|
266
|
+
context; Int ranges render as `long`. `generate rule` still refuses -028.
|
|
267
|
+
Requires Arc.Screenplay 22.107.0 for pattern/random/checksum and self-contained
|
|
268
|
+
String-rule recovery; older adapters leave these factories in code. Recovery is
|
|
269
|
+
not Stage rendering: keep refused rule contracts for gap-fill, never delete rules
|
|
270
|
+
or secret classification.
|
|
217
271
|
|
|
218
272
|
Missing pins in generated Debug specs use `AllowGeneration()` with relational
|
|
219
273
|
assertions against captured values; v15 captures also check strategy shape.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<!-- Copyright (c) Cratis. All rights reserved. -->
|
|
2
|
+
<!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
|
|
3
|
+
|
|
4
|
+
# Protected command reads
|
|
5
|
+
|
|
6
|
+
## Contents
|
|
7
|
+
|
|
8
|
+
- Admission and paths
|
|
9
|
+
- Absence and races
|
|
10
|
+
- Repair and target boundary
|
|
11
|
+
|
|
12
|
+
Requires Screenplay 4.193.0 or later (`screenplay --version`); older compilers refuse command reads with PLAY0271 and read paths with PLAY0268.
|
|
13
|
+
|
|
14
|
+
Declare `command reads protected` once in the application-root document. Imported
|
|
15
|
+
commands inherit it. This selects ESM v25, including when text rules are used, and
|
|
16
|
+
records `commandReadMode: "protected"`. Without it, legacy reads retain PLAY0271,
|
|
17
|
+
read paths retain PLAY0268, and bytes/version stay unchanged. A higher ESM version
|
|
18
|
+
alone never opts an application in.
|
|
19
|
+
|
|
20
|
+
Complete model:
|
|
21
|
+
|
|
22
|
+
```screenplay
|
|
23
|
+
domain Inventory
|
|
24
|
+
command reads protected
|
|
25
|
+
module Stock
|
|
26
|
+
feature Allocation
|
|
27
|
+
slice StateView CurrentStock
|
|
28
|
+
event StockCounted
|
|
29
|
+
quantity Int
|
|
30
|
+
event StockRemoved
|
|
31
|
+
readmodel Current
|
|
32
|
+
id String key
|
|
33
|
+
quantity Int
|
|
34
|
+
projection CurrentProjection => Current
|
|
35
|
+
from StockCounted
|
|
36
|
+
remove with StockRemoved
|
|
37
|
+
slice StateChange Allocate
|
|
38
|
+
command Allocate
|
|
39
|
+
id String identifier
|
|
40
|
+
stockId String
|
|
41
|
+
reads Current by stockId
|
|
42
|
+
validate
|
|
43
|
+
require Current.quantity > 0
|
|
44
|
+
message "Stock must be available"
|
|
45
|
+
produces Allocated
|
|
46
|
+
for id
|
|
47
|
+
quantity = Current.quantity
|
|
48
|
+
event Allocated
|
|
49
|
+
quantity Int
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Admission and paths
|
|
53
|
+
|
|
54
|
+
`reads <View> [as <alias>] [by <input>]` looks up required state. Omitted `by` uses
|
|
55
|
+
the declared command identifier; no identifier is PLAY0782. Repeated reads of a
|
|
56
|
+
view each need a distinct alias; paths use the alias rather than the view name.
|
|
57
|
+
Aliases start with a lowercase letter or underscore.
|
|
58
|
+
|
|
59
|
+
Every read must satisfy both boundaries:
|
|
60
|
+
|
|
61
|
+
- A finite non-empty set of event-log event types builds the view, including removal
|
|
62
|
+
handling; the key is event-source identity only.
|
|
63
|
+
- The lookup key is a required scalar non-generated command input: String, a String
|
|
64
|
+
concept or canonical GUID.
|
|
65
|
+
|
|
66
|
+
PLAY0781 refuses reducers, joins (including removal joins), children/nested scopes,
|
|
67
|
+
`every`/`all`, payload/composite keys, missing removals, empty handled-event sets,
|
|
68
|
+
named sources/streams, singleton views and unsupported/generated/optional/collection
|
|
69
|
+
keys. Its closed reasons are Reducer, Join, Children, OpenSubscription, PayloadKey,
|
|
70
|
+
ByParts, NoRemoval, EmptyHandledSet, NamedSourceOrStream, Singleton, KeyType,
|
|
71
|
+
GeneratedKey, OptionalKey and CollectionKey. `optional`, `advisory` and `via query`
|
|
72
|
+
remain refused; `via query` uses parser code PLAY0175. There is no unguarded fallback.
|
|
73
|
+
|
|
74
|
+
Single-level `read.property` paths bind in `require` operands and produced-event
|
|
75
|
+
mapping sources only. Deeper paths and read paths in `produces when`, response
|
|
76
|
+
fields, `for`, routes and derive/provide remain PLAY0268. Unknown read/property
|
|
77
|
+
paths report PLAY0784; ambiguous view paths report PLAY0785. A command with both
|
|
78
|
+
`reads` and `concurrency` reports PLAY0783: do not guess which boundary wins.
|
|
79
|
+
|
|
80
|
+
## Absence and races
|
|
81
|
+
|
|
82
|
+
Execution orders authorization → property rules → required reads → derive/provide
|
|
83
|
+
→ requirements → productions/responses. Missing state rejects with Validation and
|
|
84
|
+
message `<ReadModel> '<key>' does not exist.` before evaluating requirements or
|
|
85
|
+
mappings. Property-rule rejection therefore wins over absence.
|
|
86
|
+
|
|
87
|
+
Decide records the unfiltered fact-log boundary, read key and handled event types.
|
|
88
|
+
A matching fact after that boundary makes commit return Conflict /
|
|
89
|
+
DecisionStateChanged with no command facts, including publications. Irrelevant
|
|
90
|
+
facts do not conflict and remain in the committed world. Even a no-fact command is
|
|
91
|
+
checked. Race cases are evaluator vectors, not a new `.play` specification construct.
|
|
92
|
+
|
|
93
|
+
Specify present/absent state, rule refusal and denial. Assert no new facts and
|
|
94
|
+
unchanged views on failure; use target concurrency tests to prove actual storage
|
|
95
|
+
protection. Ordinary injected read models are not protected decisions; uniqueness
|
|
96
|
+
still belongs in a `unique` append constraint.
|
|
97
|
+
|
|
98
|
+
## Repair and target boundary
|
|
99
|
+
|
|
100
|
+
PLAY0780 rejects duplicate, conflicting or non-root preambles. Informational
|
|
101
|
+
PLAY0786 identifies an eligible legacy model at its first command read. Discover
|
|
102
|
+
`read-workspace view=repairs`, then `propose-repair` with current workspace/catalog
|
|
103
|
+
revisions and canonical formatting consent; review with `read-proposal` before
|
|
104
|
+
explicit `apply`. The repair inserts into the domain document or sole document,
|
|
105
|
+
refuses ambiguous roots and requires individual review, never fix-all. It changes
|
|
106
|
+
absence/conflict behavior, not merely formatting.
|
|
107
|
+
|
|
108
|
+
Stage admits ESM v25 but refuses protected reads with STAGE-ESM-044 in rendering,
|
|
109
|
+
Host serving and specification execution; a reference pass is not Stage or Arc
|
|
110
|
+
realization. Preserve the model's protection and deliver authorized hand-written
|
|
111
|
+
consistency enforcement through the render-and-gap-fill workflow. Never remove
|
|
112
|
+
the preamble to get a render. `screenplay <root> --warnaserror` must exit zero;
|
|
113
|
+
`screenplay test <root>` separately establishes reference behavior, not target support.
|
package/package/corpus/skills/cratis-screenplay-command-surface/references/shop-generation.md
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
<!-- Copyright (c) Cratis. All rights reserved. -->
|
|
2
2
|
<!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
|
|
3
3
|
|
|
4
|
-
# The shop in Screenplay:
|
|
4
|
+
# The shop in Screenplay: generated values
|
|
5
|
+
|
|
6
|
+
## Contents
|
|
7
|
+
|
|
8
|
+
- Choosing a strategy
|
|
9
|
+
- When not to generate
|
|
10
|
+
- Sources
|
|
5
11
|
|
|
6
12
|
## Choosing a strategy
|
|
7
13
|
|
|
8
14
|
Use the same vocabulary as the [Fundamentals/Arc shop](../../cratis-fundamentals-concept/references/shop-generation.md),
|
|
9
15
|
but only the released language realization: CustomerId is `cus_` + uppercase
|
|
10
|
-
ULID, OrderId is `typeid "order"`, and InviteCode is NanoID.
|
|
16
|
+
ULID, OrderId is `typeid "order"`, and InviteCode is NanoID. InvoiceNumber uses
|
|
17
|
+
a readable date/checksum pattern; TicketNumber is an Int pickup-ticket value. Their strategies
|
|
11
18
|
belong to concepts; command properties only say `generated`/`generated identifier`.
|
|
12
19
|
The existing [strategy reference](generated-values-and-responses.md) owns exact
|
|
13
20
|
encodings, entropy, MCP edits, fixtures and freshness.
|
|
14
21
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Context-member
|
|
22
|
+
Requires Screenplay 4.172.0 or later (`screenplay --version`) for pattern/random/rule
|
|
23
|
+
and checksum validation (ESM v21); older compilers refuse them with PLAY0268.
|
|
24
|
+
`generate rule Name` can attach code with Now/Tenant context, but the reference
|
|
25
|
+
runner never executes it: pin the whole String result. TypeID itself has no
|
|
26
|
+
tenant slot. Context-member factory recovery still stays in code. Stage's
|
|
27
|
+
time-ordered factories use the command receipt, not an invented wall-clock value.
|
|
20
28
|
|
|
21
29
|
The shop's ApiKey remains a **secret**. In .NET its factory is `Bytes(32)` and its
|
|
22
30
|
concept is `[NotAudited]`. It is never an identifier (event-source IDs are plaintext
|
|
@@ -35,6 +43,11 @@ concept OrderId : String
|
|
|
35
43
|
concept InviteCode : String
|
|
36
44
|
generate nanoid
|
|
37
45
|
concept ApiKey : String secret
|
|
46
|
+
concept InvoiceNumber : String
|
|
47
|
+
generate pattern "INV-{yyyy}{MM}-#{7}" checksum luhn
|
|
48
|
+
validate checksum luhn
|
|
49
|
+
concept TicketNumber : Int
|
|
50
|
+
generate random 100000..999999
|
|
38
51
|
module Shop
|
|
39
52
|
feature Customers
|
|
40
53
|
slice StateChange Register
|
|
@@ -58,22 +71,39 @@ module Shop
|
|
|
58
71
|
inviteCode = "abcdefghijklmnopqrstu"
|
|
59
72
|
feature Orders
|
|
60
73
|
slice StateChange Place
|
|
74
|
+
constraint UniqueInvoiceNumber
|
|
75
|
+
unique invoiceNumber on OrderPlaced
|
|
76
|
+
constraint UniquePickupTicket
|
|
77
|
+
unique pickupTicket on OrderPlaced
|
|
61
78
|
command PlaceOrder
|
|
62
79
|
orderId OrderId generated identifier
|
|
80
|
+
invoiceNumber InvoiceNumber generated
|
|
81
|
+
pickupTicket TicketNumber generated
|
|
63
82
|
produces event OrderPlaced
|
|
83
|
+
invoiceNumber InvoiceNumber = invoiceNumber
|
|
84
|
+
pickupTicket TicketNumber = pickupTicket
|
|
64
85
|
returns orderId
|
|
65
86
|
specification PlacesWithPinnedValue
|
|
87
|
+
given clock "2026-10-02T09:00:00Z"
|
|
66
88
|
when PlaceOrder
|
|
67
89
|
for "order_0000000000e008000000000000"
|
|
90
|
+
generated invoiceNumber = "INV-202610-00000004"
|
|
91
|
+
generated pickupTicket = 123456
|
|
68
92
|
then OrderPlaced
|
|
69
93
|
for "order_0000000000e008000000000000"
|
|
94
|
+
invoiceNumber = "INV-202610-00000004"
|
|
95
|
+
pickupTicket = 123456
|
|
70
96
|
then returns "order_0000000000e008000000000000"
|
|
71
97
|
```
|
|
72
98
|
|
|
73
99
|
Each property is server-owned, not a client-minted input. The ApiKey declaration
|
|
74
100
|
is not permission to replace its secret contract with an ordinary random String.
|
|
75
|
-
|
|
76
|
-
|
|
101
|
+
The invoice date segments use the pinned UTC clock; it does not draw a portable
|
|
102
|
+
ULID or TypeID fixture. Checksum validation is authored separately from generation.
|
|
103
|
+
Dates/check digits add no entropy. The short invoice and ticket values use
|
|
104
|
+
single-property unique constraints; neither is a generated identifier. Whole-source
|
|
105
|
+
freshness protects the OrderId destination, not every generated payload value.
|
|
106
|
+
A duplicate-source specification should
|
|
77
107
|
expect Concurrency with no new facts or response, not a regenerated ID.
|
|
78
108
|
|
|
79
109
|
## When not to generate
|
|
@@ -83,10 +113,13 @@ idempotency keys, authorization, gapless invoice numbers or proof of projection
|
|
|
83
113
|
readiness. A reference InviteCode is not automatically a credential; if possession
|
|
84
114
|
confers access, protect it as a secret and do not claim this generated String
|
|
85
115
|
example realizes that credential behavior. Never drop ApiKey's secret marker to
|
|
86
|
-
make its generation bind/render.
|
|
87
|
-
|
|
116
|
+
make its generation bind/render. A pattern is not gapless/sequential numbering;
|
|
117
|
+
check digits catch typos, not forgery. ESM v21 binds and reference-executes with
|
|
118
|
+
pins. Requires Stage 4.118.0 for checksum validation and 4.119.0 for pattern/random
|
|
119
|
+
rendering; older renderers refuse those constructs. `generate rule` still refuses
|
|
120
|
+
STAGE-ESM-028. Sequence allocation and secret generation stay explicit gaps.
|
|
88
121
|
|
|
89
|
-
##
|
|
122
|
+
## Sources
|
|
90
123
|
|
|
91
124
|
Screenplay `Documentation/screenplay/generated-values/choosing.md`,
|
|
92
125
|
`Documentation/screenplay/generated-values.md`,
|
package/package/corpus/skills/cratis-screenplay-command-surface/references/text-and-match-rules.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<!-- Copyright (c) Cratis. All rights reserved. -->
|
|
2
|
+
<!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
|
|
3
|
+
|
|
4
|
+
# Literal text rules and portable matching
|
|
5
|
+
|
|
6
|
+
## Contents
|
|
7
|
+
|
|
8
|
+
- Literal text rules
|
|
9
|
+
- Portable `matches`
|
|
10
|
+
- Studio replacements and public check APIs
|
|
11
|
+
|
|
12
|
+
## Literal text rules
|
|
13
|
+
|
|
14
|
+
Requires Screenplay 4.184.0 or later (`screenplay --version`) for literal text rules and pattern admission checks; older compilers do not admit these rule forms.
|
|
15
|
+
|
|
16
|
+
Prefer a literal rule over a regex when the requirement is plain text. Complete example:
|
|
17
|
+
|
|
18
|
+
```screenplay
|
|
19
|
+
concept InvoiceReference : String
|
|
20
|
+
validate
|
|
21
|
+
contains "-"
|
|
22
|
+
not contains " "
|
|
23
|
+
starts with "INV-"
|
|
24
|
+
ends with "-NOK"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
These concept/command-property rules select ESM v24. They compare UTF-16 code units
|
|
28
|
+
ordinally, without case folding or normalization. Use one non-enum text value and a
|
|
29
|
+
quoted literal operand, not a property, collection or regex. An absent optional
|
|
30
|
+
value passes; add `not empty` to require presence. An empty operand makes `contains`,
|
|
31
|
+
`starts with` and `ends with` pass, and `not contains` fail for present text.
|
|
32
|
+
Equality and inequality remain `== "x"` and `!= "x"`.
|
|
33
|
+
|
|
34
|
+
This is not condition grammar: `contains`/`starts with` in `require`, `produces when`
|
|
35
|
+
or reaction `where` remain PLAY0268. Those conditions admit scalar equality and
|
|
36
|
+
numeric ordering, not the property text rules.
|
|
37
|
+
|
|
38
|
+
Requires Stage 4.124.0 for v24 text-rule admission (`cratis --version` identifies the CLI bundle); older renderers refuse v24 with STAGE-ESM-016.
|
|
39
|
+
|
|
40
|
+
Stage admits v24 and executes these four rules on its Host and specification
|
|
41
|
+
executor, rendering ordinal UTF-16 comparisons without regex or a Screenplay
|
|
42
|
+
runtime dependency. The legacy EventModel syntax engine drops these rules; use
|
|
43
|
+
semantic admission, never infer support from that engine's output.
|
|
44
|
+
|
|
45
|
+
## Portable `matches`
|
|
46
|
+
|
|
47
|
+
Requires Screenplay 4.183.0 or later (`screenplay --version`); older compilers use platform matching and may accept nonportable constructs.
|
|
48
|
+
|
|
49
|
+
A quoted pattern is a flagless JavaScript expression restricted to a portable linear
|
|
50
|
+
dialect, not arbitrary ECMAScript or .NET regex. It searches any substring unless
|
|
51
|
+
anchored. Screenplay uses its own Thompson automaton, without timeout or host-engine
|
|
52
|
+
settings. Syntax remains `matches "^INV-[0-9]{6}$"` or `matches email`.
|
|
53
|
+
|
|
54
|
+
| Admitted | Meaning |
|
|
55
|
+
| --- | --- |
|
|
56
|
+
| Literals, `.`, `^`, `$`, alternation | `$` is strict end of input, not before a final newline |
|
|
57
|
+
| `(…)`, `(?:…)`, `(?<name>…)` | ASCII names `[A-Za-z_][A-Za-z0-9_]*`; duplicate names only in disjoint alternatives; names that can match together report PLAY0367 |
|
|
58
|
+
| Classes, negation, single-character ranges | Unions/complements use set semantics |
|
|
59
|
+
| `\d \D \w \W \s \S` | `\d` is ASCII digits, `\w` ASCII letters/digits/underscore |
|
|
60
|
+
| `\t \n \r \f \v`, `\0` not before a digit, `\xHH`, `\uHHHH` | UTF-16 code-unit escapes |
|
|
61
|
+
| Escaped syntax characters and `\/` | `\-` also inside a class |
|
|
62
|
+
| `* + ? {n} {n,} {n,m}` and lazy forms | No stacked quantifiers |
|
|
63
|
+
|
|
64
|
+
`\s` includes U+00A0, U+FEFF and Unicode line/paragraph separators; it excludes
|
|
65
|
+
U+0085. Dot excludes LF, CR, U+2028 and U+2029. `\w` excludes U+0130.
|
|
66
|
+
`matches email` is conservative, not RFC 5322: one `@`, nonempty local part without
|
|
67
|
+
whitespace/`@`, and at least two nonempty domain parts without whitespace/`@`.
|
|
68
|
+
A no-break space therefore fails email validation. Other bare names report PLAY0366.
|
|
69
|
+
|
|
70
|
+
PLAY0367 means invalid syntax, including stacked quantifiers. PLAY0699 means a
|
|
71
|
+
construct outside the dialect: lookarounds, backreferences, word boundaries,
|
|
72
|
+
Unicode properties, code-point escapes, control/octal/identity escapes, .NET-only
|
|
73
|
+
anchors/options/class subtraction, empty classes, stray brackets, class escapes as
|
|
74
|
+
range endpoints, or non-ASCII group names. Use explicit classes, UTF-16/hex escapes,
|
|
75
|
+
`^`/`$`, or a literal text rule where equivalent. A length-only lookahead can become
|
|
76
|
+
an anchored counted repeat; there is no general lookaround replacement.
|
|
77
|
+
|
|
78
|
+
Limits are 1,000 decoded UTF-16 code units and 3,000 expanded nodes. Literals,
|
|
79
|
+
classes, anchors and each optional/loop/alternative choice point count one. Counted
|
|
80
|
+
repeats multiply their body by the upper bound (unbounded: lower bound plus one),
|
|
81
|
+
adding optional/loop choices. `x{1500}` counts 1,500; `a{0,1500}` and `(a*){1500}`
|
|
82
|
+
count 3,000. Exceeding either limit reports PLAY0699 before automaton construction.
|
|
83
|
+
|
|
84
|
+
Older serialized ESM retains authored pattern bytes and loads, but invalid/refused
|
|
85
|
+
patterns plan as UnsupportedValidation and generation checks report Unproven;
|
|
86
|
+
re-authoring reports PLAY0367/PLAY0699.
|
|
87
|
+
Browser matching remains advisory: JavaScript may backtrack even on admitted
|
|
88
|
+
`(a+)+$`. The server-side linear check is authoritative.
|
|
89
|
+
|
|
90
|
+
## Studio replacements and public check APIs
|
|
91
|
+
|
|
92
|
+
Only exact escaped-literal Studio shapes desugar with warning PLAY0787, not PLAY0699:
|
|
93
|
+
|
|
94
|
+
| Decoded pattern (`L` is an escaped literal) | Replacement |
|
|
95
|
+
| --- | --- |
|
|
96
|
+
| `^(?![\s\S]*L)` | `not contains "literal"` |
|
|
97
|
+
| `L(?![\s\S])` | `ends with "literal"` |
|
|
98
|
+
| `^L(?![\s\S])` | `== "literal"` |
|
|
99
|
+
| `^(?!L$)` or `^(?!L(?![\s\S]))` | `!= "literal"` |
|
|
100
|
+
|
|
101
|
+
Recognition requires a lossless escape/decode round trip: Studio v1 uses
|
|
102
|
+
.NET Regex.Escape; v2 escapes `\ ^ $ . | ? * + ( ) [ ] { } /`. Other lookarounds
|
|
103
|
+
remain refused. Plain `L`, `^L`, `^L$` and `L$` are unchanged. Syntax retains the
|
|
104
|
+
original text, while binding stores the ordinal rule. Old ESM evaluates these exact
|
|
105
|
+
patterns as replacements without changing bytes. The editor quick fix and MCP
|
|
106
|
+
`propose-repair` migrate to literal rules preserving message/severity; preview the
|
|
107
|
+
revision-bound canonical-formatting proposal before explicit apply.
|
|
108
|
+
|
|
109
|
+
C#: `Cratis.Screenplay.Semantics.PortableMatchPattern.Check(pattern)`.
|
|
110
|
+
TypeScript: import `checkPortableMatchPattern` from `@cratis/screenplay-compiler`.
|
|
111
|
+
Both return PortableMatchCheck: status, code, construct, UTF-16 offset in the decoded
|
|
112
|
+
pattern, suggestion, description and optional replacement `{ kind, value }`.
|
|
113
|
+
Statuses are Admitted, Deprecated, Refused, Invalid (lowercase strings in TypeScript).
|
|
114
|
+
Admitted has no code; Deprecated is PLAY0787, Refused PLAY0699, Invalid PLAY0367.
|
|
115
|
+
Replacement kinds are Equal, NotEqual, Contains, NotContains, StartsWith, EndsWith.
|
|
116
|
+
Checking never executes a pattern or constructs a platform regex.
|
|
117
|
+
|
|
118
|
+
Validate with `screenplay <root> --warnaserror`, then execute acceptance/refusal
|
|
119
|
+
examples through `screenplay test <root>`; source validation alone is not a rule test.
|