@cratis/pi 8.13.0 → 8.15.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/skills/cratis-code-review/SKILL.md +1 -1
- package/package/corpus/skills/cratis-components-diagnose-screen/SKILL.md +1 -1
- package/package/corpus/skills/cratis-components-theme-application/SKILL.md +5 -2
- package/package/corpus/skills/cratis-migrate-arc-22-to-23/SKILL.md +59 -0
- package/package/corpus/skills/cratis-migrate-arc-22-to-23/references/csharp.md +121 -0
- package/package/corpus/skills/cratis-migrate-arc-23-to-24/SKILL.md +60 -0
- package/package/corpus/skills/cratis-migrate-arc-23-to-24/references/csharp.md +91 -0
- package/package/corpus/skills/cratis-migrate-arc-23-to-24/references/typescript.md +26 -0
- package/package/corpus/skills/cratis-migrate-components-3-to-4/SKILL.md +72 -0
- package/package/corpus/skills/cratis-migrate-components-3-to-4/references/typescript.md +137 -0
- package/package/corpus/skills/cratis-platform-upgrade-application/SKILL.md +2 -2
- package/package/corpus/skills/cratis-platform-upgrade-application/references/typescript.md +1 -1
- package/package/corpus/skills/cratis-specifications-exercise-backend/SKILL.md +1 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-command-results.md +34 -1
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-decision-reads.md +4 -7
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-query-scenario.md +7 -8
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-read-models.md +1 -1
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp.md +25 -3
- package/package/corpus/skills/cratis-specifications-observe-ui/SKILL.md +20 -0
- package/package/corpus/skills/cratis-specifications-observe-ui/references/typescript.md +17 -0
- package/package/corpus/skills/cratis-specifications-test-application-ui/SKILL.md +9 -2
- package/package/corpus/skills/cratis-specifications-test-application-ui/references/typescript.md +45 -1
- package/package/corpus/skills/cratis-specifications-test-typescript-behavior/SKILL.md +21 -0
- package/package/corpus/skills/cratis-specifications-test-typescript-behavior/references/typescript.md +58 -3
- package/package/profile-catalog.json +78 -0
- package/package.json +1 -1
- package/package/corpus/skills/cratis-components-theme-application/references/upgrade-from-previous-major.md +0 -141
|
@@ -44,7 +44,7 @@ in the findings that matter:
|
|
|
44
44
|
| A focused Chronicle, database, backend or frontend scalability analysis | `cratis-performance-review`; the performance items here are only those visible in passing, so do not duplicate its findings when both ran |
|
|
45
45
|
| Scheduling review passes, rounds and re-reviews | `cratis-engineering-review-rounds` |
|
|
46
46
|
| Reviewing the model itself | `cratis-modeling-review-event-model` |
|
|
47
|
-
| The change raises or pins Cratis packages, tools or images | Also read `cratis-platform-upgrade-application` for version pairing, pinning and upgrade order, and `cratis
|
|
47
|
+
| The change raises or pins Cratis packages, tools or images | Also read `cratis-platform-upgrade-application` for version pairing, pinning and upgrade order, and the matching `cratis/migrate/components-<from>-to-<to>` profile when it crosses a Components major |
|
|
48
48
|
|
|
49
49
|
## How gates and review divide the work
|
|
50
50
|
|
|
@@ -41,7 +41,7 @@ A screen works when three independent things work. Decide which one failed befor
|
|
|
41
41
|
| Symptom | First check | Then |
|
|
42
42
|
| --- | --- | --- |
|
|
43
43
|
| A generated command or query import is missing | The backend slice exists, builds, and proxy generation has run. Never hand-write the command or query class. | `cratis-arc-generate-proxies` |
|
|
44
|
-
| A component import from the package root does not compile | The package root is setup-only (provider, configuration, messages, icons). Import each component from its own subpath. | `cratis-
|
|
44
|
+
| A component import from the package root does not compile | The package root is setup-only (provider, configuration, messages, icons). Import each component from its own subpath. | `cratis-platform-upgrade-application` (the matching `cratis/migrate/components-<from>-to-<to>` profile) |
|
|
45
45
|
| Type check rejects a stylesheet import | The package stylesheets are imported from TypeScript. Import them from one local CSS file instead. | `cratis-components-theme-application` |
|
|
46
46
|
| Components render unstyled | One local CSS file imports `@cratis/components/tokens`, then `@cratis/components/styles`, and the application entry imports that file once. | `cratis-components-theme-application` |
|
|
47
47
|
| Product CSS loses to Components styles | The product stylesheet loads after the package imports. Unlayered product CSS beats the layered structural rules whatever its specificity; a product with its own cascade layers must declare the layer order. The token and theme defaults are unlayered too, so an override of those wins only on equal or higher selector specificity and later order. Confirm which rule won in the inspector's computed styles. | `cratis-components-theme-application`, Cascade layers |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cratis-components-theme-application
|
|
3
|
-
description: Use when wiring Cratis Components CSS (tokens, structural styles, baseline theme, per-area sheets, Designsystemet bridge), branding or replacing the palette through `--cratis-*` tokens, switching light/dark or theming a subtree, styling component parts, configuring `CratisComponentsProvider` (locale, messages, icons, router, dialog header actions, toaster, overlay container) selecting a renderer adapter, authoring one for another design system
|
|
3
|
+
description: Use when wiring Cratis Components CSS (tokens, structural styles, baseline theme, per-area sheets, Designsystemet bridge), branding or replacing the palette through `--cratis-*` tokens, switching light/dark or theming a subtree, styling component parts, configuring `CratisComponentsProvider` (locale, messages, icons, router, dialog header actions, toaster, overlay container) selecting a renderer adapter, or authoring one for another design system. Not for keyboard and ARIA semantics (`cratis-components-accessibility`), raising toasts or busy feedback (`cratis-components-coordinate-feedback`), choosing which control to render (`cratis-components-choose-control`), or upgrading an application across a Components major (`cratis-platform-upgrade-application`).
|
|
4
4
|
compatibility: Requires @cratis/components and a CSS bundler that resolves package imports.
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -18,7 +18,9 @@ compatibility: Requires @cratis/components and a CSS bundler that resolves packa
|
|
|
18
18
|
|
|
19
19
|
Cratis Components splits appearance into three package stylesheets and one runtime provider. `tokens` declares the semantic `--cratis-*` CSS variables with light defaults. `styles` holds component structure and interaction-state rules. The optional `theme` adds document colors, dark mode, forced-colors values and themed subtrees. `CratisComponentsProvider` carries locale, labels, icons, routing, dialog header actions, the toast region and renderer selection. It loads no CSS. Product styling goes through tokens and stable parts, never through internal markup.
|
|
20
20
|
|
|
21
|
-
Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Node server `package.json` → typescript, `*.kt` → kotlin, `*.java` → java, `go.mod` → go, `mix.exs` → elixir); only the project's languages are installed. Cratis Components is React-only, so its imports and examples are in the typescript reference whatever SDK the backend uses. Language-neutral references: [tokens](references/tokens.md) (every `--cratis-*` variable), [palette](references/palette.md) (selector blocks for palette overrides), [parts](references/parts.md) (every stable part and its states), [renderer adapters](references/renderer-adapters.md) (adapter coverage and setup)
|
|
21
|
+
Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Node server `package.json` → typescript, `*.kt` → kotlin, `*.java` → java, `go.mod` → go, `mix.exs` → elixir); only the project's languages are installed. Cratis Components is React-only, so its imports and examples are in the typescript reference whatever SDK the backend uses. Language-neutral references: [tokens](references/tokens.md) (every `--cratis-*` variable), [palette](references/palette.md) (selector blocks for palette overrides), [parts](references/parts.md) (every stable part and its states), [renderer adapters](references/renderer-adapters.md) (adapter coverage and setup) and [localization](references/localization.md) (read for UI language, label translations and formats). Names in examples are illustrative.
|
|
22
|
+
|
|
23
|
+
Major upgrades: see `cratis-platform-upgrade-application` for the migration profile.
|
|
22
24
|
|
|
23
25
|
## How it works
|
|
24
26
|
|
|
@@ -145,3 +147,4 @@ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Nod
|
|
|
145
147
|
- `cratis-components-accessibility`
|
|
146
148
|
- `cratis-components-coordinate-feedback`
|
|
147
149
|
- `cratis-components-choose-control`
|
|
150
|
+
- `cratis-platform-upgrade-application`
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cratis-migrate-arc-22-to-23
|
|
3
|
+
description: Use when upgrading a C# application from Cratis Arc 22 to Arc 23, including commands that start failing with a read-protection refusal, `CommandReadModelKeysMissing` or `ProtectedReadModelKeyAccessorMissing` after raising `Cratis` or `Cratis.Arc.*`, and a host that no longer compiles on `McpToolCeiling` or `McpRequiresGatedEndpoints`. Not for other Arc majors, new applications (`cratis-platform-start-application`) or the general upgrade loop of versions, kernel order and deployment (`cratis-platform-upgrade-application`).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Move a C# application from Arc 22 to Arc 23
|
|
7
|
+
|
|
8
|
+
Temporary guidance for one upgrade. Reinstall the AI corpus without this profile once the upgrade is merged. Run it inside the loop of `cratis-platform-upgrade-application`, which owns version pairing, kernel order and deployment.
|
|
9
|
+
|
|
10
|
+
## What changed
|
|
11
|
+
|
|
12
|
+
Moving to the latest Arc 23 release turns two protective options on by default for applications that use Arc with Chronicle, and renames part of the MCP hosting API. The npm packages have no change that breaks a build.
|
|
13
|
+
|
|
14
|
+
| Symptom | Cause | Who is affected |
|
|
15
|
+
| --- | --- | --- |
|
|
16
|
+
| A command that injects a read model is refused, fails on a concurrent change it used to survive, or stops the host at startup | Read protection is `On` for every project that reaches `Cratis.Arc.Chronicle` (directly, through `Cratis` or through a project reference) and does not set `<CratisReadProtection>`. Arc 22 ran such projects as `Off` | Projects with commands, validators, `Provide()` or `Handle()` that take read models and declare no mode |
|
|
17
|
+
| `CommandReadModelKeysMissing` at startup or on the first command | Key lookup needs the metadata the Arc source generator emits; the reflection fallback is off unless `ReadProtection:RequireGeneratedMetadata` is `false` | Every command under `On` that the generator skips, such as a partial command, whether or not it takes a read model; in any mode, a command with a `[LookUpBy]` parameter |
|
|
18
|
+
| `ProtectedReadModelKeyAccessorMissing` at startup or HTTP 500 during command execution | `ProtectedReadModelKeyOptions.Strict` is `true`: a composite key type needs generated or registered accessors | Commands under `On` whose key is a record or class of several parts that the generator cannot cover |
|
|
19
|
+
| A command spec gets `null` for a read model it used to receive | A replaced or substituted `IReadModels` no longer supplies state to a protected read | Command scenarios that arrange state through a replacement reader |
|
|
20
|
+
| Compile error on `McpToolCeiling` or `McpRequiresGatedEndpoints` | `McpToolCeiling` is `McpToolCatalog`, with no forwarder. `McpRequiresGatedEndpoints` is gone, because MCP no longer needs `CapabilitiesOptions.GatedEndpoints` | Hosts that name either type |
|
|
21
|
+
| Obsolete warning (an error with warnings as errors) on `MapCratisArcMcp`, string `ExposeQuery`, `TenancyOptions.DevelopmentTenantId`, `IntrospectionOptions.TrustForwardedIdentityHeaders` or `HostBuilderExtensions.DefaultArcSectionPaths` | Each has a replacement. The MCP messages say the old form goes in Arc 24; it still compiles there, so treat it as a warning to clear now, not a deadline | Hosts that call them |
|
|
22
|
+
| Header tenancy resolves no tenant | A tenant header with several comma-separated values resolves only when all values are equal | Deployments whose ingress appends to the tenant header instead of replacing it |
|
|
23
|
+
| Subscribing to an observable query over server-sent events returns 404 for a signed-in caller | The connection is owned by the caller's name identifier, subject or name; a caller with none of them cannot manage subscriptions | Applications whose principals carry no such claim |
|
|
24
|
+
| A validator's `WhenCommand()` and `WhenQuery()` rules swap on an MVC action | PUT, PATCH and DELETE count as command validation, as POST does | MVC controllers with those verbs and such rules |
|
|
25
|
+
| A React form shows a validation message twice | `CommandForm` renders a summary for failures no field displays | Forms that already render their own summary |
|
|
26
|
+
|
|
27
|
+
An application without Chronicle, MCP hosting or any row above has nothing to change beyond the version raise.
|
|
28
|
+
|
|
29
|
+
## Inventory before the bump
|
|
30
|
+
|
|
31
|
+
1. List the versions of `Cratis`, `Cratis.Arc.*` and `@cratis/arc*` in every project file, `Directory.Packages.props` and `package.json`.
|
|
32
|
+
2. List every project that holds commands and whether it sets `<CratisReadProtection>`. In each one without it, list the commands and validators that take a read model, and the commands marked `[ReadProtection]` or `[Unprotected]`.
|
|
33
|
+
3. List every command declared `partial`, private, generic or with a base type from another assembly, every read-model key type that is a record or class with more than one property, and every command spec that replaces or substitutes `IReadModels`.
|
|
34
|
+
4. For an MCP host, list the calls to `MapCratisArcMcp` and `ExposeQuery`, the uses of `McpToolCeiling` and `McpRequiresGatedEndpoints`, and the `GatedEndpoints` selection.
|
|
35
|
+
5. Run the specs and save the result. Done when the lists exist and the specs pass on Arc 22.
|
|
36
|
+
|
|
37
|
+
## Order
|
|
38
|
+
|
|
39
|
+
Read `references/<language>.md` for the application's backend (`.csproj` → csharp) before step 1; this profile installs only the C# reference, because the breaking changes are in the .NET packages.
|
|
40
|
+
|
|
41
|
+
1. **Pin the mode.** Set `<CratisReadProtection>Off</CratisReadProtection>` in every project from inventory step 2 that declares none. This is what Arc 22 did implicitly, so nothing changes yet. Done when the specs still pass.
|
|
42
|
+
2. **Raise the packages.** Raise every Arc package, NuGet and npm, to the latest Arc 23 release in one change, as `cratis-platform-upgrade-application` describes. Done when `dotnet restore` succeeds.
|
|
43
|
+
3. **Fix the MCP host and the obsolete calls** with the replacements in the reference. Done when the solution builds without obsolete warnings from Arc.
|
|
44
|
+
4. **Adopt read protection, one project at a time.** Change `Off` to `Measure`, run the specs and the application, fix what is reported, then remove the property so the project takes the default `On`. Choose to stop at `Off` only when the upgrade must ship without behavior changes; record the adoption as open work, because `Off` leaves every decision unguarded. Done when each project is on `On`, or its `Off` has a recorded reason.
|
|
45
|
+
5. **Cover the keys.** For each project on `On`, clear the generator and accessor failures as the reference describes. Done when the host starts and every command has run once without either exception.
|
|
46
|
+
6. **Rebuild and regenerate the proxies** as `cratis-platform-upgrade-application` describes.
|
|
47
|
+
|
|
48
|
+
## Verify
|
|
49
|
+
|
|
50
|
+
1. `dotnet build` with warnings as errors, then run the specs. Done when both pass, with command state arranged through the scenario's own `Given`.
|
|
51
|
+
2. Start the host with its real configuration. Done when startup reports no refused read-model parameter and no command whose mode was lowered.
|
|
52
|
+
3. Run each command that takes a read model. Under `On`, also test a valid key with no instance for a required protected parameter: expect a `rule` validation result and HTTP 400. A nullable protected parameter receives `null`.
|
|
53
|
+
4. For an MCP host, request `/mcp` and one other route on the capabilities port without credentials. Done when `/mcp` is refused and the other route answers as its gate selection intends.
|
|
54
|
+
5. For the tenancy, server-sent-events, MVC and form rows that apply, repeat the affected request and compare with the Arc 22 result.
|
|
55
|
+
6. Arc 23 brings a newer Chronicle client; apply the kernel order from `cratis-platform-upgrade-application`. Read protection changes how commands read and append, not stored events, so it calls for no replay.
|
|
56
|
+
|
|
57
|
+
## Finish
|
|
58
|
+
|
|
59
|
+
Merge the upgrade, then reinstall the AI corpus with the previous profile list: `cratis ai install --profiles <previous> --harnesses <previous> --languages <previous>`. Done when `.cratis/ai.json` no longer lists `cratis/migrate/arc-22-to-23` and this skill is gone.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Arc 22 to Arc 23 in a C# application
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Pin the mode
|
|
6
|
+
- Adopt read protection
|
|
7
|
+
- Generated key metadata
|
|
8
|
+
- Composite key accessors
|
|
9
|
+
- Command specs
|
|
10
|
+
- MCP host
|
|
11
|
+
- Obsolete names
|
|
12
|
+
- Recovery
|
|
13
|
+
|
|
14
|
+
## Pin the mode
|
|
15
|
+
|
|
16
|
+
Prerequisite: the inventory from the skill is done and the packages are on the latest Arc 23 release, except for "Pin the mode", which is done on Arc 22.
|
|
17
|
+
|
|
18
|
+
Set the mode in the project file, or in a `Directory.Build.props` that covers the project:
|
|
19
|
+
|
|
20
|
+
```xml
|
|
21
|
+
<PropertyGroup>
|
|
22
|
+
<CratisReadProtection>Off</CratisReadProtection>
|
|
23
|
+
</PropertyGroup>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The value is `Off`, `Measure` or `On`; any other value fails the build. It applies to the commands declared in that project. A declaration on the command wins over the project: `[ReadProtection(ReadProtectionMode.Off)]`, `[ReadProtection(ReadProtectionMode.On)]`, or `[Unprotected("why")]`, which means `Off` for that command.
|
|
27
|
+
|
|
28
|
+
## Adopt read protection
|
|
29
|
+
|
|
30
|
+
Under `On`, Arc reads each supported read-model parameter fresh from its events, guards the append against what the command read, and refuses reads it cannot guard. A guarded read costs more for a key with a long history, because it folds that history instead of returning stored state.
|
|
31
|
+
|
|
32
|
+
1. Set `<CratisReadProtection>Measure</CratisReadProtection>` and run the specs and the application. `Measure` changes no outcome; it records what `On` would do.
|
|
33
|
+
2. Read the counter `cratis.arc.read_protection.events` on the meter `Cratis.Arc.ReadProtection`, grouped by its `category` and `command` tags. The same data appears as Warning log entries and as `read-protection.plan` span events.
|
|
34
|
+
3. Fix each category that needs it:
|
|
35
|
+
|
|
36
|
+
| Category | Fix |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| `refused_read` | The `reason` tag names the cause. Change the model to a shape that can be guarded (a flat projection keyed by the event source, or a reducer without an event filter or constructor dependencies), take the model as a parameter instead of calling `IReadModels`, or declare the read advisory |
|
|
39
|
+
| `redirect` | `On` would select a different key. Add `[LookUpBy(nameof(Command.Property))]` to the parameter |
|
|
40
|
+
| `immediate_append` | Return the event from `Handle()` instead of appending through `IEventLog` |
|
|
41
|
+
| `scope_refusal`, `displacement` | Widen or remove the explicit concurrency scope beside the read |
|
|
42
|
+
|
|
43
|
+
A read that may be stale is declared with `[Unprotected("why")]` on the parameter, the read-model type, or the `Handle()` or `Provide()` method whose body reads. Write the real reason; it is reported.
|
|
44
|
+
|
|
45
|
+
4. Build and clear the warnings ARCCHR0024 (shape cannot be protected), ARCCHR0028 (read not proven protected) and ARCCHR0033 (aggregate and read model on the same key).
|
|
46
|
+
5. Remove the property so the project takes `On`, and run the specs.
|
|
47
|
+
|
|
48
|
+
Under `On`, a required read-model parameter whose instance does not exist fails the command with a validation result (reason `rule`, message `{ReadModel} does not exist.`, HTTP 400). A nullable parameter receives `null`. A validator must be registered by convention discovery; one that Arc did not construct for the command is refused under `On`.
|
|
49
|
+
|
|
50
|
+
Startup checks the declared parameter shapes after the application has started and stops the host on a refusal under `On`. `ReadProtection:StartupAdmissionCheck` set to `Log` reports without stopping. To back out in production without a build, set `ReadProtection:MaximumMode` to `Measure` or `Off`; it only lowers the mode and is logged per command at startup. Both keys are also read under `Cratis:Arc:ReadProtection`.
|
|
51
|
+
|
|
52
|
+
## Generated key metadata
|
|
53
|
+
|
|
54
|
+
`CommandReadModelKeysMissing` names a command or read-model type for which the Arc source generator emitted no key metadata. At startup Arc checks every command whose mode is `On`, whether or not it takes a read model. The generator ships in the Arc packages as an analyzer, runs in the project that declares the type, and reaches a project through project references too. Check, in this order:
|
|
55
|
+
|
|
56
|
+
1. The named command is a non-partial, accessible type declared in the application's own project. The generator skips partial types, private and file-local types, generic definitions, types with a base type from another assembly, and commands with a public property whose getter is obsolete or experimental or whose type is inaccessible. The informational diagnostic ARC0031 marks each skipped command; raise its severity in `.editorconfig` to see it in the build output.
|
|
57
|
+
2. No package or project reference on the path to the Arc packages removes `analyzers` through `ExcludeAssets`, `IncludeAssets` or `PrivateAssets`.
|
|
58
|
+
3. The assembly is not marked with `System.Diagnostics.CodeAnalysis.ExperimentalAttribute`; the generator skips such an assembly.
|
|
59
|
+
|
|
60
|
+
Done when the host starts and the command runs. Only if the type must keep a skipped shape, keep the reflection lookup by setting `ReadProtection:RequireGeneratedMetadata` to `false` in configuration. Arc then logs one warning per type. The opt-out has no effect on a runtime without dynamic code, such as Native AOT.
|
|
61
|
+
|
|
62
|
+
## Composite key accessors
|
|
63
|
+
|
|
64
|
+
`ProtectedReadModelKeyAccessorMissing` names a key type made of several parts for which no accessors exist. The generator covers types it can see completely. The informational diagnostic ARC0030 marks the ones it cannot: partial types, types or base types from another assembly, and types with hidden or overridden members. Register those before the host is built, with every public readable instance property, inherited ones included:
|
|
65
|
+
|
|
66
|
+
```csharp
|
|
67
|
+
using Cratis.Arc.Chronicle.ReadModels;
|
|
68
|
+
|
|
69
|
+
ProtectedReadModelKeyAccessors.Register<WarehouseKey>(
|
|
70
|
+
new(nameof(WarehouseKey.Warehouse), key => key.Warehouse),
|
|
71
|
+
new(nameof(WarehouseKey.Section), key => key.Section));
|
|
72
|
+
|
|
73
|
+
public partial record WarehouseKey(string Warehouse, string Section);
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Register each concrete derived type separately. Registering a type twice throws `ProtectedReadModelKeyAccessorsAlreadyRegistered`. Done when the command that uses the key runs.
|
|
77
|
+
|
|
78
|
+
Only on a runtime that supports dynamic code can `Strict = false` restore the reflection fallback; under Native AOT, register the accessors. Use the fallback only when a key type cannot be registered; a property left out of a registration weakens the check, and so does the fallback:
|
|
79
|
+
|
|
80
|
+
```csharp
|
|
81
|
+
builder.Services.Configure<ProtectedReadModelKeyOptions>(options => options.Strict = false);
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Command specs
|
|
85
|
+
|
|
86
|
+
Replace state arranged through a replaced or substituted `IReadModels` with the command scenario's own `Given`:
|
|
87
|
+
|
|
88
|
+
```csharp
|
|
89
|
+
_scenario.Given.ForEventSource(id).ReadModel(instance);
|
|
90
|
+
_scenario.Given.ForEventSource(id).Events(new MoneyDeposited(100m));
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Use `ReadModel` when the case needs a known value and `Events` when the history matters. A plain `new CommandScenario<TCommand>()` selects the right log from the command's mode; an untyped `CommandScenario<object>` calls `EnableDecisionReads()`. Done when the spec passes without a replacement reader.
|
|
94
|
+
|
|
95
|
+
## MCP host
|
|
96
|
+
|
|
97
|
+
| Arc 22 | Arc 23 |
|
|
98
|
+
| --- | --- |
|
|
99
|
+
| `app.MapCratisArcMcp()` | `app.MapArcMcp()` |
|
|
100
|
+
| `ExposeQuery("Namespace.ReadModel.Method", name, description)` | `ExposeQuery<ReadModel>(nameof(ReadModel.Method), name, description)`, which throws `ArgumentException` when the read model has no such method, or `[ExposeOverMcp]` on the query |
|
|
101
|
+
| `McpToolCeiling` | `McpToolCatalog`, same members |
|
|
102
|
+
| `catch (McpRequiresGatedEndpoints)` | Remove; the type no longer exists |
|
|
103
|
+
|
|
104
|
+
The old `MapCratisArcMcp` and string `ExposeQuery` still work and only warn.
|
|
105
|
+
|
|
106
|
+
Arc 22 required `CapabilitiesOptions.GatedEndpoints` for MCP, so the host has a selection. Keep it and nothing changes: `WithMcp` adds the MCP endpoint to it. Remove it only if every route on the capabilities port may require a verified caller. With no selection, the whole port is gated and only the OAuth protected resource metadata route answers without one, so a health probe on that port starts returning 401. Move such a route to another port, or keep the selection.
|
|
107
|
+
|
|
108
|
+
## Obsolete names
|
|
109
|
+
|
|
110
|
+
| Obsolete | Use |
|
|
111
|
+
| --- | --- |
|
|
112
|
+
| `TenancyOptions.DevelopmentTenantId` | `TenancyOptions.FixedTenantId`, key `Cratis:Arc:Tenancy:FixedTenantId` |
|
|
113
|
+
| `IntrospectionOptions.TrustForwardedIdentityHeaders` | `ArcOptions.TrustForwardedIdentityHeaders`, key `Cratis:Arc:TrustForwardedIdentityHeaders`, which applies to every request |
|
|
114
|
+
| `Microsoft.Extensions.Hosting.HostBuilderExtensions.DefaultArcSectionPaths` | `Cratis.Arc.HostBuilderExtensions.DefaultSectionPaths` |
|
|
115
|
+
|
|
116
|
+
## Recovery
|
|
117
|
+
|
|
118
|
+
- A command is refused and the cause is unclear: set that project back to `Measure` and read the `reason` tag of its `refused_read` entries.
|
|
119
|
+
- Header tenancy resolves no tenant: make the ingress remove every incoming tenant header and set exactly one value. A tenant identifier that contains a comma cannot be sent in the header.
|
|
120
|
+
- Server-sent-event subscriptions return 404 for signed-in callers: issue a name identifier, subject or name claim to the principal.
|
|
121
|
+
- A form shows a message twice: remove the application's own summary, or pass `validationSummaryComponent={() => null}` to `CommandForm`.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cratis-migrate-arc-23-to-24
|
|
3
|
+
description: Use when upgrading a C# application, with or without a TypeScript frontend, from Cratis Arc 23 to Arc 24, including a build that no longer finds the `Cratis.Choreography.Availability` namespace or reports obsolete `[AvailableFor("...")]` and `[AvailableWith("...")]` after raising `Cratis.Arc.*`, and a client that reads `key` or `conflictingEvent...` from a refused command. Not for other Arc majors, new applications (`cratis-platform-start-application`) or the general upgrade loop of versions, kernel order and deployment (`cratis-platform-upgrade-application`).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Move an application from Arc 23 to Arc 24
|
|
7
|
+
|
|
8
|
+
Temporary guidance for one upgrade. Reinstall the AI corpus without this profile once the upgrade is merged. Run it inside the loop of `cratis-platform-upgrade-application`, which owns version pairing, kernel order and deployment.
|
|
9
|
+
|
|
10
|
+
## What changed
|
|
11
|
+
|
|
12
|
+
Moving to the latest Arc 24 release brings two groups of changes that can break an application. The first applies to clients and specs that read the details of a command refused because a read it depended on changed. The second applies to hosts that reference `Cratis.Arc.Availability`.
|
|
13
|
+
|
|
14
|
+
| Symptom | Cause | Who is affected |
|
|
15
|
+
| --- | --- | --- |
|
|
16
|
+
| Client code or a spec finds no `key`, `conflictingEventTypeId`, `conflictingEventType` or `conflictingEventSequenceNumber` on a refused command, or a message no longer names an event type and sequence number | A validation result with reason `concurrencyViolation` and detail `ReadChanged` now carries only `readModel` in its `state`, and its message no longer names an event type or sequence number | Applications that use the Arc Chronicle integration with protected decision reads and read that state or assert on that message |
|
|
17
|
+
| The build reports that the namespace `Cratis.Choreography.Availability` does not exist, or that `ChoreographyContextValueSource` is not found | The availability engine moved into `Cratis.Arc.Availability`, which no longer depends on `Cratis.Choreography`. The engine types are in `Cratis.Arc.Availability`, `Cratis.Arc.Availability.Audiences` and `Cratis.Arc.Availability.Context`, and `ChoreographyContextValueSource` is `AvailabilityContextValueSource` | Hosts that reference `Cratis.Arc.Availability` |
|
|
18
|
+
| The build reports a type mismatch between `Cratis.Choreography.Availability` and `Cratis.Arc.Availability` types, or the application's audience source is never asked and every gated part is refused | The host also references `Cratis.Choreography` 2.10 or earlier, which has its own copy of the engine. Arc resolves only the Arc types | Hosts that reference both `Cratis.Arc.Availability` and `Cratis.Choreography` |
|
|
19
|
+
| Obsolete warnings, which fail a build that treats warnings as errors, on `[AvailableFor("...")]`, `[AvailableWith("...")]`, `AvailabilityExpression.For`, `With`, `When`, `AllOf`, `AnyOf` and `GateNamespace` | Availability is declared with types. The string forms still work in Arc 24 | Hosts that gate parts with the string forms |
|
|
20
|
+
| Parts that were served are refused as not available after the raise | Availability configured with `AddArcAvailability` was discarded when `AddCratis()` ran first, so gates were lost and parts were served. The configured gates now apply in either order | Hosts that call `AddCratis()` before `AddArcAvailability` |
|
|
21
|
+
| The host stops at startup on an undefined or circular availability | Startup now verifies that every block built on another is defined and that no blocks build on each other in a cycle | Hosts with such a block in their `AvailabilityCatalog` |
|
|
22
|
+
| A context value resolves for a part where it was absent, or another declaration of the same name wins | A part now runs in the context scope of its namespace by default. It ran in the application scope | Hosts that declare context values at a scope below the application and do not set `ScopeFor` |
|
|
23
|
+
| `IAvailabilityGate.IsGated` answers true for parts that carry no gate | Any part can be suspended, so every part has to be decided | Application code that calls `IsGated` to find the gated parts |
|
|
24
|
+
| A `switch` over `AvailabilityVerdict` is no longer exhaustive | The verdict `Suspended` was added, reported to clients with the reason `Suspended` next to `NotAvailable` | Application code that switches over the verdict or compares the reason |
|
|
25
|
+
|
|
26
|
+
Nothing is suspended until the application suspends a part, so the reason `Suspended` reaches a client only after the application starts using suspensions.
|
|
27
|
+
|
|
28
|
+
The `@cratis/arc`, `@cratis/arc.react`, `@cratis/arc.react.mvvm` and `@cratis/arc.vite` packages have no breaking change of their own in this move; the first row is a change in what the server sends. A host that does not reference `Cratis.Arc.Availability` and never reads the state or message of a `ReadChanged` refusal has nothing to change here beyond the version raise.
|
|
29
|
+
|
|
30
|
+
## Inventory before the bump
|
|
31
|
+
|
|
32
|
+
1. List the versions of `Cratis`, `Cratis.Arc.*` and `Cratis.Choreography` in every `.csproj` and `Directory.Packages.props`, and of `@cratis/arc*` in every `package.json`.
|
|
33
|
+
2. Search the frontend, the specs and every other consumer of command results for `conflictingEventTypeId`, `conflictingEventType`, `conflictingEventSequenceNumber` and for `key` read from the `state` of a validation result. List each use.
|
|
34
|
+
3. If a project references `Cratis.Arc.Availability`, list:
|
|
35
|
+
- every `using Cratis.Choreography.Availability...` and every use of `ChoreographyContextValueSource`
|
|
36
|
+
- every string form from the table above, with the audience and availability names it uses
|
|
37
|
+
- the registrations of `IAudienceSource`, `IDeclaredAudiences`, `AvailabilityCatalog` and `ContextValueCatalog`, and whether `AddCratis()` runs before `AddArcAvailability`
|
|
38
|
+
- every `ContextValueCatalog.Declare` with its scope, and whether `ScopeFor` is set
|
|
39
|
+
- every call to `IsGated` and every `switch` over `AvailabilityVerdict`
|
|
40
|
+
4. If availability is in use, start the application and save the answer of `GET /.cratis/availability` for one caller of each kind the application distinguishes, such as a tenant with and a tenant without a paid package. Done when each answer is on disk.
|
|
41
|
+
|
|
42
|
+
## Order
|
|
43
|
+
|
|
44
|
+
1. **Raise the packages.** Raise every Arc package, NuGet and npm, to the latest Arc 24 release in one change, as `cratis-platform-upgrade-application` describes. If the host references `Cratis.Choreography`, raise it to 2.11.0 or later in the same change; from that release it uses the engine in `Cratis.Arc.Availability`. Done when `dotnet restore` ends without a downgrade warning or error.
|
|
45
|
+
2. **Move to the Arc namespaces.** Read `references/<language>.md` for the application's backend (`.csproj` → csharp). Done when no file names `Cratis.Choreography.Availability` and the project compiles apart from obsolete warnings.
|
|
46
|
+
3. **Declare availability with types.** Follow the same reference. Done when the project builds with warnings as errors, or when every remaining string form is listed with the reason it stays.
|
|
47
|
+
4. **Stop reading the removed refusal details.** For each use from the inventory, read `readModel` and nothing else from the `state`. Read `references/typescript.md` for a TypeScript client. Change specs that assert on the event type or sequence number in the message. Done when the search from the inventory finds nothing.
|
|
48
|
+
5. **Rebuild and regenerate the proxies** as `cratis-platform-upgrade-application` describes. Regenerated command and query proxies carry the part they are, which the client needs to ask about one part.
|
|
49
|
+
|
|
50
|
+
## Verify
|
|
51
|
+
|
|
52
|
+
1. `dotnet restore`, then `dotnet build` with warnings as errors.
|
|
53
|
+
2. Run the specs.
|
|
54
|
+
3. If availability is in use, start the application and ask `GET /.cratis/availability` as the same callers as in the inventory. Each listed part now also carries a `reason`. Done when each answer lists the same parts as the saved one, or every difference is explained by a gate that was discarded before because `AddCratis()` ran first.
|
|
55
|
+
4. For one gated command and one gated query, call it as a caller the gate admits and as one it does not. Done when the first is served and the second is refused with HTTP status 403 and the reason `NotAvailable`.
|
|
56
|
+
5. No event, projection or read-model behavior changes in this move, so no replay is needed. The raise brings a newer Chronicle client; apply the kernel order from `cratis-platform-upgrade-application`.
|
|
57
|
+
|
|
58
|
+
## Finish
|
|
59
|
+
|
|
60
|
+
Merge the upgrade, then reinstall the AI corpus with the previous profile list: `cratis ai install --profiles <previous> --harnesses <previous> --languages <previous>`. Done when `.cratis/ai.json` no longer lists `cratis/migrate/arc-23-to-24` and this skill is gone.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Move availability to the Arc engine and to types
|
|
2
|
+
|
|
3
|
+
Prerequisite: a project references `Cratis.Arc.Availability` and the packages are on the latest Arc 24 release.
|
|
4
|
+
|
|
5
|
+
## Move to the Arc namespaces
|
|
6
|
+
|
|
7
|
+
Replace the namespaces. The type names are unchanged except for the last row.
|
|
8
|
+
|
|
9
|
+
| Before | After |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| `Cratis.Choreography.Availability` | `Cratis.Arc.Availability` |
|
|
12
|
+
| `Cratis.Choreography.Availability.Audiences` | `Cratis.Arc.Availability.Audiences` |
|
|
13
|
+
| `Cratis.Choreography.Availability.Context` | `Cratis.Arc.Availability.Context` |
|
|
14
|
+
| `Cratis.Choreography.Availability.Context.Providers` | `Cratis.Arc.Availability.Context.Providers` |
|
|
15
|
+
| `ChoreographyContextValueSource` | `AvailabilityContextValueSource` |
|
|
16
|
+
|
|
17
|
+
Remove a `Cratis.Choreography` package reference that existed only for availability. Keep it, at 2.11.0 or later, when the host uses state machines, jobs, workflows or workers.
|
|
18
|
+
|
|
19
|
+
Observe: the project compiles, with obsolete warnings for the string forms.
|
|
20
|
+
|
|
21
|
+
The existing registration keeps working after the namespace change:
|
|
22
|
+
|
|
23
|
+
```csharp
|
|
24
|
+
services.AddSingleton<IAudienceSource>(new InMemoryAudienceSource());
|
|
25
|
+
services.AddSingleton<IDeclaredAudiences>(new DeclaredAudiences("Plus", "Preview"));
|
|
26
|
+
services.AddSingleton(new AvailabilityCatalog());
|
|
27
|
+
services.AddSingleton(new ContextValueCatalog());
|
|
28
|
+
services.AddArcAvailability(options => options.GateNamespace("Fleet.DataQuality", AvailabilityExpression.For("Plus")));
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Declare availability with types
|
|
32
|
+
|
|
33
|
+
Each string form becomes a type or an attribute that names a type.
|
|
34
|
+
|
|
35
|
+
| Before | After |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| `[AvailableFor("Plus", "Preview")]` | `[AvailableFor<Plus, Preview>]`, with `public class Plus : Audience;` |
|
|
38
|
+
| `[AvailableWith("DataQuality")]` | `[Available<DataQuality>]`, with `public class DataQuality : AvailabilityBlock` |
|
|
39
|
+
| `AvailabilityExpression.For`, `With`, `When`, `AllOf`, `AnyOf` | `For<T>()`, `With<T>()`, `When`, `&` and `\|` in an `AvailabilityBlock` |
|
|
40
|
+
| `AvailabilityCatalog` and `AvailabilityDefinition` | an `AvailabilityBlock` type, which the catalog is built from |
|
|
41
|
+
| `options.GateNamespace("Fleet.DataQuality", expression)` | `[AvailableFor<Plus>] public class Feature : AvailabilityScope;` in that namespace |
|
|
42
|
+
| `ContextValueCatalog.Declare(...)` with a `ReadModelContextValueProvider` | `[ProvideContext<Vessel>(...)]` |
|
|
43
|
+
| `DeclaredAudiences` | audience types, which are discovered |
|
|
44
|
+
|
|
45
|
+
```csharp
|
|
46
|
+
using Cratis.Arc.Availability;
|
|
47
|
+
|
|
48
|
+
public class Plus : Audience;
|
|
49
|
+
|
|
50
|
+
public class Preview : Audience;
|
|
51
|
+
|
|
52
|
+
public class DataQuality : AvailabilityBlock
|
|
53
|
+
{
|
|
54
|
+
protected override IReadOnlyList<AvailabilityTerm> Lines =>
|
|
55
|
+
[
|
|
56
|
+
For<Plus>(),
|
|
57
|
+
When.On<Vessel>(_ => _.HasReported).IsTrue()
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
[Command]
|
|
62
|
+
[AvailableFor<Plus, Preview>]
|
|
63
|
+
public record ResetScore(VesselId Vessel);
|
|
64
|
+
|
|
65
|
+
[Available<DataQuality>]
|
|
66
|
+
public class Feature : AvailabilityScope;
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Rules that decide whether the result behaves as before:
|
|
70
|
+
|
|
71
|
+
- **The type name is the name.** An audience is known by the name of its type, and a block by the name of its type. Name each type exactly as the string it replaces, including letter case, because the grants your `IAudienceSource` returns are matched by that name. A name that is not a valid C# type name cannot become a type: keep its string form and suppress the warning at that place, or rename the audience in the stored grants first.
|
|
72
|
+
- **One attribute is one line, and every line must hold.** `[AvailableFor<Plus, Preview>]` is open to either audience, as `[AvailableFor("Plus", "Preview")]` was. `[AvailableFor<Plus>, AvailableFor<Preview>]` needs both. One attribute takes up to three audiences; use a block for more.
|
|
73
|
+
- **All the lines of a block hold.** Use `|` inside one line for alternatives of the same form. Different forms combined with `&` are separate lines.
|
|
74
|
+
- **A scope marker gates its namespace and the namespaces beneath it**, as `GateNamespace` did. Put the marker type in the namespace the string named.
|
|
75
|
+
- **A provided read model is named by its type in camelCase.** `[ProvideContext<Vessel>(nameof(Vessel.VesselByKey), "arguments.vesselId")]` provides `vessel` for the namespace of the type that carries the attribute. Conditions that read a value declared under another name have to read the new name. The host registers an `IReadModelQuery` that executes the query; without one the host fails when the context values are first built.
|
|
76
|
+
|
|
77
|
+
Then remove the registrations of `IDeclaredAudiences`, `AvailabilityCatalog` and `ContextValueCatalog`. Arc builds them from the types only when the host has not registered its own, so a registration left in place hides every audience and block that is declared as a type. Keep the `IAudienceSource` over your own storage.
|
|
78
|
+
|
|
79
|
+
```csharp
|
|
80
|
+
builder.AddCratisArc(configureBuilder: arc => arc
|
|
81
|
+
.WithAvailability());
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
`WithAvailability` takes the same two callbacks as `AddArcAvailability`, which a host without an Arc builder keeps calling.
|
|
85
|
+
|
|
86
|
+
Observe: the project builds with warnings as errors, and the host starts.
|
|
87
|
+
|
|
88
|
+
- The host stops at startup with `UndefinedAvailabilityException` or `CircularAvailabilityException`: a block uses `With<T>()` or `AvailabilityExpression.With("...")` on a block that is not in the catalog, or blocks build on each other in a cycle. Define the missing block, or remove the hand-registered `AvailabilityCatalog` that hides the typed blocks.
|
|
89
|
+
- A gated part is refused for a caller who holds the audience: the audience type is named differently from the stored grant, or a hand-registered `IDeclaredAudiences` does not list it.
|
|
90
|
+
- A value from `ContextValueCatalog.Declare` behaves differently: a part now runs in the scope made of the segments of its namespace, so a declaration whose scope path is the start of that namespace now applies to it, and the nearest one wins. Set `options.ScopeFor = _ => ContextScope.Application` to keep the previous behavior, or move the declaration to `[ProvideContext<T>]`.
|
|
91
|
+
- A `switch` over `AvailabilityVerdict` needs a case for `Suspended`. Code that used `IAvailabilityGate.IsGated` to find the gated parts reads `IAvailabilityGate.GatedParts` instead.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Read a refused command without the removed details
|
|
2
|
+
|
|
3
|
+
Prerequisite: the application uses the Arc Chronicle integration with protected decision reads, and client code reads the `state` of a validation result on a refused command.
|
|
4
|
+
|
|
5
|
+
A command refused because a read it depended on changed arrives as a validation result with the reason `concurrencyViolation` and the detail `ReadChanged`. Its `state` holds `readModel` only. The server no longer sends `key`, `conflictingEventTypeId`, `conflictingEventType` or `conflictingEventSequenceNumber`, so code that reads them gets `undefined`; `state` is untyped, so the compiler does not report it.
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { ValidationResultReason } from '@cratis/arc/validation';
|
|
9
|
+
|
|
10
|
+
const result = await command.execute();
|
|
11
|
+
|
|
12
|
+
const conflict = result.validationResults.find(
|
|
13
|
+
(_) => _.reason === ValidationResultReason.ConcurrencyViolation && _.reasonDetail === 'ReadChanged',
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
if (conflict) {
|
|
17
|
+
const readModel = conflict.state.readModel as string;
|
|
18
|
+
// Keep the user's input, read fresh state and offer to submit again.
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Observe, in a spec or under a debugger: pause a protected command after its server-side read and before commit, commit a competing event covered by the guard, then resume the command. The result is `ReadChanged`, the form keeps its input, and the handler reads nothing but `readModel`.
|
|
23
|
+
|
|
24
|
+
- The client showed which record or which event caused the refusal: the server does not tell any more. Show that the named read model changed, read fresh state with the queries the screen already uses, and let the user compare.
|
|
25
|
+
- The client chose what to reload from `key`: reload from the identity the screen already holds, such as the route parameter or the command's own properties.
|
|
26
|
+
- The message text is shown to users and looks different: it names the read model and the command only, without an event type or sequence number.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cratis-migrate-components-3-to-4
|
|
3
|
+
description: Use when upgrading a TypeScript application from Cratis Components 3 to Cratis Components 4, including a frontend that no longer compiles or renders unstyled after raising `@cratis/components` (component namespaces missing from the package root, `styledMode` or `CratisPreset` gone, PrimeReact selectors and `pt` keys that match nothing), and running the `@cratis/components.migrator` codemods in order. Not for other Components majors, new applications (`cratis-platform-start-application`), replacing the application's own PrimeReact controls (`cratis-components-choose-control`) or the general upgrade loop of versions, order and deployment (`cratis-platform-upgrade-application`).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Move a TypeScript application from Components 3 to Components 4
|
|
7
|
+
|
|
8
|
+
Temporary guidance for one upgrade. Reinstall the AI corpus without this profile once the upgrade is merged. Run it inside the loop of `cratis-platform-upgrade-application`, which owns version pairing and the order across products. Paths and names in examples are illustrative.
|
|
9
|
+
|
|
10
|
+
## What changed
|
|
11
|
+
|
|
12
|
+
Components 3 rendered through PrimeReact 11. Components 4 renders its own markup, with no PrimeReact, PrimeIcons or Prime theme dependency. Imports, provider configuration, CSS selectors and some callbacks change, so this is not a version bump.
|
|
13
|
+
|
|
14
|
+
| Symptom | Cause | Who is affected |
|
|
15
|
+
| --- | --- | --- |
|
|
16
|
+
| `@cratis/components` has no exported member `Canvas`, `Common`, `DataTables` or another component namespace | The package root is setup-only: provider, configuration, message and icon types. Every component comes from its own subpath | Applications that import a namespace from the package root, as `import { Canvas } from '@cratis/components'` |
|
|
17
|
+
| `@cratis/components/styled`, `@cratis/components/compatibility` or `@cratis/components/primereact-v10-palette` cannot be resolved; `styledMode`, `CratisPreset` or `primeReactStyles` is missing | The renderer subpaths and their symbols are removed, with no replacement package | Applications that configured a PrimeReact preset or used the pass-through compatibility contract |
|
|
18
|
+
| Type error on `license`, `theme`, `defaults`, `pt`, `ripple`, `unstyled` or a z-index setting in the `value` of `CratisComponentsProvider` | The provider configures locale, messages, icons, routing and dialog header actions, not a renderer | Applications that passed renderer settings to the provider |
|
|
19
|
+
| Components render without the product's look; selectors on PrimeReact markup (`.p-*` classes, `data-scope` and `data-part` attributes) match nothing; a `pt` key is rejected | Components owns the markup. Parts carry `data-cratis-part`; `pt` takes the component's own parts, with plain HTML attributes as values | Applications with their own CSS or `pt` configuration for Components |
|
|
20
|
+
| A `Dropdown` `onChange` handler reads `event.value` and gets nothing, or fails type checking | `onChange` receives the selected value itself, not an event object | Applications with such handlers |
|
|
21
|
+
| `RadioButtonField` fails type checking for a missing `name` | Options bound to one property must share an explicit `name` | Applications with `RadioButtonField` |
|
|
22
|
+
| An import from the `Canvas` or `PivotViewer` subpath cannot resolve `pixi.js`, or the install reports it as a missing peer | `pixi.js` is an optional peer, no longer a dependency of the package | Applications that use `Canvas` or `PivotViewer` |
|
|
23
|
+
| `PivotViewerOptimized`, `CommandStepperContent` or an internal helper of `Canvas` or `Filter` is missing | Exports that were never a contract are removed | Applications that imported them |
|
|
24
|
+
| The install no longer brings `primeicons` | A string icon is still rendered as a class on an `<i>` element, but `primeicons` is no longer a peer of Components | Applications that pass PrimeIcons class strings |
|
|
25
|
+
| Dates in `DatePickerInput` follow the locale and ignore `dateFormat`; `clientFiltering` on a query table changes nothing | Both props are still accepted and do nothing. Without `serverQuery`, table filtering applies only to the loaded page | Applications that set them |
|
|
26
|
+
|
|
27
|
+
Not a break in Components 4, and still worth doing now: the `Button` props `text`, `link`, `outlined`, `rounded` and `severity` are deprecated and still work. A codemod moves them to `variant`, `tone` and `shape`.
|
|
28
|
+
|
|
29
|
+
An application that imports every component from a subpath, configures no PrimeReact preset, and has no CSS, `pt` configuration or handler from the rows above has nothing to change here beyond the version raise.
|
|
30
|
+
|
|
31
|
+
## Inventory before the bump
|
|
32
|
+
|
|
33
|
+
Search the frontend source. Each list is done when it is written down, even if it is empty.
|
|
34
|
+
|
|
35
|
+
1. The version of `@cratis/components`, `@cratis/arc`, `@cratis/arc.react`, `pixi.js` and every PrimeReact, `@primereact/*`, `@primeuix/*` and `primeicons` package in `package.json`. Components 3 is required as the starting point: the codemods accept an installed Components 3 or 4 and refuse anything else.
|
|
36
|
+
2. Every import from `@cratis/components` (the package root) and from the three removed subpaths.
|
|
37
|
+
3. Every `CratisComponentsProvider` and the keys of its `value`.
|
|
38
|
+
4. Every `pt` and `ptOptions` prop on a Cratis component, and every stylesheet rule with a `.p-*` selector or a `data-scope` or `data-part` attribute.
|
|
39
|
+
5. Every direct import from a PrimeReact package. These imports are the application's own and stay until they are replaced (step 7).
|
|
40
|
+
6. Every `onChange` on `Dropdown`.
|
|
41
|
+
7. Every use of `Canvas`, `PivotViewer`, `AutoCommandForm`, `RadioButtonField`, a PrimeIcons class string, `dateFormat` and `clientFiltering`.
|
|
42
|
+
|
|
43
|
+
## Order
|
|
44
|
+
|
|
45
|
+
Work on a branch. A checkpoint is source, package manifest and lockfile together. Save one only when the application's lint, type check, specs and production build pass. Steps 3 to 6 share one checkpoint: the application does not compile between the package raise and the fixes that follow it, so the checks must pass only at step 6. To abandon a step, return source, manifest and lockfile to the previous checkpoint together, reinstall from that lockfile and rerun its checks.
|
|
46
|
+
|
|
47
|
+
Read `references/<language>.md` for the frontend (`package.json` with `@cratis/components` → typescript) for commands, codemod behavior and the mapping tables. This profile ships only the TypeScript reference.
|
|
48
|
+
|
|
49
|
+
1. **Baseline on Components 3.** Done when every check passes and the rollback checkpoint is saved.
|
|
50
|
+
2. **Root imports, still on Components 3.** Preview and apply `cratis-components-remove-root-namespace-imports`, then resolve what it reports. The subpaths it writes exist in both majors. Done when the checks pass on Components 3, no component is imported from the package root, and the import-only checkpoint is saved.
|
|
51
|
+
3. **Raise the packages.** Raise `@cratis/components` to the latest Components 4 release. Add `pixi.js` when the inventory lists `Canvas` or `PivotViewer`. With `AutoCommandForm`, raise `@cratis/arc` and `@cratis/arc.react` together to 22.16.0 or later, inside the range Components declares. Then change by hand: stylesheet imports, the provider, removed subpaths and symbols, `pt` keys and CSS selectors, and the remaining rows of What changed. Done when the install ends without an unmet-peer report for `@cratis/components` and every item of inventory lists 2 to 4 and 7 is changed or deliberately kept. Type errors remain; do not checkpoint.
|
|
52
|
+
4. **Button props.** Preview and apply `cratis-components-button-variant-tone`. Done when it reports nothing and its `TODO(cratis-codemod)` comments are resolved.
|
|
53
|
+
5. **Change handlers.** Preview and apply `cratis-components-change-handler`. Done when it reports nothing and its `TODO(cratis-codemod)` comments are resolved.
|
|
54
|
+
6. **Run the checks.** Done when lint, type check, specs and production build pass, no `TODO(cratis-codemod)` is left, and the upgrade checkpoint is saved.
|
|
55
|
+
7. **Replace the application's own PrimeReact usage** in separate batches, as `cratis-components-choose-control` describes (`references/from-primereact.md`). Remove a PrimeReact package only when no import, provider, theme or tool still uses it. This step may follow the upgrade in later changes.
|
|
56
|
+
|
|
57
|
+
Step 2 comes first because the two later codemods find components through their subpath imports. Steps 4 and 5 write source for Components 4, so they come after step 3.
|
|
58
|
+
|
|
59
|
+
## Verify
|
|
60
|
+
|
|
61
|
+
1. Install from the lockfile, then run lint, type check and the production build.
|
|
62
|
+
2. Run the specs.
|
|
63
|
+
3. Search the source: no import of a component from the package root, no import from a removed subpath, no `TODO(cratis-codemod)`.
|
|
64
|
+
4. Open a page with a field, a table and a dialog in every host entry. Done when each has layout, the product's colors and a visible focus indicator, in every color scheme the application supports.
|
|
65
|
+
5. With the keyboard only: open and dismiss a dialog, move through a stepper, filter and page a table, enter a date, pick a dropdown value and act on a toast. Done when each works and every changed handler receives the value it expects.
|
|
66
|
+
6. No event, projection, read model or HTTP contract changes in this move, so no replay and no document diff is needed.
|
|
67
|
+
|
|
68
|
+
If a changed control loses behavior the application needs, stay on the last passing checkpoint until it is resolved.
|
|
69
|
+
|
|
70
|
+
## Finish
|
|
71
|
+
|
|
72
|
+
Merge the upgrade, then reinstall the AI corpus with the previous profile list: `cratis ai install --profiles <previous> --harnesses <previous> --languages <previous>`. Done when `.cratis/ai.json` no longer lists `cratis/migrate/components-3-to-4` and this skill is gone.
|