@cratis/pi 7.44.0 → 7.46.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/harnesses/pi/extensions/cratis-hooks/index.ts +2 -0
- package/package/corpus/hooks/README.md +33 -3
- package/package/corpus/hooks/scripts/cratis-guard-writes.sh +53 -3
- package/package/corpus/rules/general.md +1 -1
- package/package/corpus/skills/cratis-arc-command/SKILL.md +21 -19
- package/package/corpus/skills/cratis-arc-command/references/generated-values.md +19 -54
- package/package/corpus/skills/cratis-arc-command/references/shop-generation.md +110 -0
- package/package/corpus/skills/cratis-fundamentals-concept/SKILL.md +21 -11
- package/package/corpus/skills/cratis-fundamentals-concept/references/shop-generation.md +108 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +1 -1
- package/package/corpus/skills/cratis-screenplay-command-surface/references/generated-values-and-responses.md +19 -16
- package/package/corpus/skills/cratis-screenplay-command-surface/references/shop-generation.md +96 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +11 -2
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/generate-notes.md +5 -4
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/generated-recovery.md +128 -0
- package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +18 -14
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/choosing-generation.md +30 -0
- package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +10 -2
- package/package/corpus/skills/cratis-screenplay-specifications/references/generated-fixtures.md +42 -10
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +13 -6
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/choosing-generation.md +30 -0
- package/package.json +1 -1
|
@@ -230,6 +230,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
230
230
|
if (!filePath) return;
|
|
231
231
|
if (!isInstalled(guardWrites)) return; // no guard installed in this repository - nothing to enforce
|
|
232
232
|
const payload = { cwd: ctx.cwd, tool_input: { file_path: filePath, content, new_string: newString } };
|
|
233
|
+
// The shared script resolves the write target's Git origin and allowDependencyManifestWrites setting;
|
|
234
|
+
// keep manifest defaults and generated/.env protection identical to Claude Code.
|
|
233
235
|
return runBlockingGuard(guardWrites, "cratis-guard-writes", "write", payload, ctx, "write guards");
|
|
234
236
|
});
|
|
235
237
|
|
|
@@ -92,13 +92,43 @@ Rule numbers refer to the numbered list in [`../rules/general.md`](../rules/gene
|
|
|
92
92
|
|
|
93
93
|
- Editing a file whose header marks it as Cratis-generated output — rule 15 `[contract]`
|
|
94
94
|
- Writing content that opens with such a header (hand-authoring a "generated" proxy)
|
|
95
|
-
- `Directory.Packages.props`, `global.json`, `NuGet.config
|
|
96
|
-
`pnpm-lock.yaml`, `packages.lock.json` — the
|
|
95
|
+
- `Directory.Packages.props`, `global.json`, `NuGet.config` (also `NuGet.Config` and `nuget.config`),
|
|
96
|
+
`yarn.lock`, `package-lock.json`, `pnpm-lock.yaml`, `packages.lock.json` — unless the
|
|
97
|
+
repository's dependency-manifest policy allows them (see below)
|
|
97
98
|
- `.env`, `.env.*`, `*.env` — secrets
|
|
98
99
|
|
|
99
100
|
The generated-file check is anchored: the marker must be a comment opener at the start of one of
|
|
100
101
|
the first five lines. A rule file or a document that merely *mentions* the marker is not blocked.
|
|
101
102
|
|
|
103
|
+
### Dependency-manifest writes
|
|
104
|
+
|
|
105
|
+
Manifest writes are allowed **silently by default** when Git's `origin` points to
|
|
106
|
+
`github.com/Cratis/<repo>` over HTTPS or SSH (including `git@github.com:Cratis/<repo>.git`;
|
|
107
|
+
host and owner are case-insensitive). The hook resolves the policy repository from the write
|
|
108
|
+
target, resolving relative paths against the tool's working directory, lexically collapsing
|
|
109
|
+
repeated separators, `.` and `..`, then walking up to the nearest existing directory for new
|
|
110
|
+
files. That directory is resolved physically before Git lookup, so symlinked directories use
|
|
111
|
+
the repository they actually point into. Nested directories and linked worktrees work too.
|
|
112
|
+
A missing or non-Cratis origin keeps the block; targets outside any Git repository are blocked. Installed corpus files and selected profiles do **not** prove organization
|
|
113
|
+
ownership: consumer applications can have exactly the same installation and profiles.
|
|
114
|
+
|
|
115
|
+
Set a repository-owned boolean in `.cratis/ai.json` to override that default in both Claude Code
|
|
116
|
+
and Pi:
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{ "allowDependencyManifestWrites": false }
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`false` re-enables the manifest block in a Cratis repository; `true` allows manifest writes
|
|
123
|
+
in any repository. Merge this property into the existing configuration. An absent, malformed,
|
|
124
|
+
or non-boolean setting uses the origin-based default. This setting never permits generated
|
|
125
|
+
output or `.env` writes. The protected basename list is unchanged; `package.json` is not
|
|
126
|
+
part of this guard's manifest category.
|
|
127
|
+
|
|
128
|
+
This allowance is not authorization for unrelated upgrades: keep changes task-focused and
|
|
129
|
+
call out version bumps in the PR description. Other repositories retain the rule requiring
|
|
130
|
+
an explicit request; their setting is a mechanical opt-out, not a change to that rule.
|
|
131
|
+
|
|
102
132
|
**Blocked outright** (`PreToolUse` on `Bash`, exit 2): a `cratis chronicle` command that is not
|
|
103
133
|
read-only. The **cratis-chronicle-cli-operations** skill makes `--yes` the authorization boundary for
|
|
104
134
|
a live store and says a request to diagnose does not authorize a mutation; this guard enforces that.
|
|
@@ -502,7 +532,7 @@ Each is an explicit, auditable opt-out — none of them is a default.
|
|
|
502
532
|
|
|
503
533
|
| Variable | Effect |
|
|
504
534
|
|---|---|
|
|
505
|
-
| `CRATIS_HOOKS_ALLOW_PROTECTED_WRITES=1` |
|
|
535
|
+
| `CRATIS_HOOKS_ALLOW_PROTECTED_WRITES=1` | bypasses all write protection, including generated files and `.env`, while set in the harness environment; use only for an explicitly requested protected write. Repository-scoped manifest allowance uses `.cratis/ai.json` instead and never bypasses those protections |
|
|
506
536
|
| `CRATIS_HOOKS_SKIP_SCAN=1` | disables the pattern pass |
|
|
507
537
|
| `CRATIS_HOOKS_SKIP_GATE=1` | disables the quality gate |
|
|
508
538
|
| `CRATIS_HOOKS_GATE_DRYRUN=1` | prints which gates would run, and why, then exits 0 |
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
# 1. Generated files — anything whose header marks it as Cratis-generated output
|
|
6
6
|
# (.cratis/ai/rules/general.md rule 15 [contract])
|
|
7
7
|
# 2. Dependency manifests — Directory.Packages.props, global.json, lockfiles, NuGet config
|
|
8
|
+
# (allowed by default for a github.com/Cratis origin)
|
|
8
9
|
# 3. Environment files — .env and friends (secrets)
|
|
9
10
|
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
11
|
+
# .cratis/ai.json allowDependencyManifestWrites overrides only the manifest policy:
|
|
12
|
+
# true allows them in any repository; false blocks them even in a Cratis repository.
|
|
12
13
|
#
|
|
13
14
|
# Escape hatch for the "unless explicitly asked" case — the user asks, you set it for the call:
|
|
14
15
|
# CRATIS_HOOKS_ALLOW_PROTECTED_WRITES=1
|
|
@@ -33,7 +34,30 @@ file="$(hook_json "$input" '.tool_input.file_path')"
|
|
|
33
34
|
[ -n "$file" ] || file="$(hook_json "$input" '.tool_input.notebook_path')"
|
|
34
35
|
[ -n "$file" ] || exit 0
|
|
35
36
|
|
|
37
|
+
# Lexically normalize before any Git lookup or parent walk, including nonexistent segments.
|
|
38
|
+
# Component parsing preserves spaces and glob characters without depending on realpath.
|
|
39
|
+
normalize_target_path() {
|
|
40
|
+
local remaining="$1" normalized="" component
|
|
41
|
+
while [ -n "$remaining" ]; do
|
|
42
|
+
component="${remaining%%/*}"
|
|
43
|
+
if [ "$remaining" = "$component" ]; then
|
|
44
|
+
remaining=""
|
|
45
|
+
else
|
|
46
|
+
remaining="${remaining#*/}"
|
|
47
|
+
fi
|
|
48
|
+
case "$component" in
|
|
49
|
+
"" | .) ;;
|
|
50
|
+
..) normalized="${normalized%/*}" ;;
|
|
51
|
+
*) normalized="$normalized/$component" ;;
|
|
52
|
+
esac
|
|
53
|
+
done
|
|
54
|
+
printf '%s\n' "${normalized:-/}"
|
|
55
|
+
}
|
|
56
|
+
|
|
36
57
|
file="$(hook_abspath "$file" "$cwd")"
|
|
58
|
+
file="$(normalize_target_path "$file")"
|
|
59
|
+
# Pi can run the bundled script in a consumer checkout; this root is only for diagnostics.
|
|
60
|
+
root="$(git -C "$cwd" rev-parse --show-toplevel 2>/dev/null || printf '%s\n' "$cwd")"
|
|
37
61
|
rel="$(hook_relpath "$file" "$root")"
|
|
38
62
|
base="$(basename "$file")"
|
|
39
63
|
|
|
@@ -66,12 +90,38 @@ if [ -n "$new_content" ] \
|
|
|
66
90
|
fi
|
|
67
91
|
|
|
68
92
|
# ── 2. Dependency manifests, lockfiles, SDK and NuGet configuration ───────────
|
|
93
|
+
manifest_writes_allowed() {
|
|
94
|
+
local setting="" origin directory policy_root
|
|
95
|
+
# Authorization belongs to the write target, which may be outside the session's checkout.
|
|
96
|
+
# New files can have nonexistent parents; find their nearest existing directory first.
|
|
97
|
+
directory="$(dirname "$file")"
|
|
98
|
+
while [ ! -d "$directory" ]; do
|
|
99
|
+
[ "$directory" != "/" ] || return 1
|
|
100
|
+
directory="$(dirname "$directory")"
|
|
101
|
+
done
|
|
102
|
+
# Follow existing directory symlinks before asking Git which repository owns the target.
|
|
103
|
+
directory="$(cd -P "$directory" 2>/dev/null && pwd -P)" || return 1
|
|
104
|
+
policy_root="$(git -C "$directory" rev-parse --show-toplevel 2>/dev/null)" || return 1
|
|
105
|
+
if [ -f "$policy_root/.cratis/ai.json" ]; then
|
|
106
|
+
# Only actual booleans override the default; jq's `// empty` would discard false.
|
|
107
|
+
setting="$(jq -r '.allowDependencyManifestWrites | select(type == "boolean") | tostring' "$policy_root/.cratis/ai.json" 2>/dev/null || true)"
|
|
108
|
+
fi
|
|
109
|
+
case "$setting" in
|
|
110
|
+
true) return 0 ;;
|
|
111
|
+
false) return 1 ;;
|
|
112
|
+
esac
|
|
113
|
+
origin="$(git -C "$policy_root" remote get-url origin 2>/dev/null || true)"
|
|
114
|
+
# Anchor host, owner and the single repository segment; never infer ownership from profiles.
|
|
115
|
+
printf '%s\n' "$origin" | LC_ALL=C grep -Eiq '^(https://github\.com/|git@github\.com:|ssh://git@github\.com(:[0-9]+)?/)cratis/[a-z0-9_.-]+/?$'
|
|
116
|
+
}
|
|
117
|
+
|
|
69
118
|
case "$base" in
|
|
70
119
|
Directory.Packages.props | global.json | NuGet.config | NuGet.Config | nuget.config \
|
|
71
120
|
| yarn.lock | package-lock.json | pnpm-lock.yaml | packages.lock.json)
|
|
121
|
+
if manifest_writes_allowed; then exit 0; fi
|
|
72
122
|
block \
|
|
73
123
|
"'$base' is a dependency manifest / lockfile / SDK or NuGet configuration file. .cratis/ai/rules/general.md (Source-of-Truth Discipline): don't change these unless explicitly asked." \
|
|
74
|
-
"If the user explicitly asked for this change, re-run the tool call with CRATIS_HOOKS_ALLOW_PROTECTED_WRITES=1 exported. Otherwise take the dependency as given and solve the problem in source."
|
|
124
|
+
"To allow dependency updates for this repository, set allowDependencyManifestWrites to true in .cratis/ai.json. If the user explicitly asked for this change, re-run the tool call with CRATIS_HOOKS_ALLOW_PROTECTED_WRITES=1 exported. Otherwise take the dependency as given and solve the problem in source."
|
|
75
125
|
;;
|
|
76
126
|
esac
|
|
77
127
|
|
|
@@ -165,7 +165,7 @@ A claim is only as good as the signal behind it — a build result, a test run,
|
|
|
165
165
|
- **Skills and rules are the authoritative answer.** If not answered there, ask. Don't infer Cratis behavior from package internals.
|
|
166
166
|
- Only make high-confidence suggestions.
|
|
167
167
|
- When a user asks how to get help, has a question not answered by the docs, or wants to discuss design, point them to the [Cratis Discord](https://discord.gg/kt4AMpV8WV); direct confirmed bugs to GitHub issues.
|
|
168
|
-
-
|
|
168
|
+
- In Cratis organization repositories (a `github.com/Cratis/<repo>` Git `origin`), update dependency manifests / lockfiles / `global.json` / NuGet config as needed for the task; avoid unrelated version churn and call out version bumps in the PR description. In other repositories, don't change them unless explicitly asked.
|
|
169
169
|
- When asked to **ship** or **land** changes, use the **ship-changes** prompt (`.cratis/ai/prompts/ship-changes.prompt.md`); invoking it is what authorizes the branch → commits → push → PR → merge → cleanup chain it describes. A request to only commit, only push, or only open a PR authorizes exactly that step, under [Git commits](./git-commits.md) and [Pull requests](./pull-requests.md) — do not route it through ship-changes and do not add the later steps.
|
|
170
170
|
|
|
171
171
|
## General
|
|
@@ -172,25 +172,27 @@ public record Transfer(<AccountId> From, <AccountId> To, <Money> Amount)
|
|
|
172
172
|
|
|
173
173
|
## Generate a server-owned new identifier
|
|
174
174
|
|
|
175
|
-
**Arc 22.66.0
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
175
|
+
**Arc 22.66.0+**: replace local `New()` with a `[GeneratedValue]` Handle parameter,
|
|
176
|
+
never a request property. Use a non-nullable self-generatable concept and a unique,
|
|
177
|
+
case-sensitive generated name. Return the value explicitly if the caller needs it.
|
|
178
|
+
Read [generated values](references/generated-values.md) for Provide/DI boundaries,
|
|
179
|
+
validation/captures, ARC0022–ARC0025, migration and named pins; newer context
|
|
180
|
+
factories are version-qualified in the shop reference below.
|
|
181
|
+
|
|
182
|
+
## Choosing a strategy
|
|
183
|
+
|
|
184
|
+
Use the [threaded shop example](references/shop-generation.md): CustomerId
|
|
185
|
+
(`cus_` + ULID), context-aware TypeID OrderId, NanoID InviteCode and secret
|
|
186
|
+
`Bytes(32)` ApiKey. Arc 22.87.1 resolves Fundamentals 7.24.0 and passes captured
|
|
187
|
+
received time/tenant to context factories; released Clock/Tenant scenario setup
|
|
188
|
+
is shown there. Earlier version-qualified examples above remain unchanged.
|
|
189
|
+
|
|
190
|
+
## When not to generate
|
|
191
|
+
|
|
192
|
+
Keep client-owned IDs as inputs. Generation is not authorization, tenant
|
|
193
|
+
isolation, idempotency, freshness or gapless invoice numbering. Credentials need
|
|
194
|
+
explicit entropy, `[NotAudited]`, authorized delivery and hash storage; never
|
|
195
|
+
log captures or persist plaintext authentication keys. See [boundaries](references/shop-generation.md#when-not-to-generate).
|
|
194
196
|
|
|
195
197
|
## Where the event source id comes from
|
|
196
198
|
|
|
@@ -18,50 +18,13 @@ Generated parameters arrived in Arc **22.66.0**, scenario pinning in **22.67.0**
|
|
|
18
18
|
and analyzers in **22.68.0**. The examples and behavior here are verified at
|
|
19
19
|
**v22.68.0**, which pins Fundamentals **7.23.0**.
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
using Cratis.Arc.Commands.ModelBound;
|
|
29
|
-
using Cratis.Concepts;
|
|
30
|
-
|
|
31
|
-
namespace Shopping.Carts;
|
|
32
|
-
|
|
33
|
-
/// <summary>
|
|
34
|
-
/// Represents a cart identifier.
|
|
35
|
-
/// </summary>
|
|
36
|
-
/// <param name="Value">The underlying identifier.</param>
|
|
37
|
-
public record CartId(Guid Value) : ConceptAs<Guid>(Value), IGeneratable<CartId>
|
|
38
|
-
{
|
|
39
|
-
/// <summary>
|
|
40
|
-
/// Creates a new cart identifier.
|
|
41
|
-
/// </summary>
|
|
42
|
-
/// <returns>A new cart identifier.</returns>
|
|
43
|
-
public static CartId New() => new(GenerateValue.Uuid());
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/// <summary>
|
|
47
|
-
/// Allocates a server-owned cart identifier.
|
|
48
|
-
/// </summary>
|
|
49
|
-
[Command]
|
|
50
|
-
public record AllocateCartId
|
|
51
|
-
{
|
|
52
|
-
/// <summary>
|
|
53
|
-
/// Returns the allocated identifier to the caller.
|
|
54
|
-
/// </summary>
|
|
55
|
-
/// <param name="cartId">The server-generated identifier.</param>
|
|
56
|
-
/// <returns>The allocated identifier.</returns>
|
|
57
|
-
public CartId Handle([GeneratedValue("cart")] CartId cartId) => cartId;
|
|
58
|
-
}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
For a Chronicle stream identity, derive `CartId` from `EventSourceId<Guid>`
|
|
62
|
-
instead; see `cratis-fundamentals-concept`. Return `(id, event)` to both append
|
|
63
|
-
and give the caller the new stream id, as in SKILL.md. An identifier is not an
|
|
64
|
-
event, and generation alone does not persist anything.
|
|
21
|
+
For the current threaded example, read [shop commands](shop-generation.md) and
|
|
22
|
+
[shop concepts](../../cratis-fundamentals-concept/references/shop-generation.md).
|
|
23
|
+
Those declarations are separately verified at Arc 22.87.1 / Fundamentals 7.24.0:
|
|
24
|
+
CustomerId (`cus_` + ULID), context-aware TypeID OrderId, NanoID InviteCode and
|
|
25
|
+
secret bytes ApiKey. They allocate responses, not events or persisted entities.
|
|
26
|
+
For a real Chronicle stream identity use `EventSourceId<T>`; return `(id, event)`
|
|
27
|
+
to append and return the stream ID, or use an explicit event-source wrapper.
|
|
65
28
|
|
|
66
29
|
Keep existing/client-chosen identifiers and references on command properties.
|
|
67
30
|
Services and read models remain ordinary dependencies, not generated values.
|
|
@@ -77,7 +40,7 @@ The type must be non-nullable and implement `IGeneratable<TSelf>` for itself;
|
|
|
77
40
|
a raw `Guid`, nullable concept or by-reference parameter is invalid. Use domain
|
|
78
41
|
concepts; the runtime's type check is the self-generatable interface contract.
|
|
79
42
|
|
|
80
|
-
`[GeneratedValue]` uses the parameter name. `[GeneratedValue("
|
|
43
|
+
`[GeneratedValue]` uses the parameter name. `[GeneratedValue("customerId")]` keeps the
|
|
81
44
|
pin/capture name stable across a parameter rename. Names are case-sensitive,
|
|
82
45
|
non-whitespace and unique within the command.
|
|
83
46
|
|
|
@@ -94,7 +57,8 @@ turn the defect into a user rejection or disable validation to make it pass.
|
|
|
94
57
|
|
|
95
58
|
Validated values enter `CommandContext.GeneratedValues` in parameter-resolution
|
|
96
59
|
order. Each capture has zero-based `Order`, `Name`, declared `Type` and `Value`;
|
|
97
|
-
`Get<
|
|
60
|
+
`Get<CustomerId>("customerId")` retrieves the latest matching capture for the
|
|
61
|
+
shop's CustomerId parameter. Rejected values are
|
|
98
62
|
not captured. A Handle parameter is not a request property and is not audited
|
|
99
63
|
as command input. Do not log or trace captures or validator failure text, which
|
|
100
64
|
can contain values. Returning a value or putting it in an event still follows the
|
|
@@ -114,12 +78,11 @@ handler-construction checks remain for declarations compiled without analyzers.
|
|
|
114
78
|
|
|
115
79
|
## Migrate generation inside Handle
|
|
116
80
|
|
|
117
|
-
For `var id =
|
|
118
|
-
`Handle()`, keep the request contract unchanged:
|
|
81
|
+
For `var id = CustomerId.New();` in `Handle()`, keep the request unchanged:
|
|
119
82
|
|
|
120
|
-
1.
|
|
121
|
-
|
|
122
|
-
2. Replace
|
|
83
|
+
1. Keep CustomerId's `IGeneratable<CustomerId>` strategy (`cus_` + ULID), or
|
|
84
|
+
OrderId's context contract, as shown in [shop generation](shop-generation.md).
|
|
85
|
+
2. Replace local allocation with `[GeneratedValue("customerId")] CustomerId customerId`
|
|
123
86
|
on `Handle()`, then use that parameter in the existing return/operation shape.
|
|
124
87
|
3. Return the id if the caller needs it; a capture is not an automatic response.
|
|
125
88
|
4. Pin the concept by generated name in pipeline specifications. For a pure
|
|
@@ -161,8 +124,10 @@ the prior verification): `Source/DotNET/Arc.Core/Commands/ModelBound/GeneratedVa
|
|
|
161
124
|
`Source/DotNET/Arc.Core.CodeAnalysis/DiagnosticDescriptors.cs`; and
|
|
162
125
|
`Source/DotNET/Testing/Commands/CommandScenarioGeneratedValueExtensions.cs`.
|
|
163
126
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
127
|
+
The older 22.75.0 baseline has no contextual generation beyond Fundamentals
|
|
128
|
+
7.23.0 UUID helpers. Arc **22.87.1** separately supports received-time/tenant
|
|
129
|
+
context and Fundamentals 7.24.0's additional strategies; [sources and Clock/Tenant
|
|
130
|
+
setup](shop-generation.md). Neither tag supplies a native freshness/collision
|
|
131
|
+
allocator or a pattern contract. Screenplay 4.147.0+ separately admits concept `generate`
|
|
167
132
|
strategies and freshness; see `cratis-screenplay-command-surface/references/generated-values-and-responses.md`
|
|
168
133
|
for that language contract and Stage's explicit scopes, not native Arc freshness support.
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
# Shop commands: generation stays out of requests
|
|
5
|
+
|
|
6
|
+
## Contents
|
|
7
|
+
|
|
8
|
+
- Choosing a strategy
|
|
9
|
+
- When not to generate
|
|
10
|
+
- Verified released sources
|
|
11
|
+
|
|
12
|
+
## Choosing a strategy
|
|
13
|
+
|
|
14
|
+
Use the [same shop concepts](../../cratis-fundamentals-concept/references/shop-generation.md):
|
|
15
|
+
CustomerId is `cus_` + ULID; OrderId is context-aware TypeID; InviteCode is NanoID;
|
|
16
|
+
ApiKey is secret `Bytes(32)` with `[NotAudited]`. The concept owns the factory,
|
|
17
|
+
not a command property or a per-call random implementation.
|
|
18
|
+
|
|
19
|
+
The following complete command declarations depend on those Shop concepts and
|
|
20
|
+
`Cratis.Arc.Core` / `Cratis.Arc.Chronicle` **22.87.1**, resolving Fundamentals
|
|
21
|
+
**7.24.0**. They allocate response values only, not persisted entities or events;
|
|
22
|
+
they are not production authentication endpoints. Protect any credential-issuing
|
|
23
|
+
endpoint independently before hosting it.
|
|
24
|
+
|
|
25
|
+
```csharp
|
|
26
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
27
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
28
|
+
|
|
29
|
+
using Cratis.Arc.Commands.ModelBound;
|
|
30
|
+
|
|
31
|
+
namespace Shop;
|
|
32
|
+
|
|
33
|
+
[Command]
|
|
34
|
+
public record AllocateCustomerId
|
|
35
|
+
{
|
|
36
|
+
public CustomerId Handle([GeneratedValue("customerId")] CustomerId customerId) => customerId;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[Command]
|
|
40
|
+
public record AllocateOrderId
|
|
41
|
+
{
|
|
42
|
+
public OrderId Handle([GeneratedValue("orderId")] OrderId orderId) => orderId;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
[Command]
|
|
46
|
+
public record AllocateInviteCode
|
|
47
|
+
{
|
|
48
|
+
public InviteCode Handle([GeneratedValue("inviteCode")] InviteCode inviteCode) => inviteCode;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[Command]
|
|
52
|
+
public record AllocateApiKey
|
|
53
|
+
{
|
|
54
|
+
public ApiKey Handle([GeneratedValue("apiKey")] ApiKey apiKey) => apiKey;
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Arc **22.87.1** supports `IGeneratableInContext<TSelf>`: it maps captured
|
|
59
|
+
`CommandContext.ReceivedAt` to `Now` and `ITenantIdAccessor.Current` to `Tenant`.
|
|
60
|
+
NotSet/Default tenants become the zero-GUID default; named tenants retain their
|
|
61
|
+
identifier. TypeID uses time only; the context carries the tenant but the built-in
|
|
62
|
+
factory does not encode it. Keep tenant authorization/storage scope independent.
|
|
63
|
+
|
|
64
|
+
Arc prefers context if both generation interfaces are implemented. An unpinned
|
|
65
|
+
context factory with default ReceivedAt throws `MissingGenerationTime`, even
|
|
66
|
+
when custom code ignores time; it never reads a replacement UtcNow. Pins bypass
|
|
67
|
+
generation, not concept validation. Validate-only requests do not allocate or
|
|
68
|
+
reserve the generated value for a later command.
|
|
69
|
+
|
|
70
|
+
For a command pipeline specification, these setup calls are released at **22.87.1**:
|
|
71
|
+
|
|
72
|
+
```csharp excerpt
|
|
73
|
+
using var scenario = new CommandScenario<AllocateOrderId>();
|
|
74
|
+
scenario.Clock(DateTimeOffset.Parse("2026-10-05T08:00:00Z"));
|
|
75
|
+
scenario.Tenant(new TenantId("shop-eu"));
|
|
76
|
+
scenario.PinGeneratedValue("orderId", new OrderId("order_0000000000e008000000000000"));
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Imports: `System`, `Shop`, `Cratis.Arc.Testing.Commands`, `Cratis.Arc.Tenancy`.
|
|
80
|
+
Configure before Execute/Validate; Clock also precedes initialization. Clock fixes
|
|
81
|
+
receipt/UTC wall time, not randomness; Tenant changes the scenario's executions,
|
|
82
|
+
not its caller. A pin fixes the whole OrderId and bypasses its factory. To inspect
|
|
83
|
+
an unpinned timestamp contract, opt in with `AllowGeneration()` and assert shape
|
|
84
|
+
and captured-time semantics, never one exact random suffix.
|
|
85
|
+
|
|
86
|
+
## When not to generate
|
|
87
|
+
|
|
88
|
+
- Existing/client-owned IDs stay command inputs; services/read models remain
|
|
89
|
+
ordinary dependencies. Generation is not authorization or tenant isolation.
|
|
90
|
+
- Randomness is not idempotency, storage freshness or a gapless invoice allocator.
|
|
91
|
+
Arc#3129 freshness is not delivered by this parameter API; Stage's v15 explicit
|
|
92
|
+
scopes are a separate realization.
|
|
93
|
+
- ApiKey is a credential, never a Chronicle stream ID. `[NotAudited]` protects
|
|
94
|
+
causation only. Never log captures, return secrets on public endpoints, or
|
|
95
|
+
append plaintext authentication credentials. Retain a hash; for retained
|
|
96
|
+
operational secrets use `[Encrypted]` plus `[NotAudited]`.
|
|
97
|
+
- Screenplay's generated context and secret execution remain unavailable. A
|
|
98
|
+
compiled Arc factory does not imply that it can recover or render as `.play`.
|
|
99
|
+
|
|
100
|
+
## Verified released sources
|
|
101
|
+
|
|
102
|
+
Arc `v22.87.1:Source/DotNET/Arc.Core/Commands/GeneratedValueResolution.cs:35-79`,
|
|
103
|
+
`GeneratedValueFactories.cs:55-124`, `CommandContext.cs:63`;
|
|
104
|
+
`Source/DotNET/Testing/Commands/CommandScenarioGeneratedValueExtensions.cs:52-92`;
|
|
105
|
+
`Source/DotNET/Chronicle/Commands/NotAuditedAttribute.cs`,
|
|
106
|
+
`CommandCausationValues.cs:94-102` (command causation exclusion, not event/log protection);
|
|
107
|
+
`Documentation/backend/csharp/commands/generated-values.md`;
|
|
108
|
+
`Directory.Packages.props` resolves Fundamentals 7.24.0.
|
|
109
|
+
Factory/context signatures are source-checked at Fundamentals v7.24.0 in the
|
|
110
|
+
linked shop concept reference. This does not update the corpus's global pins.
|
|
@@ -15,7 +15,7 @@ This skill is verified against these exact public releases:
|
|
|
15
15
|
|
|
16
16
|
| Package | Version | Purpose |
|
|
17
17
|
| --- | --- | --- |
|
|
18
|
-
| `Cratis.Fundamentals` | `7.
|
|
18
|
+
| `Cratis.Fundamentals` | `7.24.0` | `ConceptAs<T>`, `IGeneratable<TSelf>`, `IGeneratableInContext<TSelf>`, `GenerationContext` and `GenerateValue` |
|
|
19
19
|
| `Cratis.Chronicle` | `18.3.0` | `Cratis.Chronicle.Events.EventSourceId` and `EventSourceId<T>` |
|
|
20
20
|
| `@cratis/fundamentals` | `7.23.0` | TypeScript `ConceptAs<T>`, `field`, `Guid`, and JSON conversion |
|
|
21
21
|
|
|
@@ -114,17 +114,26 @@ bits from `RandomNumberGenerator`:
|
|
|
114
114
|
millisecond, and clock adjustments can reorder values.
|
|
115
115
|
|
|
116
116
|
Neither helper guarantees uniqueness; a collision is extremely unlikely, not
|
|
117
|
-
impossible.
|
|
118
|
-
`
|
|
117
|
+
impossible. Fundamentals **7.24.0** also supplies ULID, TypeID, NanoID and encoded
|
|
118
|
+
bytes. `IGeneratableInContext<TSelf>` declares static `New(GenerationContext)`
|
|
119
|
+
for a captured time and portable tenant. Built-ins consume time, not tenant;
|
|
120
|
+
context is not tenant isolation. Default time is rejected, not replaced with now.
|
|
121
|
+
Sources and the complete shop example: [shop generation](references/shop-generation.md).
|
|
119
122
|
|
|
120
|
-
|
|
123
|
+
## Choosing a strategy
|
|
121
124
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
The shared shop uses CustomerId (`cus_` + ULID), context-aware OrderId (TypeID),
|
|
126
|
+
InviteCode (NanoID), and secret ApiKey (`Bytes(32)`, `[NotAudited]` in its host).
|
|
127
|
+
Read [choices, time/tenant context and protection](references/shop-generation.md).
|
|
128
|
+
Resolve Fundamentals 7.24.0 before using these newer helpers; the earlier 7.23.0
|
|
129
|
+
UUID examples remain supported.
|
|
130
|
+
|
|
131
|
+
## When not to generate
|
|
132
|
+
|
|
133
|
+
Client-supplied identities stay inputs; random generation is not idempotency or
|
|
134
|
+
gapless numbering. UUIDs are not credentials. Byte generation can create a secret
|
|
135
|
+
in 7.24.0, but audit suppression, authorized delivery and hash storage are separate
|
|
136
|
+
host responsibilities; never treat randomness as protection.
|
|
128
137
|
|
|
129
138
|
In specifications, construct the concept from a known value
|
|
130
139
|
(`new <ConceptName>(Guid.Parse("…"))`) and assert against it. Do not seed or
|
|
@@ -258,7 +267,8 @@ repository structure.
|
|
|
258
267
|
- Enums remain enums.
|
|
259
268
|
- A concept that creates its own value implements `IGeneratable<TSelf>`; a
|
|
260
269
|
Guid-backed one uses `GenerateValue`, not `Guid.NewGuid()` or `Random`.
|
|
261
|
-
Client-supplied
|
|
270
|
+
Client-supplied/idempotent values are not freshly generated; secrets use the
|
|
271
|
+
explicit entropy, audit and storage contract in [shop generation](references/shop-generation.md).
|
|
262
272
|
- Null absence uses a nullable concept reference rather than a null wrapped
|
|
263
273
|
value.
|
|
264
274
|
- Primitive-to-derived conversions and sentinels exist only when justified by
|
|
@@ -0,0 +1,108 @@
|
|
|
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
|
+
# Small-shop generation: choose the value's job
|
|
5
|
+
|
|
6
|
+
## Contents
|
|
7
|
+
|
|
8
|
+
- Choosing a strategy
|
|
9
|
+
- When not to generate
|
|
10
|
+
- Verified released sources
|
|
11
|
+
|
|
12
|
+
## Choosing a strategy
|
|
13
|
+
|
|
14
|
+
At **Fundamentals 7.24.0**, a shop can use CustomerId (`cus_` + ULID) for
|
|
15
|
+
recognizable time-ordered customer references, OrderId (TypeID) for typed order
|
|
16
|
+
references, InviteCode (NanoID) for opaque invitation references, and ApiKey
|
|
17
|
+
(`Bytes(32)`) for a 256-bit credential. UUID remains the ordinary identity choice;
|
|
18
|
+
encoded bytes make an exact entropy budget explicit. Prefixes add no entropy.
|
|
19
|
+
UUIDv7/ULID/TypeID reveal time and are not monotonic within a millisecond.
|
|
20
|
+
An invitation reference here is not by itself permission to join the shop; if
|
|
21
|
+
possession is the authorization mechanism, treat it as a protected credential too.
|
|
22
|
+
|
|
23
|
+
This complete concept excerpt requires `Cratis.Fundamentals` **7.24.0** and,
|
|
24
|
+
for the ApiKey audit attribute, `Cratis.Arc.Chronicle` **22.87.1**. These are
|
|
25
|
+
non-stream references; use `EventSourceId<string>` instead only if a concept
|
|
26
|
+
actually identifies a Chronicle event source.
|
|
27
|
+
|
|
28
|
+
```csharp
|
|
29
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
30
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
31
|
+
|
|
32
|
+
using Cratis.Arc.Chronicle.Commands;
|
|
33
|
+
using Cratis.Concepts;
|
|
34
|
+
|
|
35
|
+
namespace Shop;
|
|
36
|
+
|
|
37
|
+
public record CustomerId(string Value) : ConceptAs<string>(Value), IGeneratable<CustomerId>
|
|
38
|
+
{
|
|
39
|
+
public static CustomerId New() => new($"cus_{GenerateValue.Ulid()}");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public record OrderId(string Value) : ConceptAs<string>(Value), IGeneratableInContext<OrderId>
|
|
43
|
+
{
|
|
44
|
+
public static OrderId New(GenerationContext context) => new(GenerateValue.TypeId("order", context));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public record InviteCode(string Value) : ConceptAs<string>(Value), IGeneratable<InviteCode>
|
|
48
|
+
{
|
|
49
|
+
public static InviteCode New() => new(GenerateValue.NanoId());
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
[NotAudited]
|
|
53
|
+
public record ApiKey(string Value) : ConceptAs<string>(Value), IGeneratable<ApiKey>
|
|
54
|
+
{
|
|
55
|
+
public static ApiKey New() => new(GenerateValue.Bytes(32));
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`CustomerId` has 80 random bits; the custom prefix is not a TypeID. `OrderId`
|
|
60
|
+
has 74 random bits and the TypeID `order_` prefix. Default NanoID is 21 symbols
|
|
61
|
+
with 126 bits; bytes use unpadded base64url (43 symbols for 32 bytes).
|
|
62
|
+
|
|
63
|
+
`IGeneratableInContext<TSelf>` requires `static abstract TSelf New(GenerationContext)`.
|
|
64
|
+
`GenerationContext` holds one captured `DateTimeOffset Now` and a portable String
|
|
65
|
+
`Tenant`; `DefaultTenant` is the zero-GUID string, never a display name or empty
|
|
66
|
+
string. The shop passes time and tenant together, for example:
|
|
67
|
+
|
|
68
|
+
```csharp excerpt
|
|
69
|
+
var context = new GenerationContext(
|
|
70
|
+
DateTimeOffset.Parse("2026-10-05T08:00:00Z"), "shop-eu");
|
|
71
|
+
var orderId = OrderId.New(context);
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
This excerpt assumes `System`, `Cratis.Concepts` and the Shop declarations above.
|
|
75
|
+
TypeID consumes `Now`, **not Tenant**. Passing a tenant does not encode it or
|
|
76
|
+
provide isolation; retain tenant scope independently in the host/storage.
|
|
77
|
+
A domain factory can read Tenant, but arbitrary tenant IDs cannot be inserted
|
|
78
|
+
into a TypeID prefix (only lowercase letters/underscores, letter endpoints).
|
|
79
|
+
Do not present a tenant-prefixed custom string as standard TypeID.
|
|
80
|
+
|
|
81
|
+
Use the context form only for time/tenant-dependent generation. If both interfaces
|
|
82
|
+
are implemented, callers choose context; the interfaces themselves do not dispatch.
|
|
83
|
+
Built-in context overloads reject default Now (`MissingGenerationTime`) and time
|
|
84
|
+
before the Unix epoch. A fixed context fixes the timestamp, not random suffixes.
|
|
85
|
+
|
|
86
|
+
## When not to generate
|
|
87
|
+
|
|
88
|
+
- Client-minted customer/order IDs stay inputs. Do not replace them on retry.
|
|
89
|
+
- Random values supply neither idempotency nor gapless invoice allocation.
|
|
90
|
+
- An ID is not an authentication token or authorization policy.
|
|
91
|
+
- ApiKey is a **secret**, not an event-source ID. `[NotAudited]` withholds command
|
|
92
|
+
causation values; it does not protect logs, responses or storage. Deliver a
|
|
93
|
+
credential only over an authorized secure channel and retain its hash, not
|
|
94
|
+
plaintext. For a retained operational integration secret instead, use
|
|
95
|
+
`[Encrypted]` plus `[NotAudited]` as described by `cratis-arc-command`.
|
|
96
|
+
- Never log generated values/captures or seed production randomness. Use known
|
|
97
|
+
values in specs; test shape/time separately when randomness is the behavior.
|
|
98
|
+
|
|
99
|
+
## Verified released sources
|
|
100
|
+
|
|
101
|
+
Fundamentals `v7.24.0:Source/DotNET/Fundamentals/Concepts/GenerationContext.cs:6-17`,
|
|
102
|
+
`IGeneratableInContext.cs:13-21`, `GenerateValue.TimeOrderedStrings.cs:15-57`,
|
|
103
|
+
`GenerateValue.RandomStrings.cs:10-64`; `Documentation/csharp/generating-values.md`.
|
|
104
|
+
Arc `v22.87.1:Source/DotNET/Chronicle/Commands/NotAuditedAttribute.cs`,
|
|
105
|
+
`CommandCausationValues.cs:94-102` (command/type/property exclusion only, never
|
|
106
|
+
payload encryption or log protection);
|
|
107
|
+
`Documentation/backend/csharp/commands/generated-values.md`.
|
|
108
|
+
The latter attribute belongs to the host integration, not Fundamentals.
|
|
@@ -29,7 +29,7 @@ Pins: toolchain `references/versions.md`; sources below. Compilation is not exec
|
|
|
29
29
|
- `4.68.0` (`79801bf`): generated-value/response rule probes (ESM v7).
|
|
30
30
|
- `4.127.0`: identity and compliance syntax (`identity.md`, `context.md`, `concepts.md`, `purposes.md`, `events.md`, `diagnostics.md`).
|
|
31
31
|
- `4.141.0`: v13 compliance admission; rechecked at `4.142.0`: `references/compliance.md`.
|
|
32
|
-
- `4.148.0`: v15 generation strategies/strict fixtures/freshness; Stage `4.89.1` realization: `references/generated-values-and-responses.md`.
|
|
32
|
+
- `4.148.0`: v15 generation strategies/strict fixtures/freshness; Stage `4.89.1` realization: `references/generated-values-and-responses.md`; shop: `references/shop-generation.md`.
|
|
33
33
|
|
|
34
34
|
"Parses" and "runs" are different claims. The executable profile, and what
|
|
35
35
|
each construct binds to, is in the `cratis-screenplay-model-authoring` language
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
## Contents
|
|
4
4
|
|
|
5
|
+
- Choosing a strategy
|
|
6
|
+
- When not to
|
|
5
7
|
- The concept declares how; the property declares that
|
|
6
8
|
- Inspect and edit generation through MCP
|
|
7
9
|
- Version and freshness
|
|
@@ -22,24 +24,25 @@ Cratis/cli `v3.57.0:Directory.Packages.props:8-10`; Cratis/Stage
|
|
|
22
24
|
`v4.89.1:Documentation/reference/generated-values-rendering.md:6-146`.
|
|
23
25
|
Decision 0054 describes later phases too; only its shipped phase 2b-1 is taught here.
|
|
24
26
|
|
|
27
|
+
## Choosing a strategy
|
|
28
|
+
|
|
29
|
+
Use the [threaded shop model](shop-generation.md): CustomerId is `cus_` + ULID,
|
|
30
|
+
OrderId is TypeID, InviteCode is NanoID. It links the same .NET concepts but does
|
|
31
|
+
not claim their received-time/tenant context or secret ApiKey Bytes(32) factory
|
|
32
|
+
is executable in Screenplay. The table below owns exact strategy shapes.
|
|
33
|
+
|
|
34
|
+
## When not to
|
|
35
|
+
|
|
36
|
+
Client-minted values remain inputs. Generation is not authorization, idempotency,
|
|
37
|
+
gapless invoice allocation or a credential contract. Preserve ApiKey's `secret`
|
|
38
|
+
classification without generated properties; context/secret execution remains
|
|
39
|
+
Screenplay#616 phases 3/4, not a reason to strip protection.
|
|
40
|
+
|
|
25
41
|
## The concept declares how; the property declares that
|
|
26
42
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
concept ReceiptCode : String
|
|
31
|
-
generate nanoid
|
|
32
|
-
command RegisterProject
|
|
33
|
-
projectId ProjectId generated identifier
|
|
34
|
-
receipt ReceiptCode generated
|
|
35
|
-
name String
|
|
36
|
-
produces event ProjectRegistered
|
|
37
|
-
name String = name
|
|
38
|
-
receipt ReceiptCode = receipt
|
|
39
|
-
returns
|
|
40
|
-
projectId = projectId
|
|
41
|
-
receipt ReceiptCode = receipt
|
|
42
|
-
```
|
|
43
|
+
The complete reference-executable [shop example](shop-generation.md) declares
|
|
44
|
+
strategies on concepts and `generated`/`generated identifier` on properties.
|
|
45
|
+
It includes whole-value fixture pins and returned IDs.
|
|
43
46
|
|
|
44
47
|
A generated property must be a required scalar **concept**, not a bare primitive,
|
|
45
48
|
optional value or collection. Only Uuid and String generation are executable.
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
# The shop in Screenplay: keep the release boundary
|
|
5
|
+
|
|
6
|
+
## Choosing a strategy
|
|
7
|
+
|
|
8
|
+
Use the same vocabulary as the [Fundamentals/Arc shop](../../cratis-fundamentals-concept/references/shop-generation.md),
|
|
9
|
+
but only the released language realization: CustomerId is `cus_` + uppercase
|
|
10
|
+
ULID, OrderId is `typeid "order"`, and InviteCode is NanoID. Their strategies
|
|
11
|
+
belong to concepts; command properties only say `generated`/`generated identifier`.
|
|
12
|
+
The existing [strategy reference](generated-values-and-responses.md) owns exact
|
|
13
|
+
encodings, entropy, MCP edits, fixtures and freshness.
|
|
14
|
+
|
|
15
|
+
**Context-dependent generation is not released in Screenplay.** The OrderId below
|
|
16
|
+
is time-ordered TypeID, not Arc's received-time/tenant factory contract; Stage
|
|
17
|
+
4.89.1 emits a wall-clock `New()`. Passed-through GenerationContext in Arc source
|
|
18
|
+
recovery describes that strategy shape, not equivalent clock/tenant semantics.
|
|
19
|
+
Context-member/rule recovery stays in code (Screenplay#616 phase 3).
|
|
20
|
+
|
|
21
|
+
The shop's ApiKey remains a **secret**. In .NET its factory is `Bytes(32)` and its
|
|
22
|
+
concept is `[NotAudited]`; executable secret generation is **not released in
|
|
23
|
+
Screenplay** (phase 4). The declaration below preserves classification without
|
|
24
|
+
adding `generate bytes 32` or a generated command property. No API-key issuance
|
|
25
|
+
behavior is claimed; retain it as an explicit gap/owning implementation contract.
|
|
26
|
+
|
|
27
|
+
This complete reference-executable model uses the pinned Screenplay **4.151.0**:
|
|
28
|
+
|
|
29
|
+
```screenplay
|
|
30
|
+
concept CustomerId : String
|
|
31
|
+
generate ulid prefix "cus_"
|
|
32
|
+
concept OrderId : String
|
|
33
|
+
generate typeid "order"
|
|
34
|
+
concept InviteCode : String
|
|
35
|
+
generate nanoid
|
|
36
|
+
concept ApiKey : String secret
|
|
37
|
+
module Shop
|
|
38
|
+
feature Customers
|
|
39
|
+
slice StateChange Register
|
|
40
|
+
command RegisterCustomer
|
|
41
|
+
customerId CustomerId generated identifier
|
|
42
|
+
inviteCode InviteCode generated
|
|
43
|
+
produces event CustomerRegistered
|
|
44
|
+
inviteCode InviteCode = inviteCode
|
|
45
|
+
returns
|
|
46
|
+
customerId = customerId
|
|
47
|
+
inviteCode = inviteCode
|
|
48
|
+
specification RegistersWithPinnedValues
|
|
49
|
+
when RegisterCustomer
|
|
50
|
+
for "cus_01ARZ3NDEKTSV4RRFFQ69G5FAV"
|
|
51
|
+
generated inviteCode = "abcdefghijklmnopqrstu"
|
|
52
|
+
then CustomerRegistered
|
|
53
|
+
for "cus_01ARZ3NDEKTSV4RRFFQ69G5FAV"
|
|
54
|
+
inviteCode = "abcdefghijklmnopqrstu"
|
|
55
|
+
then returns
|
|
56
|
+
customerId = "cus_01ARZ3NDEKTSV4RRFFQ69G5FAV"
|
|
57
|
+
inviteCode = "abcdefghijklmnopqrstu"
|
|
58
|
+
feature Orders
|
|
59
|
+
slice StateChange Place
|
|
60
|
+
command PlaceOrder
|
|
61
|
+
orderId OrderId generated identifier
|
|
62
|
+
produces event OrderPlaced
|
|
63
|
+
returns orderId
|
|
64
|
+
specification PlacesWithPinnedValue
|
|
65
|
+
when PlaceOrder
|
|
66
|
+
for "order_0000000000e008000000000000"
|
|
67
|
+
then OrderPlaced
|
|
68
|
+
for "order_0000000000e008000000000000"
|
|
69
|
+
then returns "order_0000000000e008000000000000"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Each property is server-owned, not a client-minted input. The ApiKey declaration
|
|
73
|
+
is not permission to replace its secret contract with an ordinary random String.
|
|
74
|
+
No `given clock` is used: pin the whole value. A seed/clock does not draw a
|
|
75
|
+
portable ULID or TypeID fixture. A v15 duplicate-source specification should
|
|
76
|
+
expect Concurrency with no new facts or response, not a regenerated ID.
|
|
77
|
+
|
|
78
|
+
## When not to generate
|
|
79
|
+
|
|
80
|
+
Client-minted customer/order IDs remain inputs. Fresh random values are not
|
|
81
|
+
idempotency keys, authorization, gapless invoice numbers or proof of projection
|
|
82
|
+
readiness. A reference InviteCode is not automatically a credential; if possession
|
|
83
|
+
confers access, protect it as a secret and do not claim this generated String
|
|
84
|
+
example realizes that credential behavior. Never drop ApiKey's secret marker to
|
|
85
|
+
make its generation bind/render. Pattern/random/rule execution, context rules,
|
|
86
|
+
sequence allocation and secret generation stay explicit upstream gaps.
|
|
87
|
+
|
|
88
|
+
## Tagged evidence
|
|
89
|
+
|
|
90
|
+
Screenplay `v4.151.0:Documentation/screenplay/generated-values/choosing.md:8-51`,
|
|
91
|
+
`Documentation/screenplay/generated-values.md:60-72`,
|
|
92
|
+
`Documentation/screenplay/concepts.md:60-86` (header secret classification),
|
|
93
|
+
`Source/DotNET/Screenplay/Semantics/SemanticModelBinder.Generation.cs:14-80`.
|
|
94
|
+
Stage `v4.89.1:Documentation/reference/generated-values-rendering.md:62-83,138-146`.
|
|
95
|
+
Arc `v22.87.1:Documentation/backend/csharp/generating-a-screenplay.md:260-284`.
|
|
96
|
+
Sources for the released .NET context/secret helpers are in the linked shop reference.
|
|
@@ -44,8 +44,8 @@ at the versions named in each row (CLI 3.53.1 bundles Prologue
|
|
|
44
44
|
| --- | --- |
|
|
45
45
|
| `generate` options, no default-file certainty (stdout when `--file` is absent), spec-project exclusion by name, `CLI0005/0009/0014-0017` | cli `v3.28.2:Source/Cli/Commands/Screenplay/{GenerateScreenplayCommand,GenerateScreenplaySettings,ScreenplayProjectSelection,ScreenplayDiagnosticCodes}.cs` |
|
|
46
46
|
| `SP0016` (rule in code, computed message, `When`/`Unless` written as unconditional), `SP0024` (source did not compile) | Arc `v22.50.5:Source/DotNET/Screenplay/ScreenplayDiagnosticCodes.cs`, `Documentation/backend/csharp/generating-a-screenplay.md` |
|
|
47
|
-
|
|
|
48
|
-
|
|
|
47
|
+
| Generated strategies/parameters/pins and loss inventory | Arc 22.87.1: [tagged sources and adapter gate](references/generated-recovery.md) |
|
|
48
|
+
| Enum/response recovery (22.76.0); compliance/self-check (22.70.0) | Arc: [tagged sources and limits](references/generate-notes.md) |
|
|
49
49
|
| `prologue start` is an interactive wizard that writes `cratis-prologue.json`; `interpret --no-llm` never creates a chat client; a local `llm.enabled` setting wins over the global CLI configuration; the provider is announced before evidence is sent (cli#241, closed) | cli `v3.53.1:Source/Cli/Commands/Prologue/{StartPrologueCommand,InterpretPrologueSettings,InterpretPrologueCommand,LlmOptionsResolver}.cs`, `Documentation/reference/prologue.md` |
|
|
50
50
|
| `generate` and `conform` evaluate the project with MSBuild (design-time build; may run project targets and write `obj/`); `conform` exit 0/1/2, structural only | cli `v3.53.1:Documentation/reference/screenplay.md`, `Source/Cli/Commands/Screenplay/ConformScreenplayCommand.cs` |
|
|
51
51
|
| Extractor effects (CDC enable, publication and replication slot), POST/PUT/DELETE only, 2 s correlation window, interpret payload (uncapped model outline and names, observed lists capped at 50, schema tables capped per schema observation), existing slot/publication reused; cleanup missing (Prologue#37) | Prologue `v2.0.0:Source/Extractor/Sources/**`, `Source/Configuration/*`, `Source/Interpretation/EvidenceFormatter.cs` |
|
|
@@ -54,6 +54,15 @@ at the versions named in each row (CLI 3.53.1 bundles Prologue
|
|
|
54
54
|
|
|
55
55
|
Every complete `screenplay` fence here compiles with the standalone compiler 4.139.0 (`--warnaserror`).
|
|
56
56
|
|
|
57
|
+
## Choosing a strategy
|
|
58
|
+
|
|
59
|
+
Read [shop recovery and version gates](references/generated-recovery.md) before
|
|
60
|
+
inferring generation from code.
|
|
61
|
+
|
|
62
|
+
## When not to
|
|
63
|
+
|
|
64
|
+
That reference preserves input/protection ownership and unshipped context/secret contracts.
|
|
65
|
+
|
|
57
66
|
## Interview phase
|
|
58
67
|
**Skip if** the brief already records the freeze or "not applicable", the observable
|
|
59
68
|
environments, the evidence-disclosure policy and the domain experts. Otherwise ask only what is
|
package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/generate-notes.md
CHANGED
|
@@ -109,10 +109,11 @@ The expanded Arc recovery surface includes:
|
|
|
109
109
|
- Event scenarios as `when append`, and event-source-faithful `for` fixtures.
|
|
110
110
|
Scenarios whose sources cannot be stated faithfully are omitted with SP0039;
|
|
111
111
|
record the omission as a loss, never fabricate identities to retain a scenario.
|
|
112
|
-
- Supported generated
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
- Supported generated values and scalar/record responses by default, without
|
|
113
|
+
the authoring-only flag. The older bundled adapter retains legacy representation
|
|
114
|
+
for commands with successful scenarios. Arc 22.87.1 recovers generated Handle
|
|
115
|
+
parameters with concrete pins, but local `New()` values still have no pin seam;
|
|
116
|
+
[recovery forms, version gate and loss inventory](generated-recovery.md).
|
|
116
117
|
Unsupported shapes/pre-generation protection remain code with SP0052.
|
|
117
118
|
|
|
118
119
|
Generated values/responses select ESM v7. The historical CLI 3.41.0 check
|
package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/generated-recovery.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
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
|
+
# Generated-value recovery: adapter version matters
|
|
5
|
+
|
|
6
|
+
## Contents
|
|
7
|
+
|
|
8
|
+
- Version gate and sources
|
|
9
|
+
- Choosing a strategy
|
|
10
|
+
- When not to
|
|
11
|
+
- Recover what is proven
|
|
12
|
+
- Pins are not local generation
|
|
13
|
+
- Incomplete recovery is a loss report
|
|
14
|
+
|
|
15
|
+
## Version gate and sources
|
|
16
|
+
|
|
17
|
+
These forms are source-checked at **Arc 22.87.1**, not promised for the CLI's
|
|
18
|
+
adapter. **CLI 3.57.0 bundles an older Arc.Screenplay adapter** (see the toolchain [versions](../../cratis-screenplay-toolchain/references/versions.md)) even though its Screenplay
|
|
19
|
+
4.147.1 and Stage 4.89.1 admit v15 strategies. A standalone compiler upgrade
|
|
20
|
+
cannot add recovery to that adapter. Check the resolved generator before using
|
|
21
|
+
this guidance; do not bump managed product pins to hide the difference.
|
|
22
|
+
|
|
23
|
+
Tagged evidence:
|
|
24
|
+
|
|
25
|
+
- Arc `v22.87.1:Documentation/backend/csharp/generating-a-screenplay.md:244-290`.
|
|
26
|
+
- Arc `v22.87.1:Source/DotNET/Screenplay/Analysis/Commands/GenerationStrategyReader.cs:23-55,64-96,103-133`;
|
|
27
|
+
`GenerationCallReader.cs:16-38,69-92,100-150`;
|
|
28
|
+
`GeneratedParameterReader.cs:138-150`.
|
|
29
|
+
- Arc `v22.87.1:Source/DotNET/Screenplay/Analysis/Specifications/GeneratedValuePins.cs:138-175`.
|
|
30
|
+
- cli `v3.57.0:Directory.Packages.props:5-14`.
|
|
31
|
+
|
|
32
|
+
## Choosing a strategy
|
|
33
|
+
|
|
34
|
+
Use the [same shop vocabulary](../../cratis-screenplay-command-surface/references/shop-generation.md):
|
|
35
|
+
CustomerId (`cus_` + ULID), OrderId (TypeID), InviteCode (NanoID), ApiKey (secret
|
|
36
|
+
Bytes(32) with .NET `[NotAudited]`). Do not claim exact recovery of every factory:
|
|
37
|
+
the custom `cus_` interpolation is not a recognized single factory call;
|
|
38
|
+
TypeID can recover a passed-through context's strategy, not equivalent receipt-time/
|
|
39
|
+
tenant behavior. Context-member bodies and generated secrets remain unreleased
|
|
40
|
+
Screenplay scope. Preserve ApiKey's protection and source code, not an unprotected
|
|
41
|
+
replacement String. The intentional candidate can author the released customer
|
|
42
|
+
prefix strategy with an explicit target decision, separate from as-is proof.
|
|
43
|
+
|
|
44
|
+
Recover the strategy the source proves; do not choose a replacement because a
|
|
45
|
+
factory is named `New()`. Use the existing [strategy reference](../../cratis-screenplay-command-surface/references/generated-values-and-responses.md)
|
|
46
|
+
for meaning and shapes, then the forms below for parameter factories, literal pins
|
|
47
|
+
and retained source pointers.
|
|
48
|
+
|
|
49
|
+
## When not to
|
|
50
|
+
|
|
51
|
+
Do not infer generation for client-supplied IDs, deduplication keys or gapless
|
|
52
|
+
invoice numbers, or turn an observed secret into a random String. Preserve
|
|
53
|
+
protection and unrecovered code; rule/context-member bodies are not executable
|
|
54
|
+
strategies. Report missing pins, withheld productions/scenarios and version caps
|
|
55
|
+
as losses, not successful recovery. Sources: Arc
|
|
56
|
+
`v22.87.1:Documentation/backend/csharp/generating-a-screenplay.md:244-290`;
|
|
57
|
+
Screenplay `v4.151.0:Documentation/screenplay/generated-values/choosing.md:8-29`.
|
|
58
|
+
|
|
59
|
+
## Recover what is proven
|
|
60
|
+
|
|
61
|
+
A `[GeneratedValue]` Handle parameter becomes a generated command property only
|
|
62
|
+
for a required scalar Uuid/String concept with a proven strategy and no validator,
|
|
63
|
+
validation rules or compliance markers. Its explicit attribute name, otherwise
|
|
64
|
+
parameter name, becomes the property name. A directly returned event-source
|
|
65
|
+
identity (alone or beside an event) adds `generated identifier` and a response;
|
|
66
|
+
a direct `EventForEventSourceId(parameter, event)` target adds the identifier
|
|
67
|
+
without inventing a response. Aggregate handlers do not prove that destination.
|
|
68
|
+
Reassignment, by-reference use and property-name collisions prevent recovery.
|
|
69
|
+
|
|
70
|
+
Read `IGeneratable<T>.New()` or `IGeneratableInContext<T>.New(context)`, including
|
|
71
|
+
explicit implementations. The body must be one expression or a single return:
|
|
72
|
+
`new(<call>)`, `new Concept(<call>)`, or a proven unchanged implicit conversion.
|
|
73
|
+
Constructors/conversions must forward the primitive unchanged. Recoverable calls:
|
|
74
|
+
|
|
75
|
+
- `Guid.NewGuid()` / `GenerateValue.Uuid()` → implicit UUID v4, no strategy line.
|
|
76
|
+
- `Guid.CreateVersion7()` / `GenerateValue.UuidV7()` → UUIDv7.
|
|
77
|
+
- `GenerateValue.Ulid()`, `TypeId(...)`, `NanoId(...)`, `Bytes(...)` → the respective
|
|
78
|
+
concept strategy, with literal arguments and encoding enum members.
|
|
79
|
+
- `RandomNumberGenerator.GetHexString(...)` → hex bytes only with an even literal
|
|
80
|
+
character count; preserve its requested casing.
|
|
81
|
+
|
|
82
|
+
A passed-through `GenerationContext` parameter is readable for UUIDv7/ULID/TypeID;
|
|
83
|
+
reading `context.Now` or `context.Tenant` is not. Helper calls, multi-statement
|
|
84
|
+
bodies, computed/invalid arguments and rule/pattern/random execution stay in code
|
|
85
|
+
with SP0073. Never invent a rule body or implementation-file reference.
|
|
86
|
+
The concept owns `generate`; each command property only marks generation.
|
|
87
|
+
Use the shared [strategy reference](../../cratis-screenplay-command-surface/references/generated-values-and-responses.md)
|
|
88
|
+
for exact encodings, ranges, entropy and admission, rather than duplicating them.
|
|
89
|
+
|
|
90
|
+
## Pins are not local generation
|
|
91
|
+
|
|
92
|
+
Successful parameter-generation scenarios need a concrete pin for every generated
|
|
93
|
+
value: `for` beneath `when` for its identifier; `generated <name> = <value>` for
|
|
94
|
+
others. Direct concept constructions and one-hop stable held fields are readable.
|
|
95
|
+
UUIDs normalize to lowercase D format; text retains exact size, encoding, case
|
|
96
|
+
and unused trailing bits. Generic pins must target the issued command.
|
|
97
|
+
Missing/unreadable, nested-command, conditional/repeated, mismatched, `New()` pins
|
|
98
|
+
or `AllowGeneration()` omit the scenario with located SP0039, retaining an
|
|
99
|
+
otherwise admitted command generation contract. Denial/validation precede generation
|
|
100
|
+
and need no generation pin.
|
|
101
|
+
|
|
102
|
+
Legacy values created inside `Handle()` by `Guid.NewGuid()` or a proven `New()`
|
|
103
|
+
have no pinning seam. Successful scenarios retain legacy productions or handler
|
|
104
|
+
references without generated values/responses, with SP0052; explicit given sources
|
|
105
|
+
also preserve this fallback. Do not rewrite source code or fake a successful pin
|
|
106
|
+
to make recovery look complete. Recovery of responses has its own proof limits
|
|
107
|
+
in [generate notes](generate-notes.md#arc-22760-enum-and-response-recovery).
|
|
108
|
+
|
|
109
|
+
## Incomplete recovery is a loss report
|
|
110
|
+
|
|
111
|
+
Record each affected command/concept/scenario with its exact source locator,
|
|
112
|
+
resolved adapter version, diagnostic, retained/withheld form and open question:
|
|
113
|
+
|
|
114
|
+
| Diagnostic | Loss to reconcile |
|
|
115
|
+
| --- | --- |
|
|
116
|
+
| SP0073 | Unproven strategy/body/arguments, or non-default strategy above the ESM cap; no replacement strategy inferred. |
|
|
117
|
+
| SP0052 | Unadmitted generated value, dependent response or pre-generation protection stays in code; local-generation fallback is not parameter recovery. |
|
|
118
|
+
| SP0012 | A required payload mapping or condition needs an unavailable value/read: withhold the whole production, never prune it into an incomplete fact. An optional blocked mapping can be omitted alone. |
|
|
119
|
+
| SP0039 | Missing/unreadable pins, unrecoverable source identities or outcomes withhold the whole scenario. Name what was lost. |
|
|
120
|
+
| SP0013 | Tuple destination not proven; never guess its event source. |
|
|
121
|
+
| SP0054 | No retained production means its route is withheld; keep the handler pointer instead of declaring no behavior. |
|
|
122
|
+
|
|
123
|
+
`MaximumExecutableModelVersion` below v15 withholds non-default concept generation
|
|
124
|
+
with SP0073 and dependent values/responses/mappings with SP0052; pins against them
|
|
125
|
+
withhold scenarios with SP0039. Below v7 responses/return expectations are withheld.
|
|
126
|
+
A cap describes less behavior, not an equivalent implementation. Handler references
|
|
127
|
+
compile but refuse executable binding (PLAY0268); record that verdict separately.
|
|
128
|
+
Never remove protection, required payloads or loss rows to obtain a green result.
|
|
@@ -23,15 +23,13 @@ same model root or workspace export to all checks. Workflow:
|
|
|
23
23
|
|
|
24
24
|
## Verified product sources
|
|
25
25
|
|
|
26
|
-
Screenplay v4.144.0:
|
|
27
|
-
v4.142.0
|
|
28
|
-
|
|
29
|
-
[
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Historical probes remain 4.66.0; registration example compilation/execution
|
|
34
|
-
remains 4.68.0. Attribution: `references/provenance.md`.
|
|
26
|
+
Screenplay v4.144.0: notes (`references/model-notes.md`); property planner
|
|
27
|
+
v4.142.0 (`references/property-links.md`); compliance (command-surface
|
|
28
|
+
`references/compliance.md`); generation MCP v4.149.0
|
|
29
|
+
([sources](references/mcp-tools.md#concept-generation-41490)); other MCP v4.139.0
|
|
30
|
+
`Documentation/screenplay/mcp/`. Discover installed schemas; bundles differ.
|
|
31
|
+
Pins: toolchain `references/versions.md`. Historical probes 4.66.0; registration
|
|
32
|
+
compilation/execution 4.68.0. Attribution: `references/provenance.md`.
|
|
35
33
|
|
|
36
34
|
Record open modeling questions as `question` notes in committed
|
|
37
35
|
`.screenplay/notes.json`, not chat or `description` text. Never put secrets or
|
|
@@ -39,6 +37,15 @@ personal data in notes. Read [model notes](references/model-notes.md) when
|
|
|
39
37
|
listing, recording or resolving questions: `list-model-notes`,
|
|
40
38
|
`propose-model-notes`, `read-proposal view=notes`, refs and orphan review.
|
|
41
39
|
|
|
40
|
+
## Choosing a strategy
|
|
41
|
+
|
|
42
|
+
Read [shop strategies and entropy](references/choosing-generation.md) before
|
|
43
|
+
editing concept generation or `generated identifier`.
|
|
44
|
+
|
|
45
|
+
## When not to
|
|
46
|
+
|
|
47
|
+
The same reference separates inputs, credentials and unreleased context/secret generation.
|
|
48
|
+
|
|
42
49
|
## Locate and connect
|
|
43
50
|
|
|
44
51
|
Use the declared `screenplay` MCP server (for example `open-workspace`).
|
|
@@ -92,8 +99,7 @@ can keep that entry point; use the project's supported installation channel.
|
|
|
92
99
|
Before a property change, read [property links](references/property-links.md):
|
|
93
100
|
`kind: "Property"`, `Owner.member` / `Owner.generationN.member`, direct mappings.
|
|
94
101
|
`complete: false` is incomplete evidence, never a successful empty list.
|
|
95
|
-
|
|
96
|
-
Edit through MCP proposals, not hand-edited text; [generation guide](references/mcp-tools.md#concept-generation-41490).
|
|
102
|
+
Edit through MCP proposals, not hand-edited text; [generation](references/mcp-tools.md#concept-generation-41490).
|
|
97
103
|
3. Read diagnostics and coverage limitations. Use `dependency-graph` for container
|
|
98
104
|
edges, declared-dependency coverage, cycles and advisory order; the board's
|
|
99
105
|
dependency-map toggle exposes this evidence visually. Unknown or ambiguous
|
|
@@ -199,9 +205,7 @@ from silently changing the reviewed candidate.
|
|
|
199
205
|
No automatic generation-evolution repair ships.
|
|
200
206
|
- `PLAY0479`: migrate optionality spelling with `PreserveTrivia`; document scope
|
|
201
207
|
migrates all occurrences together. Keep the `query Q => observable?` exception.
|
|
202
|
-
- PLAY0683/
|
|
203
|
-
(command-property subject). Individual review, canonical formatting, no pinned
|
|
204
|
-
evidence; [limits](references/mcp-tools.md#concept-generation-41490).
|
|
208
|
+
- Generation repairs PLAY0683/0684: [subjects, review and limits](references/mcp-tools.md#concept-generation-41490).
|
|
205
209
|
- Compliance repairs PLAY0565/0653: [MCP tool guide](references/mcp-tools.md).
|
|
206
210
|
|
|
207
211
|
`propose-number-enum-members` pins an unnumbered enum to current positions.
|
package/package/corpus/skills/cratis-screenplay-model-authoring/references/choosing-generation.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
# Shop generation choices
|
|
5
|
+
|
|
6
|
+
## Choosing a strategy
|
|
7
|
+
|
|
8
|
+
Follow the [threaded shop model](../../cratis-screenplay-command-surface/references/shop-generation.md):
|
|
9
|
+
CustomerId (`cus_` + ULID), OrderId (TypeID) and InviteCode (NanoID) are released
|
|
10
|
+
strategies. ApiKey stays secret without executable generation. Neither the
|
|
11
|
+
OrderId's Arc received-time/tenant context nor ApiKey's .NET Bytes(32) secret
|
|
12
|
+
factory can be promised as Screenplay generation today.
|
|
13
|
+
|
|
14
|
+
For a server-owned new value, choose implicit UUID for an ordinary identity,
|
|
15
|
+
UUIDv7 for time-ordered UUIDs, ULID for compact time-ordered text, TypeID for
|
|
16
|
+
recognizable typed text, NanoID for opaque text, or bytes for an exact random-bit
|
|
17
|
+
budget. Inspect entropy separately from executable admission; prefixes add no
|
|
18
|
+
random bits and identifiers need at least 64. Time-ordered is not strict
|
|
19
|
+
millisecond ordering. Use the existing [strategy and MCP reference](../../cratis-screenplay-command-surface/references/generated-values-and-responses.md),
|
|
20
|
+
not a per-property strategy: the concept owns `generate`, the command property
|
|
21
|
+
says `generated identifier` or `generated`.
|
|
22
|
+
|
|
23
|
+
## When not to
|
|
24
|
+
|
|
25
|
+
Do not replace client-minted inputs, authorization, idempotency keys or a gapless
|
|
26
|
+
invoice allocator with generation. Secret generation, pattern/random/rule execution
|
|
27
|
+
and generated-concept rule consistency are not released capabilities. Preserve
|
|
28
|
+
refused rules instead of deleting them or inventing a repair.
|
|
29
|
+
Source: Screenplay `v4.151.0:Documentation/screenplay/generated-values/choosing.md:6-29,49-51`;
|
|
30
|
+
`Documentation/screenplay/generated-values.md:70-72`.
|
|
@@ -180,10 +180,18 @@ the one-rejection rule (`PLAY0273`) are reported only when the model binds, so
|
|
|
180
180
|
A command with an authorization gate, a validation rule and a uniqueness constraint, specified in full with inline events, optional-aware queries and read-model assertions.
|
|
181
181
|
Read [references/worked-example.md](references/worked-example.md) when writing or checking a complete command, view or constraint specification and you need the full compiled model to copy the shape from.
|
|
182
182
|
|
|
183
|
+
## Choosing a strategy
|
|
184
|
+
|
|
185
|
+
Read [shop fixtures and strategy choices](references/generated-fixtures.md).
|
|
186
|
+
|
|
187
|
+
## When not to
|
|
188
|
+
|
|
189
|
+
Pins/clock do not realize unreleased context or secret generation; preserve the contract.
|
|
190
|
+
|
|
183
191
|
## Generated fixtures and return expectations (ESM v7)
|
|
184
192
|
|
|
185
|
-
Current
|
|
186
|
-
|
|
193
|
+
Current compilers bind fixtures/returns. Reached generation without every pin is
|
|
194
|
+
unsupported, never passed. The fixture reference covers strict v15 shapes and freshness.
|
|
187
195
|
|
|
188
196
|
## Actions beyond commands
|
|
189
197
|
|
package/package/corpus/skills/cratis-screenplay-specifications/references/generated-fixtures.md
CHANGED
|
@@ -1,22 +1,48 @@
|
|
|
1
1
|
## Generated fixtures and return expectations (ESM v7 and v15)
|
|
2
2
|
|
|
3
|
+
### Choosing a strategy
|
|
4
|
+
|
|
5
|
+
Use the [shop example](../../cratis-screenplay-command-surface/references/shop-generation.md):
|
|
6
|
+
pin CustomerId (`cus_` + ULID), OrderId (TypeID) and InviteCode (NanoID) as
|
|
7
|
+
whole values. ApiKey stays secret with no executable generation; do not write a
|
|
8
|
+
passing issuance spec that invents its .NET Bytes(32) factory in Screenplay.
|
|
9
|
+
OrderId pins do not realize Arc's received-time/tenant context either.
|
|
10
|
+
|
|
11
|
+
Choose the concept's strategy for the job, then pin a whole value matching it:
|
|
12
|
+
`for` for its generated identifier, named `generated` fixtures for other values.
|
|
13
|
+
Use the shared [strategy reference](../../cratis-screenplay-command-surface/references/generated-values-and-responses.md)
|
|
14
|
+
for UUID, time-ordered, typed/opaque text and byte-budget choices and exact shapes.
|
|
15
|
+
`given clock` supplies `$context.occurred`, not a generated time-ordered ID;
|
|
16
|
+
a seed is not a portable fixture.
|
|
17
|
+
|
|
18
|
+
### When not to
|
|
19
|
+
|
|
20
|
+
Pins do not prove randomness, authorization, idempotency, storage freshness or
|
|
21
|
+
secret safety. Client-minted IDs stay inputs; gapless invoice numbering needs an
|
|
22
|
+
allocator, not a random fixture. Pattern/random/rule and secret generation remain
|
|
23
|
+
unadmitted. Source: Screenplay
|
|
24
|
+
`v4.151.0:Documentation/screenplay/generated-values/choosing.md:8-29,49-51`.
|
|
25
|
+
|
|
26
|
+
### Fixtures and outcomes
|
|
27
|
+
|
|
3
28
|
Standalone `screenplay` 4.68.0 or later binds and runs these, and so does the current cratis bundle (the
|
|
4
29
|
cratis 3.28.3 bundle, 4.66.0, did not); CLI 3.57.0 / Stage 4.89.1 render supported UUID/String generation strategies,
|
|
5
30
|
scalar/named responses, fixtures and `then returns`. Unsupported types/result combinations
|
|
6
31
|
remain `STAGE-ESM-028`/`-038`; preserve refused specifications as gap-fill contracts. The model and rules are in `cratis-screenplay-command-surface`; the
|
|
7
|
-
complete
|
|
32
|
+
complete threaded model is the linked shop example. The excerpt below belongs
|
|
33
|
+
to its RegisterCustomer command and uses the same concept declarations.
|
|
8
34
|
|
|
9
35
|
```screenplay excerpt
|
|
10
|
-
specification
|
|
11
|
-
when
|
|
12
|
-
for "
|
|
13
|
-
generated
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
name = "Apollo"
|
|
36
|
+
specification RegistersWithPinnedValues
|
|
37
|
+
when RegisterCustomer
|
|
38
|
+
for "cus_01ARZ3NDEKTSV4RRFFQ69G5FAV"
|
|
39
|
+
generated inviteCode = "abcdefghijklmnopqrstu"
|
|
40
|
+
then CustomerRegistered
|
|
41
|
+
for "cus_01ARZ3NDEKTSV4RRFFQ69G5FAV"
|
|
42
|
+
inviteCode = "abcdefghijklmnopqrstu"
|
|
18
43
|
then returns
|
|
19
|
-
|
|
44
|
+
customerId = "cus_01ARZ3NDEKTSV4RRFFQ69G5FAV"
|
|
45
|
+
inviteCode = "abcdefghijklmnopqrstu"
|
|
20
46
|
```
|
|
21
47
|
|
|
22
48
|
- `for` beneath `when` supplies the generated identifier and an indented `generated <name> = <value>` supplies any other
|
|
@@ -43,5 +69,11 @@ specification RegisteringReturnsIdentifiers
|
|
|
43
69
|
rejects the entire command with Concurrency, without append, response or silent retry. Below v15
|
|
44
70
|
fixtures retain legacy reuse. See the complete [strategy example](../../cratis-screenplay-toolchain/references/generation-strategies-example.md)
|
|
45
71
|
and command-surface `references/generated-values-and-responses.md` for tagged sources.
|
|
72
|
+
- `given clock` supplies `$context.occurred`; it does not synthesize UUIDv7, ULID or
|
|
73
|
+
TypeID from that instant. Pin the whole identifier, never a seed. Stage 4.89.1's
|
|
74
|
+
time-ordered factories use wall clock, not command-receipt time, and its clock
|
|
75
|
+
specifications remain unsupported. Sources: Screenplay
|
|
76
|
+
`v4.151.0:Documentation/screenplay/generated-values/choosing.md:51`; Stage
|
|
77
|
+
`v4.89.1:Documentation/reference/generated-values-rendering.md:138`.
|
|
46
78
|
- A reaction-invoked command that reaches generation is `Unsupported(IdentityAllocation)` (no fixture channel); a
|
|
47
79
|
response-only command runs and its response is discarded.
|
|
@@ -46,12 +46,11 @@ were read at Stage `v4.73.1` (`Source/Rendering.Cratis/**`, `Documentation/guide
|
|
|
46
46
|
(`Documentation/reference/screenplay.md`, `Source/Cli/Commands/Render/**`), not by a render run
|
|
47
47
|
unless a line says *observed*. Current CLI 3.57.0 bundle/admission and scaffold pins were re-read at the tagged
|
|
48
48
|
sources in `references/admission.md` and `references/rendered-application.md`.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
([rendered application](references/rendered-application.md)).
|
|
49
|
+
The bundled binder trails standalone (toolchain `references/versions.md`).
|
|
50
|
+
Stage's scaffold pins Arc, Chronicle, Components, Scene and Fundamentals
|
|
51
|
+
([rendered application](references/rendered-application.md)), not latest releases; never bump managed files.
|
|
52
|
+
Scene was re-read at that scaffold tag: `README.md`,
|
|
53
|
+
`Source/JavaScript/{model,engine,react,components}/**`.
|
|
55
54
|
|
|
56
55
|
Historical executed baselines (history, not current claims): Stage `v4.24.2` and cli
|
|
57
56
|
`v3.28.2`/`v3.28.3` (Cratis/cli#253; the example in [render-example.md](references/render-example.md)),
|
|
@@ -184,6 +183,14 @@ admission (ESM v1 to v4, keyed optional queries only) is kept as history in `ref
|
|
|
184
183
|
only in prose is not enforced. A documentation edit changes managed-file hashes (a `--check` exit
|
|
185
184
|
`6`), and characters invalid in XML block rendering with `CLI-RENDER-005`.
|
|
186
185
|
|
|
186
|
+
## Choosing a strategy
|
|
187
|
+
|
|
188
|
+
Read [shop strategy choices](references/choosing-generation.md) before rendering.
|
|
189
|
+
|
|
190
|
+
## When not to
|
|
191
|
+
|
|
192
|
+
That reference separates v15 scopes from future Arc freshness and unshipped context/secrets.
|
|
193
|
+
|
|
187
194
|
## What it emits
|
|
188
195
|
|
|
189
196
|
At application scope the plan holds the scaffold plus the modeled artifacts, for the
|
package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/choosing-generation.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
# Shop generation choices
|
|
5
|
+
|
|
6
|
+
## Choosing a strategy
|
|
7
|
+
|
|
8
|
+
Render only the released part of the [shared shop model](../../cratis-screenplay-command-surface/references/shop-generation.md):
|
|
9
|
+
CustomerId (`cus_` + ULID), TypeID OrderId and NanoID InviteCode. ApiKey remains
|
|
10
|
+
secret with no generated property; do not turn .NET Bytes(32) credential generation
|
|
11
|
+
into a promise of Stage secret generation. The Arc context-aware OrderId is not
|
|
12
|
+
Stage's wall-clock TypeID factory or tenant isolation.
|
|
13
|
+
|
|
14
|
+
Select the strategy on the model's concept, not in managed C#: implicit UUID for
|
|
15
|
+
ordinary identity, UUIDv7/ULID for time-ordered values, TypeID for typed text,
|
|
16
|
+
NanoID for opaque text or bytes for an exact entropy budget. Read the shared
|
|
17
|
+
[strategy, fixture and renderer reference](../../cratis-screenplay-command-surface/references/generated-values-and-responses.md)
|
|
18
|
+
for exact shapes and refusals. Time-ordered factories use wall clock, not
|
|
19
|
+
receipt-time `GenerationContext`; neither strict millisecond order nor `given clock`
|
|
20
|
+
ID synthesis is promised.
|
|
21
|
+
|
|
22
|
+
## When not to
|
|
23
|
+
|
|
24
|
+
Do not generate client-owned inputs, idempotency keys, gapless invoice numbers or
|
|
25
|
+
secrets. Generation is not authorization, projection readiness or external-effect
|
|
26
|
+
success. Pattern/random/rule execution, sequences and clock specs remain unsupported.
|
|
27
|
+
At v15, Stage 4.89.1 emits explicit whole-source concurrency scopes; below v15 it
|
|
28
|
+
keeps unguarded handlers. This is not delivery of Arc#3129's future freshness API.
|
|
29
|
+
Sources: Stage `v4.89.1:Documentation/reference/generated-values-rendering.md:62-83,138-146`;
|
|
30
|
+
Screenplay `v4.151.0:Documentation/screenplay/generated-values/choosing.md:8-29`.
|