@cratis/pi 8.4.1 → 8.5.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/ai-distribution.instructions.md +2 -1
- package/package/corpus/harnesses/copilot/instructions/exit-codes-and-wrappers.instructions.md +1 -1
- package/package/corpus/harnesses/copilot/instructions/scripting.instructions.md +2 -1
- package/package/corpus/hooks/scripts/cratis-guard-secrets.sh +131 -9
- package/package/corpus/rules/ai-distribution.md +2 -1
- package/package/corpus/rules/exit-codes-and-wrappers.md +1 -1
- package/package/corpus/rules/scripting.md +2 -1
- package/package/corpus/skills/cratis-application-growth/references/csharp.md +1 -1
- package/package/corpus/skills/cratis-arc-authorize-request/SKILL.md +3 -3
- package/package/corpus/skills/cratis-arc-authorize-request/references/authproxy.md +28 -3
- package/package/corpus/skills/cratis-arc-authorize-request/references/csharp-query-security.md +3 -3
- package/package/corpus/skills/cratis-arc-authorize-request/references/csharp.md +1 -1
- package/package/corpus/skills/cratis-arc-authorize-request/references/typescript.md +2 -0
- package/package/corpus/skills/cratis-arc-connect-storage/references/csharp.md +1 -0
- package/package/corpus/skills/cratis-arc-connect-storage/references/elixir.md +9 -2
- package/package/corpus/skills/cratis-arc-declare-command/references/csharp-chronicle.md +1 -1
- package/package/corpus/skills/cratis-arc-declare-command/references/csharp-history.md +2 -2
- package/package/corpus/skills/cratis-arc-declare-command/references/csharp.md +7 -7
- package/package/corpus/skills/cratis-arc-declare-operation/references/csharp-abilities.md +2 -2
- package/package/corpus/skills/cratis-arc-declare-operation/references/csharp-recovery.md +6 -4
- package/package/corpus/skills/cratis-arc-declare-operation/references/csharp.md +2 -2
- package/package/corpus/skills/cratis-arc-diagnose-live-query/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-diagnose-live-query/references/csharp.md +6 -6
- package/package/corpus/skills/cratis-arc-diagnose-live-query/references/java.md +1 -1
- package/package/corpus/skills/cratis-arc-diagnose-live-query/references/kotlin.md +1 -1
- package/package/corpus/skills/cratis-arc-expose-mcp-operation/references/csharp-diagnose-tool-call.md +9 -7
- package/package/corpus/skills/cratis-arc-expose-mcp-operation/references/csharp.md +3 -1
- package/package/corpus/skills/cratis-arc-expose-query/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-expose-query/references/csharp.md +10 -7
- package/package/corpus/skills/cratis-arc-expose-query/references/go.md +2 -2
- package/package/corpus/skills/cratis-arc-expose-query/references/typescript.md +6 -3
- package/package/corpus/skills/cratis-arc-generate-proxies/references/csharp.md +7 -5
- package/package/corpus/skills/cratis-arc-host-application/references/csharp-identity.md +3 -2
- package/package/corpus/skills/cratis-arc-host-application/references/csharp.md +7 -0
- package/package/corpus/skills/cratis-arc-invoke-command/references/csharp-extensions.md +4 -0
- package/package/corpus/skills/cratis-arc-isolate-tenant/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-isolate-tenant/references/csharp.md +4 -2
- package/package/corpus/skills/cratis-arc-react-bind-slice/SKILL.md +17 -22
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-commands.md +11 -1
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-host.md +10 -3
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-identity.md +7 -3
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-queries.md +1 -1
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript.md +1 -1
- package/package/corpus/skills/cratis-arc-testing-typescript/references/typescript.md +2 -2
- package/package/corpus/skills/cratis-arc-validation-typescript/SKILL.md +1 -0
- package/package/corpus/skills/cratis-chronicle-cli-operations/SKILL.md +5 -5
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/inspection.md +11 -3
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/project-tooling.md +22 -0
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/recovery-and-comparison.md +17 -3
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/setup-and-target.md +8 -2
- package/package/corpus/skills/cratis-chronicle-connect-application/references/python.md +2 -2
- package/package/corpus/skills/cratis-chronicle-constrain-append/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/SKILL.md +4 -3
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/configuration.md +86 -16
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/kernel-options.md +3 -3
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/network-and-tls.md +14 -6
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/storage.md +33 -1
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/upgrade-and-recovery.md +27 -1
- package/package/corpus/skills/cratis-chronicle-evolve-event/references/csharp.md +2 -2
- package/package/corpus/skills/cratis-chronicle-inspect-observer/SKILL.md +4 -4
- package/package/corpus/skills/cratis-chronicle-inspect-observer/references/csharp.md +8 -7
- package/package/corpus/skills/cratis-chronicle-inspect-observer/references/go.md +2 -2
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/deployment.md +1 -1
- package/package/corpus/skills/cratis-chronicle-project-view/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-fluent.md +1 -1
- package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-model-bound.md +1 -1
- package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-reading.md +2 -0
- package/package/corpus/skills/cratis-chronicle-project-view/references/java.md +1 -1
- package/package/corpus/skills/cratis-chronicle-project-view/references/kotlin.md +3 -3
- package/package/corpus/skills/cratis-chronicle-project-view/references/typescript.md +2 -0
- package/package/corpus/skills/cratis-chronicle-protect-decision/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp-scopes.md +1 -1
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp.md +2 -2
- package/package/corpus/skills/cratis-chronicle-protect-personal-data/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-protect-personal-data/references/csharp.md +4 -2
- package/package/corpus/skills/cratis-chronicle-publish-contract/SKILL.md +6 -5
- package/package/corpus/skills/cratis-chronicle-publish-contract/references/elixir-integrations.md +3 -3
- package/package/corpus/skills/cratis-chronicle-react-to-fact/SKILL.md +2 -1
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp-pages.md +1 -1
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp.md +3 -3
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/java.md +1 -1
- package/package/corpus/skills/cratis-chronicle-record-event/SKILL.md +2 -2
- package/package/corpus/skills/cratis-chronicle-reduce-state/references/typescript.md +1 -1
- package/package/corpus/skills/cratis-chronicle-web-workbench/SKILL.md +1 -1
- package/package/corpus/skills/cratis-ci-pipeline-performance/SKILL.md +4 -3
- package/package/corpus/skills/cratis-ci-pipeline-performance/references/publish-pipelines.md +19 -4
- package/package/corpus/skills/cratis-code-review/SKILL.md +6 -2
- package/package/corpus/skills/cratis-code-review/references/csharp.md +3 -3
- package/package/corpus/skills/cratis-commits-and-pull-requests/SKILL.md +6 -38
- package/package/corpus/skills/cratis-commits-and-pull-requests/references/pr-description.md +2 -0
- package/package/corpus/skills/cratis-commits-and-pull-requests/references/pr-labels-and-release.md +5 -4
- package/package/corpus/skills/cratis-commits-and-pull-requests/references/workflow-inputs.md +39 -0
- package/package/corpus/skills/cratis-components-submit-form/SKILL.md +6 -6
- package/package/corpus/skills/cratis-components-submit-form/references/typescript-commanddialog.md +21 -1
- package/package/corpus/skills/cratis-components-submit-form/references/typescript.md +2 -2
- package/package/corpus/skills/cratis-fundamentals-concept/references/csharp-serialization.md +2 -1
- package/package/corpus/skills/cratis-fundamentals-concept/references/csharp.md +1 -0
- package/package/corpus/skills/cratis-fundamentals-concept/references/go.md +1 -1
- package/package/corpus/skills/cratis-fundamentals-concept/references/java-json.md +3 -2
- package/package/corpus/skills/cratis-fundamentals-concept/references/kotlin-json.md +3 -2
- package/package/corpus/skills/cratis-fundamentals-concept/references/typescript-serialization.md +8 -2
- package/package/corpus/skills/cratis-fundamentals-name-value/SKILL.md +8 -7
- package/package/corpus/skills/cratis-fundamentals-type-discovery/SKILL.md +3 -3
- package/package/corpus/skills/cratis-fundamentals-type-discovery/references/csharp-diagnostics.md +3 -0
- package/package/corpus/skills/cratis-fundamentals-type-discovery/references/csharp.md +2 -2
- package/package/corpus/skills/cratis-platform-deliver-slice/references/typescript.md +14 -1
- package/package/corpus/skills/cratis-platform-prepare-release-pr/SKILL.md +8 -8
- package/package/corpus/skills/cratis-platform-prepare-release-pr/references/product-release-checks.md +16 -2
- package/package/corpus/skills/cratis-release-notes/SKILL.md +1 -1
- package/package/corpus/skills/cratis-release-notes/references/publish-repair.md +6 -3
- package/package/corpus/skills/cratis-screenplay-accept-model/references/csharp.md +5 -3
- package/package/corpus/skills/cratis-screenplay-accept-model/references/read-the-evidence.md +2 -2
- package/package/corpus/skills/cratis-screenplay-declare-slice/SKILL.md +6 -10
- package/package/corpus/skills/cratis-screenplay-declare-slice/references/commands.md +8 -4
- package/package/corpus/skills/cratis-screenplay-declare-slice/references/projections.md +2 -0
- package/package/corpus/skills/cratis-screenplay-declare-slice/references/structure-and-imports.md +19 -1
- package/package/corpus/skills/cratis-screenplay-edit-workspace/SKILL.md +2 -1
- package/package/corpus/skills/cratis-screenplay-edit-workspace/references/mcp-tools.md +1 -1
- package/package/corpus/skills/cratis-screenplay-handoff-slice/references/csharp.md +13 -1
- package/package/corpus/skills/cratis-screenplay-model-translation/SKILL.md +1 -1
- package/package/corpus/skills/cratis-screenplay-model-translation/references/boundary-diagnostics.md +1 -1
- package/package/corpus/skills/cratis-screenplay-onboard-workspace/SKILL.md +26 -48
- package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/studio.md +5 -0
- package/package/corpus/skills/cratis-screenplay-specify-outcome/SKILL.md +8 -12
- package/package/corpus/skills/cratis-screenplay-specify-outcome/references/running-mcp.md +12 -0
- package/package/corpus/skills/cratis-screenplay-specify-outcome/references/scenarios.md +2 -2
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-command-results.md +1 -1
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-events.md +6 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-integration.md +3 -2
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-reactors.md +15 -2
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-read-models.md +4 -2
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp.md +1 -1
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/typescript.md +4 -2
- package/package/corpus/skills/cratis-stage-render-slice/SKILL.md +6 -0
- package/package/corpus/skills/cratis-stage-render-slice/references/semantic-conformance.md +64 -0
- package/package.json +1 -1
|
@@ -47,7 +47,7 @@ Compare every mapped field against a distinguishing input; default values alone
|
|
|
47
47
|
| `InstanceForEventSourceId(id)` / `InstanceForKey(keyParts)` | One instance, or `null` |
|
|
48
48
|
| `ReadModels` | The seeded and materialized models through the client's read-model API |
|
|
49
49
|
| `ShouldPartiallyMatchReadModel(id, expected)` / `ShouldExactlyMatchReadModel(id, expected)` / `ShouldHaveNoReadModel(id)` | Listed properties match / every public property matches / nothing exists at that key |
|
|
50
|
-
| `CollectEventsFor(id, events)` / `await ProcessEventsFor(id, events)` | Accumulate events for a source
|
|
50
|
+
| `CollectEventsFor(id, events)` / `await ProcessEventsFor(id, events)` | Accumulate events for a source; both are folded on the next read |
|
|
51
51
|
| `CollectReadModelFor(id, instance)` | Seed the fold for that key and expose it through `ReadModels`; a model with no projection or reducer is only registered for keyed lookups |
|
|
52
52
|
| `ProcessAppendedEvents(events)` | Apply captured `AppendedEvent` envelopes with their context |
|
|
53
53
|
| `ClientArtifactsProvider` | The artifacts the scenario discovered |
|
|
@@ -70,6 +70,8 @@ An empty list still does not cover storage or observer delivery. Because the che
|
|
|
70
70
|
|
|
71
71
|
## Failures that name the cause
|
|
72
72
|
|
|
73
|
+
Seeding never folds: `Given...Events(...)`, `ProcessEventsFor` and `ProcessAppendedEvents` only collect events. The projection or reducer runs on the first read: `Instance`, `Instances`, `InstanceForEventSourceId` or a `Should...ReadModel` assertion. `InstanceForKey` reads only keys seeded by name: before any named seed it returns `null`; after one, key parts that do not match the named key throw `InvalidReadModelSeedKey`, and a valid key that was not seeded returns `null`. Getting `ReadModels` does not fold. Its single-key `GetInstanceById(key)` folds the scenario's input first only when model instances were seeded; the stream overload `GetInstanceById(eventSourceId, eventStreamId)` skips that step and folds the stream's events from the log on each read. Fold failures such as `ReducerFailed` and `ReducerDeferred` are thrown from that read, so wrap the read, not the seed, in `Catch.Exception` in `Because`.
|
|
74
|
+
|
|
73
75
|
| Thrown | Means | Do |
|
|
74
76
|
| --- | --- | --- |
|
|
75
77
|
| `NoReadModelHandlerFound` | No reducer, projection or model-bound mapping was discovered for the model | Fix the definition or its discovery; do not paper over it with `WithProjection` |
|
|
@@ -93,4 +95,4 @@ An empty list still does not cover storage or observer delivery. Because the che
|
|
|
93
95
|
|
|
94
96
|
## ProjectionSlice
|
|
95
97
|
|
|
96
|
-
`ProjectionSlice<TReadModel>` (namespace `Cratis.Chronicle.Testing.Slices`) is the given/run/then shape over the same engine: `new ProjectionSlice<T>()` (or with `Defaults`), `.GivenEvents(id, events)` per source, `await Run()`, then chain `Then.ShouldPartiallyMatchReadModel(id, expected)`, `.ShouldExactlyMatchReadModel(id, expected)`, `.ShouldHaveNoReadModel(id)` or `.Should(scenario => ...)`. `Scenario` exposes the underlying `ReadModelScenario<T>` for routing, seeded state or strictness. Choose it when the spec reads as "given these events, then this row"; use the scenario directly for streams, tags or seeded state. Await `Run()`, not the assertions: they synchronously return a chainable outcome. Keep direct reducer transition specs separate from this wiring check. Disposing the slice disposes its scenario
|
|
98
|
+
`ProjectionSlice<TReadModel>` (namespace `Cratis.Chronicle.Testing.Slices`) is the given/run/then shape over the same engine: `new ProjectionSlice<T>()` (or with `Defaults`), `.GivenEvents(id, events)` per source, `await Run()`, then chain `Then.ShouldPartiallyMatchReadModel(id, expected)`, `.ShouldExactlyMatchReadModel(id, expected)`, `.ShouldHaveNoReadModel(id)` or `.Should(scenario => ...)`. `Scenario` exposes the underlying `ReadModelScenario<T>` for routing, seeded state or strictness. Choose it when the spec reads as "given these events, then this row"; use the scenario directly for streams, tags or seeded state. Await `Run()`, not the assertions: they synchronously return a chainable outcome. Keep direct reducer transition specs separate from this wiring check. Disposing the slice disposes its scenario. After that, `GivenEvents`, `Run` and `Then` throw `SliceDisposed`; another `Dispose` does nothing, and `Scenario` still returns the disposed scenario, so do not use it.
|
|
@@ -113,7 +113,7 @@ Awaited assertions on the scenario: `ShouldHaveAppendedEvent<TCommand, TEvent>(i
|
|
|
113
113
|
|
|
114
114
|
## Seeding before the act
|
|
115
115
|
|
|
116
|
-
`Given.ForEventSource(id)[.OnRoute(route)].Events(...)` and `.ReadModel(instance)`; `EventRoutes` resolves a route; `EventScenario.Given` seeds the log that constraints see. Guarded reads, uniqueness, competing writers (`AppendConcurrently`) and `DecisionReadAdmissions`: [csharp-decision-reads.md](csharp-decision-reads.md).
|
|
116
|
+
`Given.ForEventSource(id)[.OnRoute(route)].Events(...)` and `.ReadModel(instance)`; `EventRoutes` resolves a route; in an ordinary scenario, `EventScenario.Given` seeds the log that constraints see; routed seeds need decision mode, which commands with decision dependencies use automatically; there `Given` seeds one shared log and `EventScenario` throws. Guarded reads, uniqueness, competing writers (`AppendConcurrently`) and `DecisionReadAdmissions`: [csharp-decision-reads.md](csharp-decision-reads.md).
|
|
117
117
|
|
|
118
118
|
## Slice
|
|
119
119
|
|
package/package/corpus/skills/cratis-specifications-exercise-backend/references/typescript.md
CHANGED
|
@@ -183,7 +183,9 @@ emissions.should.have.lengthOf(1);
|
|
|
183
183
|
`new ReadModelScenario(ReadModelClass, artifacts?)` from `@cratis/chronicle/testing` folds events through the read model's reducer or a supported flat projection. Supply `artifacts` (`eventTypes`, `reducers`, `projections`, optional `readModels` and `globalForHandlers`) to isolate the catalog rather than discovering it.
|
|
184
184
|
|
|
185
185
|
- `scenario.given.forEventSource(id, appendOptions?).events(...events)` queues events and returns the scenario. `collectEventsFor(id, events, options?)` queues them without the builder. For non-default routes, use a kernel.
|
|
186
|
-
- `await scenario.instance` returns the
|
|
186
|
+
- `await scenario.instance` returns the one non-null model, or `null` when there is none; it rejects when more than one non-null model exists. One event source can populate several projection keys, so it says nothing about a particular key. Read one model with `await scenario.instanceForEventSourceId(key)`, passing the model key the projection resolves, which is not always the event source id. It returns `null` both for a removed model and for one never created.
|
|
187
|
+
- `await scenario.wasDeletedForEventSourceId(key)` reports the current deleted state: it is `true` when the latest state change the reducer or projection made for that key removed the model, even when the model never existed. Events the read model does not handle change nothing, so one seeded after a removal leaves the flag `true`; an event that recreates the model makes it `false` again. To prove that an existing model was removed, first assert it exists after the earlier events, then seed the removing event and assert the flag. In a reducer, returning `undefined` deletes the model, while returning `null` keeps a null state that is not deleted.
|
|
188
|
+
- You may seed more events after a read. The next read replays the complete seeded history, so read again to assert the new state. Seed order holds within each event source; a batch reducer receives only the events it subscribes to, one batch per source, so do not assert an order across sources.
|
|
187
189
|
- `scenario.observe(eventOrReactorScenario)` reads that scenario’s committed history afresh on each model read; reactor effects that were only recorded are not part of it. Select one observed scenario or seed events manually, never both.
|
|
188
190
|
- Not supported in this SDK: listing all instances, seeding an instance directly, match helpers and strict modes. Assert the instance with Chai. A projection shape or non-default route outside the in-process boundary throws `UnsupportedProjectionOperation`; a reducer filtered by tag, event source type or event stream type throws `UnsupportedReducerOperation`. Both mean the harness cannot prove that shape: test it with `ChronicleKernelScenario`.
|
|
189
191
|
|
|
@@ -194,7 +196,7 @@ emissions.should.have.lengthOf(1);
|
|
|
194
196
|
- `given.forEventSource(id, appendOptions?).events(...events)` seeds and delivers earlier events; use it only when the earlier handler calls are part of the setup.
|
|
195
197
|
- `when.forEventSource(id, appendOptions?).events(...events)` appends one atomic input batch and awaits its delivery; an append refusal rejects the call.
|
|
196
198
|
- `given.page(...entries)` / `when.page(...entries)` deliver a page of `EventForEventSourceId` entries from several sources, e.g. to prove that one partition can defer while another is handled.
|
|
197
|
-
- Options include the Event scenario options above for the input log and metadata. `artifactActivator` supplies production-style per-delivery activation for dependency injection and cleanup.
|
|
199
|
+
- Options include the Event scenario options above for the input log and metadata. `artifactActivator` supplies production-style per-delivery activation for dependency injection and cleanup. To give the reactor test doubles, build the instance from the requested type: `artifactActivator: type => ({ instance: new type(fakeGateway) })`. The activator is generic, so returning a fixed `new MyReactor(...)` does not type-check. Without an activator the reactor is constructed with no arguments.
|
|
198
200
|
- `servicesEventStore` supplies an explicit `IEventStore` test double for handler dependencies. The default supports the in-process event log, not read models or other store services, and rejects explicit appends of types this reactor subscribes to.
|
|
199
201
|
- `resultHandler(result, context, reactorType, eventStore, namespace)` is the application hook for a single-event handler’s return value. Return `true` to claim it without recording, `false` to fall through, or throw to fail delivery. The default recorder accepts registered events (including routed `EventForEventSourceId` wrappers), not commands or unknown values. A nonempty `commandTypes` option is rejected; use the hook to assert a returned command or a live host to prove its execution.
|
|
200
202
|
- `produced` holds recorded event payloads; `sideEffects` additionally gives `kind`, `value`, routed `target`, `triggeringContext`, `handler` and zero-based `deliveryIndex`. Setup effects are included, so separate them from effects of the act.
|
|
@@ -256,6 +256,12 @@ Programmatic planning in your language reference.
|
|
|
256
256
|
- Source-plan options - preserve identity, placement and scaffold profile; compose shared UI only over installed proxies.
|
|
257
257
|
- Strict and gap policies - enforce acceptance; never treat a gap option as permission to omit behavior.
|
|
258
258
|
|
|
259
|
+
### Renderer conformance tests
|
|
260
|
+
|
|
261
|
+
Testing your own renderer's round trip? Gate it on the semantic loss ledger in the renderer
|
|
262
|
+
repository's non-packable specification project, referencing the source adapter's published
|
|
263
|
+
package; read [semantic conformance](references/semantic-conformance.md).
|
|
264
|
+
|
|
259
265
|
## Where hand-written code goes
|
|
260
266
|
|
|
261
267
|
Everything hand-written for a rendered application goes in `Customizations/` at the application root.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Gate a renderer's round trip with the semantic loss ledger
|
|
2
|
+
|
|
3
|
+
`Cratis.Screenplay.Conformance` is a source-only test-support package. The round trip lives in the
|
|
4
|
+
renderer repository, in a specification project that is never packed and that references the source
|
|
5
|
+
adapter's published package with `PrivateAssets`. Adapter repositories do not host it. The package
|
|
6
|
+
compiles into the test project (C# 12+, .NET 10+) and adds no runtime assembly. Use the renderer's Screenplay version and add `-preview` only when that version has
|
|
7
|
+
no prerelease suffix: `X.Y.Z` becomes `X.Y.Z-preview`, while an already suffixed version is used as is.
|
|
8
|
+
|
|
9
|
+
```xml
|
|
10
|
+
<PackageReference Include="Cratis.Screenplay.Conformance" Version="X.Y.Z-preview" PrivateAssets="all" />
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The test owns the ledger file, the round trips and the eligible fixture set; the package only
|
|
14
|
+
compares and reconciles.
|
|
15
|
+
|
|
16
|
+
## Gate on the whole verdict
|
|
17
|
+
|
|
18
|
+
```csharp
|
|
19
|
+
using var stream = File.OpenRead("semantic-loss-ledger.json");
|
|
20
|
+
var ledger = SemanticLossLedger.Load(stream);
|
|
21
|
+
var verdict = ledger.Reconcile(observations, requireCompleteRun: true, eligibleFixtures);
|
|
22
|
+
Assert.True(verdict.IsClean, string.Join("\n", verdict.Findings));
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- `IsClean` is true only when `Findings` is empty. `Findings` combines every list: `Malformed`,
|
|
26
|
+
`Unledgered`, `Stale`, `Unexplained`, `Uncited`, `OverBudget`, `Vacuous`, `Orphans`,
|
|
27
|
+
`IneligibleExclusions`, `ObsoleteExclusions` and `Unobserved`. Checking one list, or counting
|
|
28
|
+
differences, lets the others pass.
|
|
29
|
+
- Choose the eligible fixture set before rendering, never from the fixtures that happened to render.
|
|
30
|
+
Pass that set unchanged: do not add the ledger's exclusions to it, and do not drop eligible
|
|
31
|
+
fixtures the ledger excludes. Leave excluded fixtures out of the observations. Observing an
|
|
32
|
+
excluded fixture fails any run; excluding a fixture that is not eligible fails a complete run. The
|
|
33
|
+
parameter is optional in the signature, but a complete run without it fails.
|
|
34
|
+
- A complete run must observe every eligible fixture the ledger does not exclude, observe at least
|
|
35
|
+
`minimumFixtureCount` fixtures and compare at least one recovered model.
|
|
36
|
+
|
|
37
|
+
## Keep the ledger honest
|
|
38
|
+
|
|
39
|
+
- Each loss names `fixture`, `change` (`missing`, `unexpected`, `changed`, `uncompilable` or
|
|
40
|
+
`diagnostic`) and `direction` (`render` or `adapter`), plus exactly one of `issue`
|
|
41
|
+
(`owner/repo#123`) or a nonempty `byDesign` reason. `missing`, `unexpected` and `changed` also need
|
|
42
|
+
the exact `path`. `diagnostics` lists the codes the loss cites; leaving it out means empty.
|
|
43
|
+
Wildcard paths and malformed entries never reconcile clean.
|
|
44
|
+
- A loss with empty or missing `diagnostics` is silent. It must carry an `issue`, never `byDesign`.
|
|
45
|
+
To accept it by design, cite a diagnostic code that explains it. Use an existing code if one
|
|
46
|
+
applies; otherwise make the renderer or adapter emit one.
|
|
47
|
+
- A `diagnostic` entry matches only through its codes: it must cite at least one code that occurred
|
|
48
|
+
in the fixture for its direction, or it is stale. An `issue` alone does not reconcile it.
|
|
49
|
+
- Every cited code must occur in the same fixture for the entry's direction. An `uncompilable` entry
|
|
50
|
+
may also cite codes from compiling the recovered source.
|
|
51
|
+
- Every renderer or adapter warning or error must be cited by an entry for the same fixture and
|
|
52
|
+
direction. Informational diagnostics and recovery compiler codes need no citation.
|
|
53
|
+
- Entry, by-design and exclusion counts may not exceed the ledger's `budget`.
|
|
54
|
+
- An entry for an observed fixture that matches nothing is stale: remove it once the loss is fixed.
|
|
55
|
+
An entry for a fixture the run did not observe is an orphan in a complete run. A partial run does
|
|
56
|
+
not report it as orphan or stale, but it still counts toward the budget and must still be well
|
|
57
|
+
formed and not a silent `byDesign` loss. Do not delete entries for fixtures you skipped while
|
|
58
|
+
debugging.
|
|
59
|
+
|
|
60
|
+
## Debug one fixture
|
|
61
|
+
|
|
62
|
+
Use `requireCompleteRun: false` in a separate local test. A partial run skips the minimum and the
|
|
63
|
+
eligible set, but it must still execute at least one fixture. Keep CI on the complete run, and never
|
|
64
|
+
lower `minimumFixtureCount` to make a local run pass.
|