@cratis/pi 7.50.0 → 7.51.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/copilot/instructions/authoring-skills.instructions.md +93 -0
- package/package/corpus/harnesses/copilot/instructions/profiles.instructions.md +4 -0
- package/package/corpus/prompts/review-skill.prompt.md +6 -8
- package/package/corpus/rules/authoring-skills.md +92 -0
- package/package/corpus/rules/general.md +1 -0
- package/package/corpus/rules/profiles.md +4 -0
- package/package/corpus/skills/cratis-application-react-specifications/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/SKILL.md +23 -29
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authentication.md +7 -7
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authorization.md +34 -32
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authproxy.md +1 -1
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/frontend.md +2 -2
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/local-development.md +3 -3
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/observable-emission-guards.md +8 -6
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/tenancy.md +3 -3
- package/package/corpus/skills/cratis-arc-command/SKILL.md +23 -25
- package/package/corpus/skills/cratis-arc-command/references/command-result.md +1 -1
- package/package/corpus/skills/cratis-arc-command/references/decisions-and-routing.md +9 -9
- package/package/corpus/skills/cratis-arc-command/references/generated-values.md +11 -12
- package/package/corpus/skills/cratis-arc-command/references/handler-shapes.md +4 -4
- package/package/corpus/skills/cratis-arc-command/references/proxy-generation.md +3 -3
- package/package/corpus/skills/cratis-arc-command/references/read-model-injection.md +1 -3
- package/package/corpus/skills/cratis-arc-command/references/shop-generation.md +11 -14
- package/package/corpus/skills/cratis-arc-command-execution/LICENSE +6 -0
- package/package/corpus/skills/cratis-arc-command-execution/SKILL.md +17 -19
- package/package/corpus/skills/cratis-arc-command-kotlin/SKILL.md +8 -7
- package/package/corpus/skills/cratis-arc-command-kotlin/references/read-model-naming.md +2 -2
- package/package/corpus/skills/cratis-arc-command-operation/SKILL.md +14 -15
- package/package/corpus/skills/cratis-arc-command-operation/references/execution-and-recovery.md +2 -2
- package/package/corpus/skills/cratis-arc-command-operation/references/testing.md +7 -8
- package/package/corpus/skills/cratis-arc-command-typescript/SKILL.md +14 -11
- package/package/corpus/skills/cratis-arc-command-typescript/references/chronicle-events.md +7 -7
- package/package/corpus/skills/cratis-arc-command-typescript/references/command-operations.md +4 -4
- package/package/corpus/skills/cratis-arc-command-typescript/references/hosting-and-storage.md +11 -7
- package/package/corpus/skills/cratis-arc-command-typescript/references/identity-and-introspection.md +4 -2
- package/package/corpus/skills/cratis-arc-command-typescript/references/observability-and-host-scopes.md +2 -2
- package/package/corpus/skills/cratis-arc-command-typescript/references/proxy-generation.md +3 -3
- package/package/corpus/skills/cratis-arc-command-typescript/references/slice-layout.md +1 -1
- package/package/corpus/skills/cratis-arc-command-typescript/verification.json +2 -2
- package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +10 -14
- package/package/corpus/skills/cratis-arc-ef-core-migration/LICENSE +6 -0
- package/package/corpus/skills/cratis-arc-ef-core-migration/SKILL.md +9 -10
- package/package/corpus/skills/cratis-arc-go/SKILL.md +14 -15
- package/package/corpus/skills/cratis-arc-go/references/queries.md +2 -2
- package/package/corpus/skills/cratis-arc-hosting/SKILL.md +8 -8
- package/package/corpus/skills/cratis-arc-hosting/references/integrations-and-publish.md +11 -11
- package/package/corpus/skills/cratis-arc-identity-and-tenancy-kotlin/SKILL.md +3 -3
- package/package/corpus/skills/cratis-arc-observable-query-http/SKILL.md +13 -13
- package/package/corpus/skills/cratis-arc-observable-query-http/verification.json +1 -1
- package/package/corpus/skills/cratis-arc-query-kotlin/SKILL.md +2 -3
- package/package/corpus/skills/cratis-arc-query-paging/SKILL.md +11 -14
- package/package/corpus/skills/cratis-arc-query-typescript/SKILL.md +3 -3
- package/package/corpus/skills/cratis-arc-query-typescript/references/storage-observation-and-compliance.md +2 -2
- package/package/corpus/skills/cratis-arc-spring-data-kotlin/SKILL.md +3 -3
- package/package/corpus/skills/cratis-arc-testing-kotlin/SKILL.md +3 -3
- package/package/corpus/skills/cratis-arc-validation-kotlin/SKILL.md +1 -2
- package/package/corpus/skills/cratis-arc-validation-typescript/SKILL.md +4 -4
- package/package/corpus/skills/cratis-chronicle-cli-operations/SKILL.md +19 -22
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/command-effects.md +10 -10
- package/package/corpus/skills/cratis-chronicle-client-dotnet/SKILL.md +36 -36
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/additional-surfaces.md +4 -2
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/client-construction.md +1 -1
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/compatibility-check.md +13 -13
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/discovery.md +10 -10
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/hosting.md +10 -10
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/pinned-generation-delivery.md +7 -5
- package/package/corpus/skills/cratis-chronicle-client-elixir/SKILL.md +59 -64
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/append-api.md +17 -17
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/compliance.md +5 -3
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/connections.md +15 -11
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/event-sources.md +3 -1
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/pitfalls.md +4 -4
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/projections.md +8 -4
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/upgrading.md +19 -19
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/variants.md +3 -8
- package/package/corpus/skills/cratis-chronicle-client-elixir/verification.json +2 -2
- package/package/corpus/skills/cratis-chronicle-client-go/SKILL.md +16 -18
- package/package/corpus/skills/cratis-chronicle-client-go/references/projections.md +2 -2
- package/package/corpus/skills/cratis-chronicle-client-kotlin/SKILL.md +61 -58
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/connection-lifecycle.md +9 -10
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/discovery-and-registration.md +6 -6
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/event-sources.md +4 -2
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/java-api.md +4 -4
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/options.md +1 -1
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/spring-boot.md +24 -24
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/variants.md +6 -5
- package/package/corpus/skills/cratis-chronicle-client-typescript/SKILL.md +26 -20
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/read-models-and-projections.md +4 -4
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/testing.md +1 -1
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/variants.md +4 -3
- package/package/corpus/skills/cratis-chronicle-client-typescript/verification.json +2 -2
- package/package/corpus/skills/cratis-chronicle-compliance/SKILL.md +9 -9
- package/package/corpus/skills/cratis-chronicle-decision-reads/SKILL.md +11 -10
- package/package/corpus/skills/cratis-chronicle-decision-reads/references/admission-and-ownership.md +1 -1
- package/package/corpus/skills/cratis-chronicle-decision-reads/references/choosing-how-a-rule-holds.md +5 -6
- package/package/corpus/skills/cratis-chronicle-event-constraints/SKILL.md +7 -7
- package/package/corpus/skills/cratis-chronicle-event-constraints/references/closing-streams.md +1 -1
- package/package/corpus/skills/cratis-chronicle-event-specifications/SKILL.md +6 -6
- package/package/corpus/skills/cratis-chronicle-event-type-migration/SKILL.md +12 -10
- package/package/corpus/skills/cratis-chronicle-event-type-migration/references/pinned-generations.md +2 -3
- package/package/corpus/skills/cratis-chronicle-hosting/SKILL.md +7 -7
- package/package/corpus/skills/cratis-chronicle-hosting/references/operations.md +5 -5
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/SKILL.md +6 -6
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/blocked-tools.md +5 -5
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/deployment.md +9 -10
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/observational-tools.md +29 -29
- package/package/corpus/skills/cratis-chronicle-multi-tenancy/SKILL.md +9 -9
- package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +13 -14
- package/package/corpus/skills/cratis-chronicle-projection/references/fluent-builder.md +3 -5
- package/package/corpus/skills/cratis-chronicle-projection/references/model-bound-attributes.md +2 -4
- package/package/corpus/skills/cratis-chronicle-projection/references/variants.md +1 -3
- package/package/corpus/skills/cratis-chronicle-read-model/SKILL.md +16 -15
- package/package/corpus/skills/cratis-chronicle-read-model/references/queries.md +8 -8
- package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +14 -13
- package/package/corpus/skills/cratis-chronicle-web-workbench/SKILL.md +11 -12
- package/package/corpus/skills/cratis-cli-terminal-workbench/SKILL.md +6 -6
- package/package/corpus/skills/cratis-code-review/SKILL.md +13 -17
- package/package/corpus/skills/cratis-components-accessibility/SKILL.md +3 -3
- package/package/corpus/skills/cratis-components-common-controls/SKILL.md +15 -15
- package/package/corpus/skills/cratis-components-data-surfaces/SKILL.md +29 -29
- package/package/corpus/skills/cratis-components-schema-editor/SKILL.md +4 -4
- package/package/corpus/skills/cratis-components-schema-editor/references/tree-layout.md +1 -1
- package/package/corpus/skills/cratis-components-stepper-command-dialog/SKILL.md +6 -6
- package/package/corpus/skills/cratis-components-styling/LICENSE +6 -0
- package/package/corpus/skills/cratis-components-styling/SKILL.md +5 -4
- package/package/corpus/skills/cratis-components-toolbar/SKILL.md +5 -5
- package/package/corpus/skills/cratis-developer-marketing/SKILL.md +2 -2
- package/package/corpus/skills/cratis-engineering-csharp-conventions/SKILL.md +3 -3
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/exceptions-logging-and-di.md +1 -1
- package/package/corpus/skills/cratis-engineering-effect-boundaries/references/failure-archetypes.md +4 -4
- package/package/corpus/skills/cratis-fundamentals-concept/SKILL.md +19 -24
- package/package/corpus/skills/cratis-fundamentals-concept/references/shop-generation.md +10 -10
- package/package/corpus/skills/cratis-fundamentals-concept/references/typescript-concepts.md +8 -8
- package/package/corpus/skills/cratis-fundamentals-concept-go/SKILL.md +10 -11
- package/package/corpus/skills/cratis-fundamentals-telemetry/SKILL.md +18 -18
- package/package/corpus/skills/cratis-fundamentals-telemetry/verification.json +1 -1
- package/package/corpus/skills/cratis-fundamentals-type-discovery/SKILL.md +4 -4
- package/package/corpus/skills/cratis-lens-browser-extension/SKILL.md +19 -19
- package/package/corpus/skills/cratis-orleans-jobs/SKILL.md +27 -27
- package/package/corpus/skills/cratis-orleans-jobs/references/state-machines.md +12 -12
- package/package/corpus/skills/cratis-performance-review/SKILL.md +8 -10
- package/package/corpus/skills/cratis-release-notes/SKILL.md +1 -1
- package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +1 -1
- package/package/corpus/skills/cratis-security-review/SKILL.md +8 -10
- package/package/corpus/skills/cratis-security-review/references/arc-boundaries.md +18 -16
- package/package/corpus/skills/cratis-specification-by-example/SKILL.md +1 -1
- package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +26 -29
- package/package/corpus/skills/cratis-specifications-csharp/references/application-scenarios.md +8 -8
- package/package/corpus/skills/cratis-specifications-csharp/references/csharp-patterns.md +2 -2
- package/package/corpus/skills/cratis-specifications-csharp/references/integration-specs.md +6 -4
- package/package/corpus/skills/cratis-specifications-csharp/references/shared-lifecycle.md +6 -2
- package/package/corpus/skills/cratis-specifications-typescript/SKILL.md +2 -2
- package/package/corpus/skills/cratis-studio-mcp-safety-guidance/SKILL.md +4 -4
- package/package/corpus/skills/cratis-writing-voice-and-cadence/SKILL.md +1 -1
- package/package/corpus/skills/guiding-refactoring-with-code-health/SKILL.md +1 -1
- package/package/corpus/skills/prioritizing-technical-debt/SKILL.md +1 -1
- package/package/corpus/skills/risk-based-testing-with-code-health/SKILL.md +3 -3
- package/package/corpus/skills/safeguarding-ai-generated-code/SKILL.md +1 -1
- package/package.json +1 -1
|
@@ -11,13 +11,13 @@ concepts and Chronicle stream identities separate.
|
|
|
11
11
|
|
|
12
12
|
## Verified product sources
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Sources:
|
|
15
15
|
|
|
16
|
-
| Package |
|
|
17
|
-
| --- | --- |
|
|
18
|
-
| `Cratis.Fundamentals` | `
|
|
19
|
-
| `Cratis.Chronicle` | `
|
|
20
|
-
| `@cratis/fundamentals` |
|
|
16
|
+
| Package | Purpose |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| `Cratis.Fundamentals` | `ConceptAs<T>`, `IGeneratable<TSelf>`, `IGeneratableInContext<TSelf>`, `GenerationContext` and `GenerateValue` |
|
|
19
|
+
| `Cratis.Chronicle` | `Cratis.Chronicle.Events.EventSourceId` and `EventSourceId<T>` |
|
|
20
|
+
| `@cratis/fundamentals` | TypeScript `ConceptAs<T>`, `field`, `Guid`, and JSON conversion |
|
|
21
21
|
|
|
22
22
|
Reverify product sources before claiming support for another version.
|
|
23
23
|
|
|
@@ -79,18 +79,13 @@ Do not assume `string.Empty`, `0`, or `Guid.Empty` is universally invalid.
|
|
|
79
79
|
|
|
80
80
|
## Let a concept generate its own value
|
|
81
81
|
|
|
82
|
-
Check the Cratis.Fundamentals version the project resolves first.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
resolves 7.23.0 or later. Chronicle **v19.50.0** still pins **7.22.0** in
|
|
86
|
-
`Directory.Packages.props`. For older Arc or Chronicle-only applications, when
|
|
87
|
-
the resolved version is below 7.23.0, add a direct `Cratis.Fundamentals` 7.23.0
|
|
88
|
-
or later package reference, or keep the existing `static New()` (without the
|
|
82
|
+
Check the Cratis.Fundamentals version the project resolves first.
|
|
83
|
+
|
|
84
|
+
Requires Cratis.Fundamentals 7.23.0 for `IGeneratable<TSelf>`. Arc 22.66.0 or later already resolves it, so do not add a direct reference there. For an older Arc or a Chronicle-only application whose resolved version is lower, add a direct `Cratis.Fundamentals` package reference at 7.23.0 or later, or keep the existing `static New()` (without the
|
|
89
85
|
interface) until you can.
|
|
90
86
|
|
|
91
87
|
When the system, not the caller, creates a value, the concept declares how by
|
|
92
|
-
implementing `IGeneratable<TSelf>` (`Cratis.Concepts`,
|
|
93
|
-
7.23.0 or later). The interface requires `static abstract TSelf New()`, so
|
|
88
|
+
implementing `IGeneratable<TSelf>` (`Cratis.Concepts`). The interface requires `static abstract TSelf New()`, so
|
|
94
89
|
generic code constrained on `where T : IGeneratable<T>` calls `T.New()` without
|
|
95
90
|
reflection. Generate a UUID with `GenerateValue`, never with `Guid.NewGuid()` in
|
|
96
91
|
scattered call sites and never with `System.Random`:
|
|
@@ -114,7 +109,7 @@ bits from `RandomNumberGenerator`:
|
|
|
114
109
|
millisecond, and clock adjustments can reorder values.
|
|
115
110
|
|
|
116
111
|
Neither helper guarantees uniqueness; a collision is extremely unlikely, not
|
|
117
|
-
impossible. Fundamentals
|
|
112
|
+
impossible. Fundamentals also supplies ULID, TypeID, NanoID and encoded
|
|
118
113
|
bytes. `IGeneratableInContext<TSelf>` declares static `New(GenerationContext)`
|
|
119
114
|
for a captured time and portable tenant. Built-ins consume time, not tenant;
|
|
120
115
|
context is not tenant isolation. Default time is rejected, not replaced with now.
|
|
@@ -125,22 +120,22 @@ Sources and the complete shop example: [shop generation](references/shop-generat
|
|
|
125
120
|
The shared shop uses CustomerId (`cus_` + ULID), context-aware OrderId (TypeID),
|
|
126
121
|
InviteCode (NanoID), and secret ApiKey (`Bytes(32)`, `[NotAudited]` in its host).
|
|
127
122
|
Read [choices, time/tenant context and protection](references/shop-generation.md).
|
|
128
|
-
|
|
123
|
+
Requires Fundamentals 7.24.0 for these newer helpers; the earlier
|
|
129
124
|
UUID examples remain supported.
|
|
130
125
|
|
|
131
126
|
## When not to generate
|
|
132
127
|
|
|
133
128
|
Client-supplied identities stay inputs; random generation is not idempotency or
|
|
134
129
|
gapless numbering. UUIDs are not credentials. Byte generation can create a secret
|
|
135
|
-
in
|
|
130
|
+
in Fundamentals, but audit suppression, authorized delivery and hash storage are separate
|
|
136
131
|
host responsibilities; never treat randomness as protection.
|
|
137
132
|
|
|
138
133
|
In specifications, construct the concept from a known value
|
|
139
134
|
(`new <ConceptName>(Guid.Parse("…"))`) and assert against it. Do not seed or
|
|
140
|
-
replace the generator.
|
|
141
|
-
reach `Handle()` through `[GeneratedValue]` rather than calling `New()` inside
|
|
135
|
+
replace the generator. Let a server-owned new identifier
|
|
136
|
+
reach `Handle()` through `[GeneratedValue]` (Requires Arc 22.66.0) rather than calling `New()` inside
|
|
142
137
|
it; see `cratis-arc-command` for declaration and migration, and
|
|
143
|
-
`cratis-specifications-csharp` for named scenario pins (Arc
|
|
138
|
+
`cratis-specifications-csharp` for named scenario pins (Requires Arc 22.67.0).
|
|
144
139
|
Guide: `/fundamentals/csharp/generating-values/`.
|
|
145
140
|
|
|
146
141
|
## Create a TypeScript value concept
|
|
@@ -221,9 +216,9 @@ untyped `EventSourceId`, and `EventSourceId<T>`. Those operators do not create
|
|
|
221
216
|
your derived `<ConceptName>` from `T`, string, or untyped `EventSourceId`.
|
|
222
217
|
Declare only the derived-type conversions your domain API needs.
|
|
223
218
|
|
|
224
|
-
String and Guid remain the safest stream-id primitives.
|
|
225
|
-
(`Source/Clients/DotNET/Events/EventSourceId.cs
|
|
226
|
-
and concepts wrapping them convert with invariant culture (
|
|
219
|
+
String and Guid remain the safest stream-id primitives. In Chronicle
|
|
220
|
+
(`Source/Clients/DotNET/Events/EventSourceId.cs`), numeric/date/time ids
|
|
221
|
+
and concepts wrapping them convert with invariant culture (Requires Chronicle 19.37.3).
|
|
227
222
|
`DateTime`, `DateTimeOffset`, `DateOnly`, `TimeOnly` use `"O"`; `TimeSpan` uses
|
|
228
223
|
`"c"`. Decimal `123.45` stays `"123.45"` even under nb-NO.
|
|
229
224
|
**Existing streams may have different legacy ids** if written under date/time or
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
- Choosing a strategy
|
|
9
9
|
- When not to generate
|
|
10
|
-
-
|
|
10
|
+
- Sources
|
|
11
11
|
|
|
12
12
|
## Choosing a strategy
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
A shop can use CustomerId (`cus_` + ULID) for
|
|
15
15
|
recognizable time-ordered customer references, OrderId (TypeID) for typed order
|
|
16
16
|
references, InviteCode (NanoID) for opaque invitation references, and ApiKey
|
|
17
17
|
(`Bytes(32)`) for a 256-bit credential. UUID remains the ordinary identity choice;
|
|
@@ -20,8 +20,8 @@ UUIDv7/ULID/TypeID reveal time and are not monotonic within a millisecond.
|
|
|
20
20
|
An invitation reference here is not by itself permission to join the shop; if
|
|
21
21
|
possession is the authorization mechanism, treat it as a protected credential too.
|
|
22
22
|
|
|
23
|
-
This complete concept excerpt requires `Cratis.Fundamentals`
|
|
24
|
-
for the ApiKey audit attribute, `Cratis.Arc.Chronicle
|
|
23
|
+
This complete concept excerpt requires `Cratis.Fundamentals` 7.24.0 or later and,
|
|
24
|
+
for the ApiKey audit attribute, `Cratis.Arc.Chronicle`. These are
|
|
25
25
|
non-stream references; use `EventSourceId<string>` instead only if a concept
|
|
26
26
|
actually identifies a Chronicle event source.
|
|
27
27
|
|
|
@@ -98,13 +98,13 @@ before the Unix epoch. A fixed context fixes the timestamp, not random suffixes.
|
|
|
98
98
|
- Never log generated values/captures or seed production randomness. Use known
|
|
99
99
|
values in specs; test shape/time separately when randomness is the behavior.
|
|
100
100
|
|
|
101
|
-
##
|
|
101
|
+
## Sources
|
|
102
102
|
|
|
103
|
-
Fundamentals `
|
|
104
|
-
`IGeneratableInContext.cs
|
|
105
|
-
`GenerateValue.RandomStrings.cs
|
|
106
|
-
Arc `
|
|
107
|
-
`CommandCausationValues.cs
|
|
103
|
+
Fundamentals `Source/DotNET/Fundamentals/Concepts/GenerationContext.cs`,
|
|
104
|
+
`IGeneratableInContext.cs`, `GenerateValue.TimeOrderedStrings.cs`,
|
|
105
|
+
`GenerateValue.RandomStrings.cs`; `Documentation/csharp/generating-values.md`.
|
|
106
|
+
Arc `Source/DotNET/Chronicle/Commands/NotAuditedAttribute.cs`,
|
|
107
|
+
`CommandCausationValues.cs` (command/type/property exclusion only, never
|
|
108
108
|
payload encryption or log protection);
|
|
109
109
|
`Documentation/backend/csharp/commands/generated-values.md`.
|
|
110
110
|
The latter attribute belongs to the host integration, not Fundamentals.
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
- Serialization boundaries
|
|
11
11
|
- Other typed values
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Source: `@cratis/fundamentals`: `ConceptAs.ts`,
|
|
14
14
|
`JsonSerializer.ts`, and `Documentation/typescript/concept_as.md` in Fundamentals.
|
|
15
15
|
|
|
16
16
|
## Declare a concept
|
|
17
17
|
|
|
18
|
-
The convenient union pattern
|
|
18
|
+
The convenient union pattern accepts either a concept instance or its
|
|
19
19
|
underlying primitive. Supply the runtime class, not the union type, to `@field`:
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
@@ -47,7 +47,7 @@ for a string-backed concept; it does not require a different naming pattern.
|
|
|
47
47
|
|
|
48
48
|
## Convert non-primitive values
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
`valueType` tells deserialization to convert the inner payload before
|
|
51
51
|
constructing the concept. Without it, a Guid wire value remains a string:
|
|
52
52
|
|
|
53
53
|
```typescript
|
|
@@ -72,10 +72,10 @@ class User {
|
|
|
72
72
|
Use `JsonSerializer.serialize(instance)` and
|
|
73
73
|
`JsonSerializer.deserialize(Type, json)` for typed conversion. Concepts serialize
|
|
74
74
|
to their inner value and deserialize to instances when their runtime class is
|
|
75
|
-
supplied as metadata. Collections and maps unwrap concepts too
|
|
75
|
+
supplied as metadata. Collections and maps unwrap concepts too.
|
|
76
76
|
|
|
77
77
|
Keep one resolved copy of `@cratis/fundamentals`: duplicate copies trigger a
|
|
78
|
-
warning and can cause identity/`instanceof` problems. The
|
|
78
|
+
warning and can cause identity/`instanceof` problems. The serializer uses
|
|
79
79
|
stable type keys for concepts and converters, but that does not make all
|
|
80
80
|
cross-copy identity checks safe.
|
|
81
81
|
|
|
@@ -83,15 +83,15 @@ cross-copy identity checks safe.
|
|
|
83
83
|
|
|
84
84
|
The root exports `Guid`, `DateOnly`, `TimeOnly`, `TimeSpan`, `ValueMap`, `field`,
|
|
85
85
|
and `JsonSerializer`. Subpaths `/json`, `/geospatial`, and `/reflection` are
|
|
86
|
-
exported too. The package declarations support NodeNext resolution
|
|
86
|
+
exported too. The package declarations support NodeNext resolution.
|
|
87
87
|
Use `JsonSerializer.registerConverter(converter)` for a custom `JsonConverter`
|
|
88
88
|
instance, rather than replacing the serializer.
|
|
89
89
|
|
|
90
|
-
`@field` supports legacy and standard decorators
|
|
90
|
+
`@field` supports legacy and standard decorators; standard fields need
|
|
91
91
|
decorator metadata support. Load `@cratis/fundamentals/reflection` before defining
|
|
92
92
|
metadata-dependent types. For arrays, declare the element constructor with
|
|
93
93
|
`@field(Array, { genericArguments: [Item] })`, where `Item` is the model's runtime
|
|
94
|
-
class, not a type alias
|
|
94
|
+
class, not a type alias.
|
|
95
95
|
|
|
96
96
|
Dependent Arc/Chronicle peer ranges are not feature guarantees: check the actual
|
|
97
97
|
resolved Fundamentals version before relying on these version-qualified APIs.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: cratis-fundamentals-concept-go
|
|
3
3
|
description: Define named Go domain values with Fundamentals.Go concepts, explicit UUID text and JSON codecs, and scalar recognition. Use when an identity or scalar must not be interchangeable with its primitive. Do not use for C# ConceptAs types, event migration or dependency-injection setup.
|
|
4
4
|
license: MIT
|
|
5
|
-
compatibility: Go 1.26 or later
|
|
5
|
+
compatibility: Go 1.26 or later.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
<!-- Copyright (c) Cratis. All rights reserved. -->
|
|
@@ -10,8 +10,8 @@ compatibility: Go 1.26 or later for Fundamentals.Go v0.3.2.
|
|
|
10
10
|
|
|
11
11
|
# Typed domain values in Go
|
|
12
12
|
|
|
13
|
-
> **Experimental v0:**
|
|
14
|
-
>
|
|
13
|
+
> **Experimental v0:** minor releases may break APIs; pin the module version you test against.
|
|
14
|
+
> Companion guidance: Chronicle.Go and Arc.Go.
|
|
15
15
|
|
|
16
16
|
Use a defined type for each domain value, not a type alias that remains
|
|
17
17
|
interchangeable with every UUID/string. Plain constructors are enough; adopting
|
|
@@ -19,17 +19,17 @@ concepts does not require a dependency-injection container.
|
|
|
19
19
|
|
|
20
20
|
## Verified product sources
|
|
21
21
|
|
|
22
|
-
| Product |
|
|
23
|
-
| --- | --- |
|
|
24
|
-
| Fundamentals.Go (`github.com/cratis/fundamentals.go`) | `
|
|
22
|
+
| Product | Source checked |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| Fundamentals.Go (`github.com/cratis/fundamentals.go`) | `concepts/concept.go`, `concepts/uuid.go`, `concepts/uuid_dotnet.go`, `concepts/underlying.go`, `concepts/check_json.go`, `documentation_examples_test.go` |
|
|
25
25
|
|
|
26
|
-
[Source
|
|
27
|
-
is authoritative, not
|
|
26
|
+
[Source](https://github.com/Cratis/Fundamentals.Go)
|
|
27
|
+
is authoritative, not an older installation pin on a getting-started page.
|
|
28
28
|
The root module is standard-library-only and requires Go 1.26.
|
|
29
29
|
|
|
30
30
|
## Define and encode an identity
|
|
31
31
|
|
|
32
|
-
Install `github.com/cratis/fundamentals.go
|
|
32
|
+
Install `github.com/cratis/fundamentals.go` at your chosen release into a consumer module.
|
|
33
33
|
This complete package defines an author identity and its codecs:
|
|
34
34
|
|
|
35
35
|
```go
|
|
@@ -108,5 +108,4 @@ it only when importing that compatibility contract, not for canonical admission.
|
|
|
108
108
|
- Compile and round-trip the named value against the pinned module without local replacements.
|
|
109
109
|
- Verify canonical wire bytes, zero/null policy and failure-atomic decoders.
|
|
110
110
|
- Check domain invariants separately from scalar recognition.
|
|
111
|
-
- Chronicle.Go
|
|
112
|
-
this standalone v0.3.2 example is not a demand to upgrade their dependencies.
|
|
111
|
+
- Chronicle.Go and Arc.Go each declare the Fundamentals.Go they require; this standalone example is not a demand to upgrade their dependencies.
|
|
@@ -13,19 +13,19 @@ Use this when a service needs measurements and spans, not business facts. Keep e
|
|
|
13
13
|
|
|
14
14
|
## Verified product sources
|
|
15
15
|
|
|
16
|
-
All source locators below are in **Cratis/Fundamentals
|
|
16
|
+
All source locators below are in **Cratis/Fundamentals**. Read the release you consume, not a sibling checkout's HEAD.
|
|
17
17
|
|
|
18
|
-
| Package |
|
|
19
|
-
| --- | --- |
|
|
20
|
-
| `Cratis.Fundamentals` | `
|
|
21
|
-
| `Cratis.Metrics.Roslyn` | `
|
|
22
|
-
| `Cratis.OpenTelemetry` | `
|
|
18
|
+
| Package | Source |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| `Cratis.Fundamentals` | `Source/DotNET/Fundamentals/Metrics/{Counter,Gauge,Histogram}Attribute.cs`, `Traces/SpanAttribute.cs`, `Diagnostics/TagAttribute.cs` |
|
|
21
|
+
| `Cratis.Metrics.Roslyn` | `Source/DotNET/Metrics.Roslyn/MetricsSourceGenerator.cs`; `Templates/Metrics.hbs` |
|
|
22
|
+
| `Cratis.OpenTelemetry` | `Source/DotNET/OpenTelemetry/OpenTelemetryExtensions.cs`; `InstrumentationExtensions.cs`; `CratisOpenTelemetryOptions.cs` |
|
|
23
23
|
|
|
24
|
-
Registration evidence: `Source/DotNET/Fundamentals/DependencyInjection/ServiceCollectionExtensions.cs
|
|
24
|
+
Registration evidence: `Source/DotNET/Fundamentals/DependencyInjection/ServiceCollectionExtensions.cs`. Unkeyed names: `Metrics/UnkeyedMeter.cs`, `Traces/UnkeyedActivitySource.cs` under the same Fundamentals source root. Upgrade context: `Documentation/csharp/metrics/roslyn.md` (Exported Metric Names) and `Documentation/csharp/opentelemetry.md`.
|
|
25
25
|
|
|
26
26
|
## 1. Declare instrumentation beside its owner
|
|
27
27
|
|
|
28
|
-
Reference `Cratis.Fundamentals` for runtime types and `Cratis.Metrics.Roslyn` for generation. Use a **static partial class in a namespace**, containing **static partial methods**. The generator's candidate filter requires static classes even for metrics; a merely partial instance class is not enough (`MetricsSourceGenerator.cs
|
|
28
|
+
Reference `Cratis.Fundamentals` for runtime types and `Cratis.Metrics.Roslyn` for generation. Use a **static partial class in a namespace**, containing **static partial methods**. The generator's candidate filter requires static classes even for metrics; a merely partial instance class is not enough (`MetricsSourceGenerator.cs`). Prefer extension declarations with short, unqualified attribute/type names, as below.
|
|
29
29
|
|
|
30
30
|
This declaration file is complete; it assumes the application's existing `ReportWorker` class in `MyApplication.Reports`:
|
|
31
31
|
|
|
@@ -59,11 +59,11 @@ public static partial class ReportInstrumentation
|
|
|
59
59
|
}
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
- The first metric argument is `IMeter<T>` or `IMeterScope<T>`. A counter without a measurement increments by one. The first remaining parameter, in any position, whose type exactly matches the attribute's numeric type is the measurement, not a tag; avoid a second parameter of that type. Gauges and histograms require that measurement (`MetricsSourceGenerator.cs
|
|
63
|
-
- Remaining parameters are tags. Metric keys default to parameter names; span keys default to snake_case. `[Tag("key")]` from `Cratis.Diagnostics` overrides either
|
|
64
|
-
- `IMeterScope<T>` merges scope tags with method tags (`Templates/Metrics.hbs
|
|
65
|
-
- Name, description and optional UCUM unit are distinct. A duration in seconds uses `"s"` and a measurement in seconds, not milliseconds (`HistogramAttribute.cs
|
|
66
|
-
- A span returns `IActivityScope<T>` and takes `IActivitySource<T>` first. Assign the returned scope with `using`; `CRT0001` checks disposal (`ActivityScopeUsingAnalyzer.cs
|
|
62
|
+
- The first metric argument is `IMeter<T>` or `IMeterScope<T>`. A counter without a measurement increments by one. The first remaining parameter, in any position, whose type exactly matches the attribute's numeric type is the measurement, not a tag; avoid a second parameter of that type. Gauges and histograms require that measurement (`MetricsSourceGenerator.cs`).
|
|
63
|
+
- Remaining parameters are tags. Metric keys default to parameter names; span keys default to snake_case. `[Tag("key")]` from `Cratis.Diagnostics` overrides either.
|
|
64
|
+
- `IMeterScope<T>` merges scope tags with method tags (`Templates/Metrics.hbs`). Do not put credentials, personal payloads or unbounded entity IDs in metric labels; choose bounded categories.
|
|
65
|
+
- Name, description and optional UCUM unit are distinct. A duration in seconds uses `"s"` and a measurement in seconds, not milliseconds (`HistogramAttribute.cs`, template).
|
|
66
|
+
- A span returns `IActivityScope<T>` and takes `IActivitySource<T>` first. Assign the returned scope with `using`; `CRT0001` checks disposal (`ActivityScopeUsingAnalyzer.cs`, `Templates/Metrics.hbs`).
|
|
67
67
|
|
|
68
68
|
Call-site excerpt inside the existing worker, with injected `IMeter<ReportWorker> meter` and `IActivitySource<ReportWorker> source`:
|
|
69
69
|
|
|
@@ -96,13 +96,13 @@ builder.AddCratisOpenTelemetry(options =>
|
|
|
96
96
|
});
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
`AddCratisOpenTelemetry` extends `IHostApplicationBuilder`. When the host already owns an OpenTelemetry builder, use `services.AddOpenTelemetry().WithCratis(configuration, configure)` instead; `WithCratis` extends `OpenTelemetryBuilder`. Do not add both setups. If the application only wants subscription helpers, `AddCratisInstrumentation()` extends both `TracerProviderBuilder` and `MeterProviderBuilder`, not the service collection (`OpenTelemetryExtensions.cs
|
|
99
|
+
`AddCratisOpenTelemetry` extends `IHostApplicationBuilder`. When the host already owns an OpenTelemetry builder, use `services.AddOpenTelemetry().WithCratis(configuration, configure)` instead; `WithCratis` extends `OpenTelemetryBuilder`. Do not add both setups. If the application only wants subscription helpers, `AddCratisInstrumentation()` extends both `TracerProviderBuilder` and `MeterProviderBuilder`, not the service collection (`OpenTelemetryExtensions.cs`, `InstrumentationExtensions.cs`).
|
|
100
100
|
|
|
101
|
-
Shared setup adds Cratis sources/meters, ASP.NET Core and HTTP client instrumentation, runtime metrics, and scoped/formatted logs. Application callbacks run before DI is built (`OpenTelemetryExtensions.cs
|
|
101
|
+
Shared setup adds Cratis sources/meters, ASP.NET Core and HTTP client instrumentation, runtime metrics, and scoped/formatted logs. Application callbacks run before DI is built (`OpenTelemetryExtensions.cs`).
|
|
102
102
|
|
|
103
103
|
## 3. Configure export, without baking endpoints or secrets into code
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
OTLP export is **opt-in**: no configured endpoint means no OTLP exporter. Environment values take precedence over configuration keys. Relevant standard keys (`OpenTelemetryExtensions.cs`):
|
|
106
106
|
|
|
107
107
|
| Key | Effect |
|
|
108
108
|
| --- | --- |
|
|
@@ -119,7 +119,7 @@ For HTTP/protobuf, the shared endpoint gains `/v1/traces`, `/v1/metrics` or `/v1
|
|
|
119
119
|
|
|
120
120
|
## Upgrade and prove it
|
|
121
121
|
|
|
122
|
-
- Fundamentals stopped bringing the OpenTelemetry SDK transitively
|
|
123
|
-
-
|
|
122
|
+
- Fundamentals stopped bringing the OpenTelemetry SDK transitively; add the explicit telemetry package when migrating a consumer that relied on that dependency (`Documentation/csharp/opentelemetry.md`).
|
|
123
|
+
- Regenerating after an upgrade from a Fundamentals older than 7.20.0 can rename exported Prometheus metrics: descriptions are HELP text, not units. Rebuild the consumer and update dashboards/alerts that used the old description-suffixed names (`metrics/roslyn.md`).
|
|
124
124
|
- Build with analyzers and warnings as errors. Inspect generated implementations for correct measurements/tags and scope disposal. Do not edit generated files.
|
|
125
125
|
- Exercise one code path with a listener or the configured collector: observe the counter increment, histogram unit/measurement and completed span. A build or `skill-contains` assertion is not proof of export. Check namespace subscriptions, SDK disablement, sampler and endpoint independently before diagnosing the collector.
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
{ "kind": "skill-contains", "value": "typeof(T).FullName" },
|
|
11
11
|
{ "kind": "skill-contains", "value": "AddCratisOpenTelemetry" },
|
|
12
12
|
{ "kind": "skill-contains", "value": "no configured endpoint means no OTLP exporter" },
|
|
13
|
-
{ "kind": "skill-contains", "value": "descriptions are
|
|
13
|
+
{ "kind": "skill-contains", "value": "descriptions are HELP text, not units" }
|
|
14
14
|
]
|
|
15
15
|
}
|
|
@@ -16,9 +16,9 @@ removing one becomes a single-file change.
|
|
|
16
16
|
|
|
17
17
|
## Verified product sources
|
|
18
18
|
|
|
19
|
-
| Package |
|
|
20
|
-
| --- | --- |
|
|
21
|
-
| `Cratis.Fundamentals` | `
|
|
19
|
+
| Package | Purpose |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| `Cratis.Fundamentals` | `IInstancesOf<T>`, `IImplementationsOf<T>`, `ITypes`, convention bindings and the bundled `Cratis.Fundamentals.TypeDiscovery.Generator` |
|
|
22
22
|
|
|
23
23
|
Reverify against the Cratis Fundamentals repository before claiming support for
|
|
24
24
|
another version.
|
|
@@ -63,7 +63,7 @@ Discovery normally uses compile-time generated providers, not a walk of
|
|
|
63
63
|
|
|
64
64
|
The host must call `services.AddTypeDiscovery()` to register `ITypes`,
|
|
65
65
|
`IInstancesOf<>`, and `IImplementationsOf<>`, plus the convention binding setup.
|
|
66
|
-
Arc's `AddCratisArc` does this
|
|
66
|
+
Arc's `AddCratisArc` does this; a plain host must do it.
|
|
67
67
|
No per-implementation registration is needed when self-binding applies.
|
|
68
68
|
|
|
69
69
|
The Fundamentals NuGet package carries the generator as an analyzer. A project
|
|
@@ -17,17 +17,15 @@ the developer points it at. Nothing in it is production tooling.
|
|
|
17
17
|
|
|
18
18
|
## Verified product sources
|
|
19
19
|
|
|
20
|
-
| Source |
|
|
21
|
-
| --- | --- |
|
|
22
|
-
| `Cratis/Lens` `Source/` |
|
|
23
|
-
| `Cratis.Arc.Core` |
|
|
20
|
+
| Source | Purpose |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| `Cratis/Lens` `Source/` | The extension itself; no newer release |
|
|
23
|
+
| `Cratis.Arc.Core` | The `/.cratis/*` endpoints, the forwarded-identity contract, and the tenancy header Lens depends on |
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
[
|
|
29
|
-
[IntrospectionOptions.cs](https://github.com/Cratis/Arc/blob/v22.75.0/Source/DotNET/Arc.Core/Introspection/IntrospectionOptions.cs)
|
|
30
|
-
and [DiscoveryExposure.cs:102–138](https://github.com/Cratis/Arc/blob/v22.75.0/Source/DotNET/Arc.Core/Introspection/DiscoveryExposure.cs#L102-L138).
|
|
25
|
+
Arc evidence: [ArcOptions.cs](https://github.com/Cratis/Arc/blob/main/Source/DotNET/Arc.Core/ArcOptions.cs),
|
|
26
|
+
[MicrosoftIdentityPlatformAuthenticationHandler.cs](https://github.com/Cratis/Arc/blob/main/Source/DotNET/Arc.Core/Identity/MicrosoftIdentityPlatformAuthenticationHandler.cs),
|
|
27
|
+
[IntrospectionOptions.cs](https://github.com/Cratis/Arc/blob/main/Source/DotNET/Arc.Core/Introspection/IntrospectionOptions.cs)
|
|
28
|
+
and [DiscoveryExposure.cs](https://github.com/Cratis/Arc/blob/main/Source/DotNET/Arc.Core/Introspection/DiscoveryExposure.cs).
|
|
31
29
|
|
|
32
30
|
⚠️ **There is no published store listing.** Nothing in the Lens repository links
|
|
33
31
|
a Chrome Web Store, Edge Add-ons, AMO, or App Store entry — the only store URLs
|
|
@@ -67,7 +65,7 @@ same three the pull-request workflow runs. There is no lint script.
|
|
|
67
65
|
|
|
68
66
|
On `main`, `yarn build-package` runs `scripts/build-package.js` and writes zip
|
|
69
67
|
packages into repo-root `dist/`; the manifest description changed, but the name
|
|
70
|
-
is still **Cratis Lens**.
|
|
68
|
+
is still **Cratis Lens**. the script instead zips to `lens-extension.zip`.
|
|
71
69
|
|
|
72
70
|
The code uses the `chrome.*` namespace throughout with no polyfill. The release
|
|
73
71
|
workflow also packages for Edge, Firefox and Safari, but no cross-browser
|
|
@@ -90,20 +88,22 @@ strips client-supplied identity headers.
|
|
|
90
88
|
| `GET /.cratis/tenants` | every `ICanProvideTenants`, identity discovery policy | The importable tenant list |
|
|
91
89
|
| `GET /.cratis/identity-details/schema` | the identity endpoint mapper | The schema-driven editor for a user's `identityDetails` |
|
|
92
90
|
|
|
93
|
-
|
|
91
|
+
Requires Arc 22.45.0 for discovery to be anonymous by default **only in Development**; older versions serve it anonymously everywhere.
|
|
92
|
+
|
|
93
|
+
Discovery is anonymous by default **only in Development**.
|
|
94
94
|
Against a deployed host Lens needs the user signed in; hosts unable to authenticate
|
|
95
95
|
omit those routes (404). `Introspection.Enabled` controls catalogs and
|
|
96
96
|
`IdentityDiscovery` the roster/tenant/schema routes. Forwarded identity switching
|
|
97
97
|
also needs the explicit host-wide `TrustForwardedIdentityHeaders` opt-in, only
|
|
98
98
|
behind a header-stripping ingress. Source:
|
|
99
|
-
[secure defaults](https://github.com/Cratis/Arc/blob/
|
|
99
|
+
[secure defaults](https://github.com/Cratis/Arc/blob/main/Documentation/upgrading/secure-defaults.mdx).
|
|
100
100
|
`MapIntrospectionEndpoints` runs during Arc activation, subject to these settings. The user and tenant
|
|
101
101
|
routes return whatever the application implements — with **no implementation
|
|
102
102
|
registered they return an empty list**, and Lens treats a `404` on either as
|
|
103
103
|
"empty", not "broken". Users and tenants can also be created by hand in Lens's
|
|
104
104
|
Settings, so an application that provides neither still works.
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
All five discovery routes are anonymous by default only in
|
|
107
107
|
**Development**. Elsewhere they require authentication, or are not mapped when
|
|
108
108
|
the host cannot enforce it. `Cratis:Arc:Introspection` options `Enabled` and
|
|
109
109
|
`IdentityDiscovery` control mapping; `RequireAuthentication` and `Roles` control
|
|
@@ -144,7 +144,7 @@ application needs no change.
|
|
|
144
144
|
⚠️ **`tenantHeaderName` has no user interface.** It is a stored setting with a
|
|
145
145
|
default and nothing binds it to an input. An application that resolves tenancy
|
|
146
146
|
by query parameter, claim, subdomain, or a renamed header **cannot be driven by
|
|
147
|
-
Lens
|
|
147
|
+
Lens** without editing `chrome.storage.local` by hand. Guidance describing
|
|
148
148
|
a "Tenant Header Name" field on an options page is describing something that
|
|
149
149
|
does not exist — there is no `options_page` in the manifest at all.
|
|
150
150
|
|
|
@@ -178,7 +178,7 @@ Pick both on the **Context** tab. Two things then happen, in this order:
|
|
|
178
178
|
2. It deletes the Arc identity cookie `.cratis-identity` on the detected base URL
|
|
179
179
|
and page origins, then reloads every open tab on those origins.
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
The backend neither reads nor writes that legacy identity
|
|
182
182
|
cookie. Lens still deletes it for older hosts; reloading clears the frontend's
|
|
183
183
|
in-memory identity and asks `/.cratis/me` again. Header-based switching requires
|
|
184
184
|
the host-wide trust opt-in and a suitable development/ingress boundary; the
|
|
@@ -206,7 +206,7 @@ query is always `GET`, with `{name}` segments in the route substituted from the
|
|
|
206
206
|
path-parameter inputs and the same context headers.
|
|
207
207
|
|
|
208
208
|
⚠️ **The schema-driven payload form does not receive a schema from
|
|
209
|
-
Arc
|
|
209
|
+
Arc.** Lens reads an optional property named `schema` off each introspection
|
|
210
210
|
item, and falls back to trying `/.cratis/types/{type}`, `/.cratis/schema/{type}`,
|
|
211
211
|
`/.cratis/schemas/{type}` and `/.cratis/types?type={type}` in turn. Arc names the
|
|
212
212
|
property **`payloadSchema`** on a command and **`argumentsSchema`** on a query,
|
|
@@ -230,10 +230,10 @@ unwrapped from the first of `data`, `result`, `items`, `results`, `value`,
|
|
|
230
230
|
the Settings user/tenant refresh does send both. So an application that puts
|
|
231
231
|
authentication in front of `/.cratis/commands` and `/.cratis/queries` breaks
|
|
232
232
|
those tabs while Settings may keep working. This is the default outside
|
|
233
|
-
Development
|
|
233
|
+
Development. Run the app in **Development**, or knowingly set
|
|
234
234
|
`Cratis:Arc:Introspection:RequireAuthentication=false` on an isolated development
|
|
235
235
|
host; do not weaken production discovery for Lens.
|
|
236
|
-
Evidence: [Lens introspection.ts
|
|
236
|
+
Evidence: [Lens introspection.ts](https://github.com/Cratis/Lens/blob/main/Source/arc/introspection.ts).
|
|
237
237
|
|
|
238
238
|
Queries are path-parameter GETs only: no query-string arguments, no paging or
|
|
239
239
|
sorting inputs, and no observable subscription from the popup.
|
|
@@ -13,30 +13,30 @@ For services and kernel contributors using Orleans. This is library-consumer gui
|
|
|
13
13
|
|
|
14
14
|
## Verified product sources
|
|
15
15
|
|
|
16
|
-
All Orleans claims below
|
|
16
|
+
All Orleans claims below come from `Cratis/Orleans` source.
|
|
17
17
|
|
|
18
|
-
| Packages |
|
|
19
|
-
| --- | --- |
|
|
20
|
-
| `Cratis.Orleans`, `Cratis.Orleans.Storage` | `
|
|
21
|
-
| `Cratis.Orleans.Storage.MongoDB`, `Cratis.Orleans.Storage.Sql` | `
|
|
22
|
-
| `Cratis.Orleans.Chronicle` | `
|
|
18
|
+
| Packages | Sources |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| `Cratis.Orleans`, `Cratis.Orleans.Storage` | `Source/Orleans/Jobs/{Job.cs,Job.Steps.cs,Job.Stages.cs,JobStep.cs,IJobsManager.cs,JobsOptions.cs}`; `Source/Orleans.Storage/Jobs/*` |
|
|
21
|
+
| `Cratis.Orleans.Storage.MongoDB`, `Cratis.Orleans.Storage.Sql` | `Source/Orleans.Storage.MongoDB/{MongoDBJobsStorageOptions.cs,DatabaseNames.cs}`; `Source/Orleans.Storage.Sql/{SqlJobsStorage.cs,SqlJobsStorageOptions.cs,Jobs/Migrations/v1_0_0.cs}` |
|
|
22
|
+
| `Cratis.Orleans.Chronicle` | `Source/Orleans.Chronicle/StateMachines/EventSourcedStateMachine.cs`; [state-machine reference](references/state-machines.md) |
|
|
23
23
|
|
|
24
24
|
The API snippets cite their exact files and lines below. Product docs `Documentation/concepts/{jobs,storage-scopes,state-machines,event-sourced-state-machines}.md` supply the task vocabulary; source resolves contradictions.
|
|
25
25
|
|
|
26
26
|
## 1. Choose a job, not a detached task
|
|
27
27
|
|
|
28
|
-
A job plans recoverable work; each step is a grain and does the work. Use it for work that must outlive a request. It is **at-least-once**, not exactly-once: a step interrupted before a durable checkpoint can perform the same work again. Protect external effects with receiver-owned idempotency/deduplication; a checkpoint does not atomically commit an external write (`JobStep.cs
|
|
28
|
+
A job plans recoverable work; each step is a grain and does the work. Use it for work that must outlive a request. It is **at-least-once**, not exactly-once: a step interrupted before a durable checkpoint can perform the same work again. Protect external effects with receiver-owned idempotency/deduplication; a checkpoint does not atomically commit an external write (`JobStep.cs`, `JobsOptions.cs`).
|
|
29
29
|
|
|
30
|
-
- Job: derive `Job<TRequest, TJobState>`; the request is a class implementing `IJobRequest`, the state derives `JobState` (`Job.cs
|
|
31
|
-
- Step: derive `JobStep<TRequest, TResult, TState>`; state derives `JobStepState`. Its constructor receives `[PersistentState(nameof(JobStepState), WellKnownGrainStorageProviders.JobSteps)] IPersistentState<TState>`, `IJobStepThrottle`, and `ILogger<JobStep<TRequest, TResult, TState>>` (`JobStep.cs
|
|
32
|
-
- Implement `PrepareStep(TRequest)` → `Task<Result<PrepareJobStepError>>`; `InitializeState(TRequest)` → `ValueTask`, called after preparation succeeds; and `PerformStep(TState, CancellationToken)` → `Task<Catch<JobStepResult>>` (`JobStep.cs
|
|
33
|
-
- Give the concrete job and step unique `[GrainType("product-specific-name")]` names. Use serializable request/state/result types. Do not reuse a class-derived grain name across assemblies (`Jobs/JobsManager.cs
|
|
30
|
+
- Job: derive `Job<TRequest, TJobState>`; the request is a class implementing `IJobRequest`, the state derives `JobState` (`Job.cs`). Implement `PrepareSteps(TRequest)` returning `Task<IImmutableList<JobStepDetails>>` (`Job.Steps.cs`).
|
|
31
|
+
- Step: derive `JobStep<TRequest, TResult, TState>`; state derives `JobStepState`. Its constructor receives `[PersistentState(nameof(JobStepState), WellKnownGrainStorageProviders.JobSteps)] IPersistentState<TState>`, `IJobStepThrottle`, and `ILogger<JobStep<TRequest, TResult, TState>>` (`JobStep.cs`).
|
|
32
|
+
- Implement `PrepareStep(TRequest)` → `Task<Result<PrepareJobStepError>>`; `InitializeState(TRequest)` → `ValueTask`, called after preparation succeeds; and `PerformStep(TState, CancellationToken)` → `Task<Catch<JobStepResult>>` (`JobStep.cs`). `TResult` is the step's result type; the work method returns the framework's `JobStepResult` envelope, not `TResult` directly.
|
|
33
|
+
- Give the concrete job and step unique `[GrainType("product-specific-name")]` names. Use serializable request/state/result types. Do not reuse a class-derived grain name across assemblies (`Jobs/JobsManager.cs`, `Documentation/how-to/host-the-silo.md`, and `orleans.md`).
|
|
34
34
|
|
|
35
|
-
`PerformStep` runs **outside the activation context** with a state snapshot obtained through the grain reference. Mutating that snapshot does not persist it; do not access/write grain `State` directly from background work (`JobStep.cs
|
|
35
|
+
`PerformStep` runs **outside the activation context** with a state snapshot obtained through the grain reference. Mutating that snapshot does not persist it; do not access/write grain `State` directly from background work (`JobStep.cs`). Keep progress/state coordination on grain calls. Requires Cratis.Orleans 1.16.2 for framework-owned stop reporting; there, do not report cancellation again from a `PerformWork` override (`Documentation/concepts/jobs.md`).
|
|
36
36
|
|
|
37
37
|
## 2. Plan dependencies as stages
|
|
38
38
|
|
|
39
|
-
Default steps all use `JobStepStage.First`. Prefer independent fan-out. Use stages only when correctness requires earlier work to finish (`Job.Stages.cs
|
|
39
|
+
Default steps all use `JobStepStage.First`. Prefer independent fan-out. Use stages only when correctness requires earlier work to finish (`Job.Stages.cs`).
|
|
40
40
|
|
|
41
41
|
Planning excerpt inside an existing `Job<RecoveryRequest, RecoveryState>`. It assumes `RecoveryRequest : IJobRequest`, `RecoveryState : JobState`, and the two existing grain interfaces `IRepairIndex` and `IRebuildCatalog`, each deriving a typed `IJobStep<,,>`:
|
|
42
42
|
|
|
@@ -52,31 +52,31 @@ protected override Task<IImmutableList<JobStepDetails>> PrepareSteps(RecoveryReq
|
|
|
52
52
|
]);
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
Import `System.Collections.Immutable` and `Cratis.Orleans.Jobs` in that job file. `CreateStep<TStep>` takes the **grain interface**, not the implementation (`Job.Steps.cs
|
|
55
|
+
Import `System.Collections.Immutable` and `Cratis.Orleans.Jobs` in that job file. `CreateStep<TStep>` takes the **grain interface**, not the implementation (`Job.Steps.cs`). Its stage overload accepts `JobStepStage`, with implicit integer conversion (`Source/Orleans.Storage/Jobs/Stages/JobStepStage.cs`).
|
|
56
56
|
|
|
57
|
-
Every step in a stage reaches an outcome before later stages start; steps within a stage run in parallel. All steps are prepared up front, so later-stage preparation cannot read the effects of earlier-stage execution. Read such dependencies in `PerformStep` (`Job.Stages.cs
|
|
57
|
+
Every step in a stage reaches an outcome before later stages start; steps within a stage run in parallel. All steps are prepared up front, so later-stage preparation cannot read the effects of earlier-stage execution. Read such dependencies in `PerformStep` (`Job.Stages.cs`).
|
|
58
58
|
|
|
59
|
-
A failed stage stops the pipeline by default: later steps become `Unreachable`, and the job completes with failures. A best-effort stage may override `GetFailureBehaviorFor(JobStepStage)` to return `JobStageFailureBehavior.ContinueWithNextStage` (`Job.Stages.cs
|
|
59
|
+
A failed stage stops the pipeline by default: later steps become `Unreachable`, and the job completes with failures. A best-effort stage may override `GetFailureBehaviorFor(JobStepStage)` to return `JobStageFailureBehavior.ContinueWithNextStage` (`Job.Stages.cs`, namespace `Cratis.Orleans.Jobs.Stages`). Do not silently continue when a later stage relies on the failed output.
|
|
60
60
|
|
|
61
61
|
## 3. Start and resume through the scoped manager
|
|
62
62
|
|
|
63
|
-
`IGrainFactory.GetJobsManager(scope, namespace)` resolves the manager (`JobsManagerExtensions.cs
|
|
63
|
+
`IGrainFactory.GetJobsManager(scope, namespace)` resolves the manager (`JobsManagerExtensions.cs`). `IJobsManager.Start<TJob,TRequest>(request)` returns `Result<JobId, StartJobError>`; inspect its error before telling a caller that a job started (`IJobsManager.cs`). Start success is not completed work; observe the job's status/outcomes.
|
|
64
64
|
|
|
65
|
-
`IJobsManager.Resume(JobId)` returns **`Task<bool>`**. False means nothing took the job; do not wait for a completion callback as though resumption succeeded. True can mean resumed, already running, or finalized as completed (`IJobsManager.cs
|
|
65
|
+
`IJobsManager.Resume(JobId)` returns **`Task<bool>`**. False means nothing took the job; do not wait for a completion callback as though resumption succeeded. True can mean resumed, already running, or finalized as completed (`IJobsManager.cs`). `Rehydrate()` completes after loading/preparing interrupted jobs, **before** its bounded background drain has resumed them all.
|
|
66
66
|
|
|
67
|
-
`StartStepsInBackground` defaults to false. Overriding it to true makes Start return once the job is durable, moving step preparation/start to the grain's next turn. Later startup errors belong to the job, not the Start response (`Job.cs
|
|
67
|
+
`StartStepsInBackground` defaults to false. Overriding it to true makes Start return once the job is durable, moving step preparation/start to the grain's next turn. Later startup errors belong to the job, not the Start response (`Job.cs`).
|
|
68
68
|
|
|
69
69
|
## 4. Know what storage retains
|
|
70
70
|
|
|
71
|
-
Successful jobs clear themselves by default; override `KeepAfterCompleted` to retain job state. Jobs completed with failures default to `KeepAfterCompletedWithFailures = true`, but retention cleanup still applies (`Job.cs
|
|
71
|
+
Successful jobs clear themselves by default; override `KeepAfterCompleted` to retain job state. Jobs completed with failures default to `KeepAfterCompletedWithFailures = true`, but retention cleanup still applies (`Job.cs`, `JobsOptions.cs`).
|
|
72
72
|
|
|
73
|
-
**Keeping a job does not keep successful step state.** The step provider deletes successful/removing state, moves failed state to failed-step storage, and saves stopped/scheduled/running/unreachable state (`JobStepGrainStorageProvider.cs
|
|
73
|
+
**Keeping a job does not keep successful step state.** The step provider deletes successful/removing state, moves failed state to failed-step storage, and saves stopped/scheduled/running/unreachable state (`JobStepGrainStorageProvider.cs`). SQL keeps failed step rows with a failure status rather than a separate collection (`Source/Orleans.Storage.Sql/Jobs/JobStepStorage.cs`, `MoveToFailed`). Copy results the job must retain through `OnStepCompletedOrStopped(JobStepId, JobStepResult)` into job state (`Job.Steps.cs`); do not read deleted successful step state later.
|
|
74
74
|
|
|
75
|
-
Deliver external callbacks to a method on the **job's grain interface**, update job state there and persist it with `WriteState()`. Preserve the returned `Catch` failure; do not acknowledge input whose write failed (`Job.State.cs
|
|
75
|
+
Deliver external callbacks to a method on the **job's grain interface**, update job state there and persist it with `WriteState()`. Preserve the returned `Catch` failure; do not acknowledge input whose write failed (`Job.State.cs`, `WriteState`; `Documentation/concepts/jobs.md`). Step state is not a callback inbox: a concurrent callback can race the final write, and successful completion deletes it. A running step's snapshot will not see later job/step writes automatically.
|
|
76
76
|
|
|
77
77
|
## 5. Register storage and budget concurrency
|
|
78
78
|
|
|
79
|
-
`IJobsStorage.GetFor(scope, namespace)` returns `JobsStorage`. Scope and namespace are opaque engine coordinates carried in grain keys; the host/provider owns their mapping (`Source/Orleans.Storage/Jobs/IJobsStorage.cs`, `Job.cs
|
|
79
|
+
`IJobsStorage.GetFor(scope, namespace)` returns `JobsStorage`. Scope and namespace are opaque engine coordinates carried in grain keys; the host/provider owns their mapping (`Source/Orleans.Storage/Jobs/IJobsStorage.cs`, `Job.cs`). They are storage boundaries, not authorization checks.
|
|
80
80
|
|
|
81
81
|
Choose one storage registration alongside `AddCratisOrleans`:
|
|
82
82
|
|
|
@@ -86,11 +86,11 @@ Choose one storage registration alongside `AddCratisOrleans`:
|
|
|
86
86
|
| `AddCratisOrleansSqlJobsStorage` | `.Storage.Sql` / `Cratis.Orleans.Setup` | Durable EF Core; `OptionsResolver(scope, namespace)` selects typed `DbContextOptions<JobsDbContext>` |
|
|
87
87
|
| `AddCratisOrleansInMemoryJobsStorage` | `.Storage` / `Cratis.Orleans.Storage` | Specs/development only; process restart loses state |
|
|
88
88
|
|
|
89
|
-
Evidence: each package's `*JobsStorageServiceCollectionExtensions.cs`; MongoDB `DatabaseNames.cs` and `MongoDBJobsStorageOptions.cs`; SQL `SqlJobsStorageOptions.cs
|
|
89
|
+
Evidence: each package's `*JobsStorageServiceCollectionExtensions.cs`; MongoDB `DatabaseNames.cs` and `MongoDBJobsStorageOptions.cs`; SQL `SqlJobsStorageOptions.cs`; in-memory `InMemory/InMemoryJobsStorage.cs`.
|
|
90
90
|
|
|
91
|
-
### SQL schema
|
|
91
|
+
### SQL schema creation
|
|
92
92
|
|
|
93
|
-
The product's SQL setup docs say to create the schema yourself. **
|
|
93
|
+
The product's SQL setup docs say to create the schema yourself. **the provider applies migrations automatically**: `SqlJobsStorage.GetFor` calls `EnsureSchema`, which calls `dbContext.Database.Migrate()` before constructing storage (`Source/Orleans.Storage.Sql/SqlJobsStorage.cs`). The migration is `Jobs/Migrations/v1_0_0.cs`; do not substitute `EnsureCreated` or hand-create those tables. The connection needs permissions to apply the migration, and scope-to-database mapping must be deliberate. Storage is cached per scope/namespace; `IJobsStorage.Reset()` clears the cache and the next resolution migrates again (`SqlJobsStorage.cs`). This resolves the documentation conflict from source, not from a release-note inference.
|
|
94
94
|
|
|
95
95
|
Configure `JobsOptions` through the host's options registration. Its properties are **init-only**: supply a constructed instance via the options mechanism rather than assigning them in a `Configure(options => options.Property = …)` callback (`JobsOptions.cs`).
|
|
96
96
|
|
|
@@ -106,7 +106,7 @@ Configure `JobsOptions` through the host's options registration. Its properties
|
|
|
106
106
|
| `TerminalJobRetention` | `7 days` | Terminal history retention; `Timeout.InfiniteTimeSpan` retains indefinitely |
|
|
107
107
|
| `MaxTerminalJobsPerCleanup` | `100` | Bounded oldest-first cleanup page |
|
|
108
108
|
|
|
109
|
-
Source: `JobsOptions.cs
|
|
109
|
+
Source: `JobsOptions.cs`. The three concurrency options for starts/rehydration/cleanup treat values below one as one. Retention does not delete preparing/running/stopped/removing jobs. Larger checkpoint intervals mean more post-crash redelivery, not higher delivery guarantees.
|
|
110
110
|
|
|
111
111
|
## State machines and verification
|
|
112
112
|
|