diff --git a/README.md b/README.md index 3fe330c..3287dec 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ The kit is upstream of both: it defines *what* a Specfuse spec must look like. T ## Status -**Incubating** (`v0.30.0`), Apache-2.0. Handbooks, samples, schemas, the `project-init` template, the bundled `hello-orders` example, the `specfuse-authoring` plugin (in the `specfuse/specfuse` marketplace), and the `specfuse authoring` CLI are all in place. Generator-side alignment items are tracked in [`compatibility.md`](compatibility.md#outstanding-generator-side-follow-ups). +**Incubating** (`v0.31.0`), Apache-2.0. Handbooks, samples, schemas, the `project-init` template, the bundled `hello-orders` example, the `specfuse-authoring` plugin (in the `specfuse/specfuse` marketplace), and the `specfuse authoring` CLI are all in place. Generator-side alignment items are tracked in [`compatibility.md`](compatibility.md#outstanding-generator-side-follow-ups). The kit is distributed on PyPI as `specfuse-authoring` and hosted under [`Specfuse/authoring`](https://github.com/Specfuse/authoring). The code generator it drives is distributed separately as a pinned, checksum-verified release asset (see [`generator.lock`](generator.lock)); `specfuse authoring generate` resolves, verifies, and runs it on demand. diff --git a/compatibility.md b/compatibility.md index bbca226..a28bd7f 100644 --- a/compatibility.md +++ b/compatibility.md @@ -58,7 +58,8 @@ This file tracks which Specfuse generator commits are known compatible with each | `v0.25.0` (incubating) | generator **`0.16.0`** — `Specfuse/generator-dist` release `v0.16.0`, asset `specfuse-generator-0.16.0.jar`, sha256 `dcd77128…7e8151` | **⚠ BREAKING for C# consumers with stored enums or encrypted enums, and for any C# project whose `service` emits events without `eventRuntime`.** *Minor: a generator pin bump that adds an authorable key (`x-ai.dataHandling`), four Spectral rules, and ERRORs that start failing specs which passed `0.15.0`.* Measured on the released jar against `0.15.0` (§52): `hello-orders` (fresh bundle) and a fresh `init` scaffold validate with finding lists identical to `0.15.0`'s; `hello-orders` generates 14 files whose only change is the namespace fix; `templates` is unchanged for all four languages; every new diagnostic code is in the CHANGELOG. **(1) `x-ai.dataHandling`** (#153): `personalData` + `providerRegion`, and the generated Python worker refuses to start when the configured provider region differs (`AsyncAPI_Handbook.md` §4.3). New kit rules `specfuse-async-ai-shape` (warn, closes `x-ai` over its ten documented keys), `specfuse-async-ai-data-handling-shape` (error) and `specfuse-async-ai-personal-data-region` (warn); fixture `ai-data-handling.yaml`. **(2) Breaking C#:** `PROJECT_EVENT_RUNTIME_REQUIRED` (`Project_File.md` §10); enum columns store the wire value and an encrypted enum is really encrypted, both needing data migrations (`Vendor_Extensions.md` §1.4.1, §1.5). **(3) New findings:** `ENTITY_MISSING_ID` (ERROR) / `ENTITY_MISSING_AUDIT_FIELD`; `ARAZZO_STEP_PAYLOAD_MISSING_REQUIRED` (ERROR) / `_UNDECLARED_PROPERTY`; `ASYNC_EMITS_NO_EMIT_OPERATION`, `ASYNC_WORKER_SELF_TRIGGER`, `FUNCTIONAL_TEST_TAG_UNGROUPED`; `TEST_GRANTS_GRANT_INVALID`, `TENANT_REMOTE_REFERENCE_FOREIGN_KEY_MISMATCH`, `INLINE_ENUM_SCHEMA` on an `allOf`-wrapped enum. **(4) Closed:** every §49 issue (`#2564`–`#2571`), §19, §44 item 8. **(5) Kit rules widened to match the jar:** `specfuse-xprotection-unavailable-properties-required` now covers an encrypted value object declared `storage: flatten` (the jar has required it since `0.14.0`); `specfuse-no-inline-enums` catches an `allOf`-wrapped inline enum. **(6) Ships** the business-retention docs and the `Error.code` note (§51, corrected in §52). **Spec-author action:** register `eventRuntime` or drop `x-emits` where `service` is generated; migrate enum columns and encrypted enums; give every entity an id; fix Arazzo step payloads; declare `dataHandling` on AI workers that touch personal data. | | `v0.26.0` (incubating) | generator **`0.17.0`** — `Specfuse/generator-dist` release `v0.17.0`, asset `specfuse-generator-0.17.0.jar`, sha256 `2f2026fb…9ad3` | **⚠ BREAKING for C# consumers that reference a double-pluralized worker name or a `Var`-prefixed navigation, and for clients that relied on an individual list parameter being ignored.** *Minor: a generator pin bump with consumer-breaking C# renames, a list-query behaviour change and one new ERROR path (a nested list across pillars). No kit Spectral rule changes.* Measured on the released jar against `0.16.0` (§53): `hello-orders` (fresh bundle) validates with a JSON report byte-identical to `0.16.0`'s and generates 14 byte-identical files; a fresh `init` scaffold validates with the same five finding codes; `templates` is unchanged and `extensions` differs only in the order of one value set; `check-extension-vocabulary.py --require-jar` passes. **(1) Breaking C#:** worker registration files and classes are pluralized once (`Peoples` → `People`, `CompanyConsumerRegistration.g.cs` → `CompaniesConsumerRegistration.g.cs`, `#2646`); a navigation named after its target type keeps that name (`VarClient` → `Client`, `#2642`). Hand-written code referencing the old names must be renamed; no schema change. **(2) Individual list parameters bind** in the generated C# list (`#2648`): key, filterable, enum, searchable, range and repeated values each narrow the list (`API_Handbook.md` §10.3). An enum or value-object array parameter is not bound and is reported `OPERATION_LIST_PARAMETER_NOT_BOUND` (WARNING). **(3) Pillars** (`Vendor_Extensions.md` §14.6, §14.10): a filtered C# group with `event` + `service` now builds (`#2639`, closes §44 item 9); a nested list under another pillar's parent fails `validate` with `OPERATION_NESTED_LIST_NO_RELATIONSHIP` (`#2652`); `PROJECT_EVENT_RUNTIME_REQUIRED` counts only the operations a group's scope keeps (`#2651`). **(4) New finding:** `ENTITY_TAG_UNDECLARED_PUBLISHED` (WARNING), a safe read whose C# controller sends an `ETag` its response does not declare (`#2641`, `Vendor_Extensions.md` ETag table). **(5) Fixed without a kit change:** `OPERATION_NON_SEARCHABLE_QUERY_PARAM` checks a `Basic{Entity}` list item against its own entity (`#2665`); Dart and TypeScript test builders seed a declared date (`#2594`, `#2638`); C# timer triggers record a `ScheduleHeartbeat` event (`#2666`). **(6) Ships** the corrections of authoring#157. **Spec-author action:** rename consumer references to the C# names in (1); review list operations that declare individual parameters, since they now filter; declare `ETag` on reads `ENTITY_TAG_UNDECLARED_PUBLISHED` names; flatten any list nested under another pillar's parent. | | `v0.27.0` (incubating) | generator **`0.18.0`** — `Specfuse/generator-dist` release `v0.18.0`, asset `specfuse-generator-0.18.0.jar`, sha256 `b8ef150e…5e3b1ae` | **⚠ BREAKING for any project scaffolded by kit `≤ 0.26.0` that adopts the new `Error` shape, for clients that branch on `Error.code` as a rule name, and for a spec that nests a write route under another pillar's parent.** *Minor: a generator pin bump that adds C# exception constructors, turns one generate-time failure into a `validate` ERROR and adds three findings, shipped with the kit's `Error` shape change.* Measured on the released jar against `0.17.0` (§55): `hello-orders` (fresh bundle) validates with a JSON report byte-identical to `0.17.0`'s and generates 15 files, identical but for the timestamp in `Domain.generated-paths.json`; a fresh `init` scaffold validates with the same finding codes; `templates` is unchanged and `extensions` differs only in the order of one value set; `check-extension-vocabulary.py --require-jar` passes; the §14.10 pillar matrix gives the same verdict on every row. **(1) The kit's `Error`** carries the HTTP status in an integer `code` and the rule name in `reason`, drops `status`, makes `id` a plain string and adds `type` with an `ErrorType` enum (§54, authoring#159). Breaking on the wire for a client deployed against the old shape; §54 has the migration. A new prose rule, `specfuse-error-rule-name-in-code` (warn), lists the prose still writing a rule name into `code` (authoring#163). **(2) Reason constructors** (`clabonte/generator#2671`): the six exceptions a rule refuses with take `(string reason, string message)` and set `Code`, `Type` and `Reason`; `Error.Id` follows the schema (`API_Handbook.md` §11). Closes §54's generator follow-up. CI's error-shape probe now calls all six. **(3) Pillars** (`Vendor_Extensions.md` §14.3, §14.10, `Project_File.md` §8.13.2): a write route nested under another pillar's parent fails `validate` with `OPERATION_NESTED_CROSS_PILLAR` (ERROR, `#2680`), where it used to pass and fail `generate`; `PROJECT_HELD_ENTITY_MISSING` (warn, `#2682`) and `PROJECT_CONFIGURATION_CONVERTERS_MISSING` (warn, `#2673`) report a group that would not build; a Domain group with nothing to register builds (`#2678`); a value object or enum no entity reaches follows its own `x-domain` (`#2679`). **(4) Tenancy:** a marker named `ITenantScoped` or `ISubTenantScoped` is refused at load, `PROJECT_TENANCY_MARKER_RESERVED` (`#2672`, `Project_File.md` §4.1); closes §53 item 1. **(5) Fixed without a kit change:** a schema named after an event-runtime or implicitly imported .NET type compiles (FEAT-2026-0226); snapshot doc comments cite `Change{T}` (`#2701`); the Markdown channel topology and event catalog place publishers on the producing side and list every message a multi-message worker consumes (`#2677`, `#2704`). **(6) Ideation:** the dossier records `started:` with `graduated_to` (authoring#161). **Spec-author action:** adopt §54's `Error` shape and throw rule refusals with the reason constructors; move any write operation nested under another pillar's parent to the entity's own path; register `heldEntity` in each pillar that holds, and `heldEntityConfiguration` beside `infrastructureProject`; rename a tenancy marker called `ITenantScoped`. | -| `v0.30.0` (incubating, current) | generator **`0.21.0`** — unchanged; `Specfuse/generator-dist` release `v0.21.0`, asset `specfuse-generator-0.21.0.jar`, sha256 `a78b5ea7…27f08a94` | **Adopter docs ship with the kit.** *Minor, not patch: the overlay delivers new files into every project.* **No pin change.** `init` and `upgrade` now copy into `.specfuse/authoring/docs/`, beside `flows.html`: `component-repos.md`, `add-component.md`, `csharp-component-guide.md` with its interactive map `csharp-component.html`, and `generator-releases.md`; and the starter generated-code contract to `.specfuse/authoring/templates/component-contract/`. A component repo checked out beside its spec repo reads the guide and seeds the contract from there, and the seeded `CLAUDE.md` of a new component points its agent at the guide. Links from those docs to files the overlay does not carry (`compatibility.md`, `getting-started.md`, `generator-access.md`, `examples/`) are now GitHub URLs, held by the new CI check `scripts/check-shipped-docs.py`. The `0.21.0` entry in `generator-releases.md` is marked published. **Also fixed:** `upgrade` counted every changed kit file as "locally-modified or unowned" in its summary, so an ordinary upgrade reported overwrites with no warning to explain them; only files it actually warns about are counted now. **Spec-author action:** none; run `specfuse authoring upgrade` to receive the docs. | +| `v0.31.0` (incubating, current) | generator **`0.23.0`** — `Specfuse/generator-dist` release `v0.23.0`, asset `specfuse-generator-0.23.0.jar`, sha256 `b906ed3f…5ffacc6` | **⚠ BREAKING for C# projects whose `name` differs from their groups' root, for two C# groups emitting the same layer without `pillar`, for kiosk apps that relied on path-level admission, and for hand-written `[ScopesRequired]` without `OperationId`.** *Minor: a two-release pin bump (`0.22.0` and `0.23.0`, both published 2026-10-28/29), plus the project generator pin (#169), Markdown groups read from the project file (#191) and several-pillar worker guidance (#192).* Measured on the released jar against `0.21.0` (§59): `hello-orders` (fresh bundle) validates with identical finding codes (19 warnings, 0 errors); `extensions --format json` is unchanged; `templates` adds `EventActorScope` and four authorization templates (`IOperationAuthorizer`, `OperationAuthorizer`, `OperationInvocation`, `OperationAuthorizationCatalog`); `check-extension-vocabulary.py --require-jar` passes with output identical to `0.21.0`. **(1) Breaking:** per-group `basePackage` namespaces and `AMBIGUOUS_LAYER_OWNER` (`Project_File.md` §8.5, §9); kiosk-session admission per operation (`Vendor_Extensions.md` §3.3, security fix); `[ScopesRequired]` must carry a catalogued `OperationId` (`Project_File.md` §16); generated service tests assert event contents and sets; `TestSeed.SeedSpareParents` consumer step. **(2) New:** named `genericHost` pools (`Project_File.md` §17.1, already documented in #193); `IOperationAuthorizer`; `ARAZZO_ACTOR_LACKS_SCOPE` exempts 403 denial steps; nested `emit.expect` maps and `ARAZZO_MATCH_EXPRESSION_UNBOUND` (`Arazzo_Handbook.md`); `EventEnvelope.UserId` filled via `EventActorScope`. **(3) Kit:** `specfuse authoring generate` honours a project `.specfuse/generator.lock` and `SPECFUSE_GENERATOR_JAR` (#175); `generate-scenario-docs.sh` runs the project file's Markdown groups (#194); C# guide §4.4 documents the new consumer steps. Release notes: `docs/generator-releases.md`. **Spec-author action:** flag every operation a kiosk app calls; give same-layer C# groups distinct `pillar`s; C# components call `TestSeed.SeedSpareParents(context)` in `EnsureFakeData()`, set `OperationId` on hand-written `[ScopesRequired]`, and fix `using .` lines if `name` differs from the groups' root. | +| `v0.30.0` (incubating) | generator **`0.21.0`** — unchanged; `Specfuse/generator-dist` release `v0.21.0`, asset `specfuse-generator-0.21.0.jar`, sha256 `a78b5ea7…27f08a94` | **Adopter docs ship with the kit.** *Minor, not patch: the overlay delivers new files into every project.* **No pin change.** `init` and `upgrade` now copy into `.specfuse/authoring/docs/`, beside `flows.html`: `component-repos.md`, `add-component.md`, `csharp-component-guide.md` with its interactive map `csharp-component.html`, and `generator-releases.md`; and the starter generated-code contract to `.specfuse/authoring/templates/component-contract/`. A component repo checked out beside its spec repo reads the guide and seeds the contract from there, and the seeded `CLAUDE.md` of a new component points its agent at the guide. Links from those docs to files the overlay does not carry (`compatibility.md`, `getting-started.md`, `generator-access.md`, `examples/`) are now GitHub URLs, held by the new CI check `scripts/check-shipped-docs.py`. The `0.21.0` entry in `generator-releases.md` is marked published. **Also fixed:** `upgrade` counted every changed kit file as "locally-modified or unowned" in its summary, so an ordinary upgrade reported overwrites with no warning to explain them; only files it actually warns about are counted now. **Spec-author action:** none; run `specfuse authoring upgrade` to receive the docs. | | `v0.29.0` (incubating) | generator **`0.21.0`** — `Specfuse/generator-dist` release `v0.21.0`, asset `specfuse-generator-0.21.0.jar`, sha256 `a78b5ea7…27f08a94` | **⚠ BREAKING for a spec whose operation emits another entity's event, for C# components of a project that declares `tenancy`, and for event handlers still overriding `HandleCoreAsync`.** *Minor: a two-release pin bump (`0.20.0` was never published to `generator-dist`, so it ships here), with breaking validation and runtime changes, four new spec surfaces and the end of the release hold on `clabonte/generator#2882`–`#2884`.* Measured on the released jar against `0.19.0` (§58): `hello-orders` (fresh bundle) validates with identical finding codes and generates the same files; a fresh `init` scaffold validates with the same 19 codes; `extensions` adds only `x-entity.visibility`; `templates --language csharp` adds `hostedTopicConsumer`, `tenantIsolationTest`, `bareIgnoreSourceScanTest` and 32 templates; `check-extension-vocabulary.py --require-jar` passes once `specfuse-xprotection-shape` accepts `unmask`. **(1) Breaking:** `OPERATION_EMITS_FOREIGN_ENTITY` (ERROR, `API_Handbook.md`); `TRIGGER_REQUIRES_EVENT_RUNTIME_IMPL` (load failure, `Project_File.md`); `ASYNC_SUBSCRIPTION_FILTER_TOO_LONG` (ERROR on a `filterOverride`, `AsyncAPI_Handbook.md`); `HandleAsync` abstract and `HandleCoreAsync` removed; C# projects with `tenancy` get a generated `Tenant` query filter and must register an `IRecordVisibilityResolver`; hidden rows answer 404, not 403; Python AI workers need `primary_model`. **(2) New spec surfaces** (`Vendor_Extensions.md`): `uniqueBy` `where` / `nullsDistinct`; `x-protection.unmask` and `x-unmask` on PUT/PATCH (#182); `x-entity.visibility`. `specfuse-xentity-shape` and `specfuse-xprotection-shape` widened to match, fixture `uniqueby-visibility-unmask.yaml`. **(3) Project file** (`Project_File.md` §4.1, §17, §18): `workerPlacement`, `tenancy.enforcement: route`, `functionalTests.emitAssertions`, `generateUserHelper`; `tenancy` no longer required for services or the event runtime. **(4) Kit:** `add-component` drops both refusals and derives Python roots as the generator now does, and its C# seed now configures JWT bearer authentication: since `0.20.0` registers the role filters itself, a seed with no scheme answered every role-gated request with a 500 (caught by `example-regen` on this bump). The C# guide documents both and the `Tenant` filter. Release notes: `docs/generator-releases.md`. **Spec-author action:** move a foreign `x-emits` entry to the owning entity's operation; register `eventRuntimeImpl` beside any topic trigger; C# components with `tenancy` register an `IRecordVisibilityResolver` (or set `tenancy.enforcement: route` while migrating); replace `HandleCoreAsync` overrides; set `_PRIMARY_MODEL` for Python AI workers. | | `v0.28.0` (incubating) | generator **`0.19.0`** — `Specfuse/generator-dist` release `v0.19.0`, asset `specfuse-generator-0.19.0.jar`, sha256 `110f49f3…fe024f83` | **⚠ BREAKING for a project file still declaring a legacy artifact id, for a spec with a required property no create fills, and for clients that display an encrypted date.** *Minor: a generator pin bump with three breaking validation changes, three new spec surfaces and two new kit Spectral rules.* Measured on the released jar against `0.18.0` (§57): `hello-orders` (fresh bundle) validates with the same finding codes and generates 17 files, two more than before (`DateMask.g.cs` and a regen `CHANGELOG.md`); a fresh `init` scaffold validates with the same codes; `extensions` adds only the top-level `media-type` key; `check-extension-vocabulary.py --require-jar` passes. **(1) Breaking:** the fifteen artifact ids deprecated in `0.11.0` now fail the load (`Project_File.md` §11.4.1). `CREATE_REQUIRED_PROPERTY_UNPOPULATED` is an ERROR (`API_Handbook.md` §1.9). `CROSS_SPEC_VALIDATION_SKIPPED` is an ERROR when nothing else failed. An encrypted `format: date` with no `masking` now reads back as `0004-01-01`. On a C# mutable value object, `==` now compares by value. **(2) Date masking** (`Vendor_Extensions.md` §1.5, `API_Handbook.md` §1.4.1): `masking.reveal`, `maskedProperties`, and keeping a masked date that a PUT or PATCH sends back. New kit rule `specfuse-xprotection-masking-target` (error), and `specfuse-xprotection-shape` accepts `reveal`. **(3) `x-populate-from`** (`Vendor_Extensions.md` §1.11): a required field filled from the caller or the clock at create time. **(4) `x-stream`** (`API_Handbook.md` §1.10, `Vendor_Extensions.md` §5.2): streamed responses are declared and validated, not yet generated. New kit rule `specfuse-xstream-declaration` (error). **(5) Also:** typed `HandleAsync` worker methods (`HandleCoreAsync` deprecated); `ARAZZO_ACTOR_ROLE_NOT_PERMITTED` (WARNING); `FLATTEN_NESTING_TOO_DEEP` (ERROR); `ENTITY_MISSING_AUDIT_FIELD` no longer fires on a non-mutable entity; an unknown `x-protection` sub-key no longer aborts the other validation passes. **(6) Ships** PR #166 (§56). **Spec-author action:** rename legacy artifact ids; give every required create-time field a route (`Vendor_Extensions.md` §1.11); add `maskedProperties` where `MASKED_PROPERTIES_NOT_DECLARED` warns; declare `reveal` (and `nullable: true`) on encrypted dates that clients display; move `HandleCoreAsync` overrides into the typed methods. | @@ -1618,6 +1619,26 @@ This bump processes the consumer's `uniqueby-nulls-distinct-where.md` and `unmas **Not measured:** a C# build of a project declaring `tenancy` with the `Tenant` filter and a host-registered resolver, and a Python AI-worker run with `primary_model`; both rest on the CHANGELOG and the source. +### 59. Generator `0.23.0` pin bump (kit `0.31.0`) + +**How it was measured.** On the released jar (`v0.23.0`, sha256 `b906ed3f6bd8e6d657ff5e14d82cacb545ce46fc9674fb8d0d67551535ffacc6`, downloaded from `Specfuse/generator-dist` and checked against its `.sha256` asset), with `0.21.0` (`a78b5ea7…27f08a94`) as the baseline. `0.22.0` was published the day before and is folded in; its jar was not measured separately. + +- `hello-orders`, freshly bundled: `validate` passes on both jars, 0 errors and 19 warnings, identical finding codes. +- `extensions --format json`: no difference. `check-extension-vocabulary.py --require-jar` output is identical on both jars apart from the jar name. +- `templates`: adds `csharp/eventRuntime/Domain/Events/EventActorScope` and `csharp/api/Authorization/{OperationAuthorizationCatalog,OperationInvocation,IOperationAuthorizer,OperationAuthorizer}`. Nothing removed. +- `example-regen.yml` regenerates hello-orders, validates a fresh scaffold and runs the C# starter contract on the pinned jar in CI. +- In `Project.class`, `WORKER_PLACEMENT_POOL_NAME_INVALID` and `WORKER_PLACEMENT_POOL_EMPTY` are `addError` (measured for #193). + +**Handbook changes.** +- `Project_File.md`: §8.5 per-group `basePackage` namespaces; §9 `AMBIGUOUS_LAYER_OWNER`; §11.1 `authorizationRuntime` emits `IOperationAuthorizer` and friends; §16 `[ScopesRequired]` carries `OperationId`; §17.1 named pools and §17.2 several pillars (merged earlier as #193). +- `Vendor_Extensions.md` §3.3: kiosk-session admission per operation. +- `Arazzo_Handbook.md`: the 403 exemption of `ARAZZO_ACTOR_LACKS_SCOPE`; nested `expect` maps and `ARAZZO_MATCH_EXPRESSION_UNBOUND`. +- `docs/csharp-component-guide.md` §4.4: `TestSeed.SeedSpareParents`, event-asserting service tests, `EventActorScope`. + +**Spectral.** No change: the vocabulary is unchanged. + +**Not measured:** a C# build of a project whose `name` differs from its groups' root, a two-pillar project, and a kiosk-session runtime; these rest on the generator CHANGELOG. Several-pillar point 4 (one database per pillar) and `workerPlacement.schedules` / `runtime` wait on FEAT-2026-0243, which is not in `0.23.0`. + ## Outstanding kit-side work These are gaps in the kit itself, separate from the generator-side follow-ups above. Each represents an enforcement promise the handbooks make that has no implementation today. diff --git a/docs/csharp-component-guide.md b/docs/csharp-component-guide.md index f03dc12..0b2f9da 100644 --- a/docs/csharp-component-guide.md +++ b/docs/csharp-component-guide.md @@ -232,6 +232,10 @@ With a Test group, the generated tests derive from and call three hand-written t The generated `TestSeed` (stable GUIDs and a pre-wired entity graph) and the `A.{Entity}()` builders point at each other; `EnsureFakeData()` is where you seed that graph into the test database. A bare `A.Order()` is not a self-contained row: it carries foreign keys to `TestSeed` ancestors, and a read through the generated query filters joins them. +From generator 0.22.0, also call `TestSeed.SeedSpareParents(context)` from `EnsureFakeData()`, beside the rows you already add. It seeds a spare parent row for each `uniqueBy` tuple made only of references (one gadget per owner), so the generated create test does not collide with the seeded child and answer 409. It is emitted on every `TestSeed`, empty when no tuple needs it, so the call can stay put. Without it, the create test answers 404 on the parent lookup. + +Also from 0.22.0, the generated service unit tests assert what each emitted event carries and the exact set of events an update emits, including `x-trigger-when` transitions. A red service test after a regen means the service emits something other than what the spec implies, not a flaky test: fix the service, there is no opt-out. Events now carry the acting user: generated controllers and worker handler bases enter `EventActorScope`, so `EventEnvelope.UserId` is filled. Hand-written code that emits on behalf of a user outside those entry points (a hand-written endpoint, a hub, a background service) wraps the work in `using var _ = EventActorScope.Enter(userId);` with the domain user id. + ## 5. Extending generated code Never edit a file under `gen-src/`. A wrong generated file is fixed in the spec or in the generator, then regenerated; an edit disappears on the next run. The one exception, a tracked patch while a generator fix is pending, is §9.1. Four patterns cover everything else, all in `src/`, all in the generated type's own namespace. diff --git a/docs/generator-releases.md b/docs/generator-releases.md index af8764d..c77d4f6 100644 --- a/docs/generator-releases.md +++ b/docs/generator-releases.md @@ -24,6 +24,51 @@ Newest first. An entry is **pending** until the kit release that pins it is publ | **Tracked issues** | you were waiting on a fix | | **Kit changes** | you want to know what moved in the handbooks, rules and tooling | +## 0.23.0 (with 0.22.0) + +**Status: pending.** Pinned by kit `v0.31.0` (jar sha256 `b906ed3f…5ffacc6`; full record in [`compatibility.md`](https://github.com/specfuse/authoring/blob/main/compatibility.md) §59). Generator release dates: 0.22.0 on 2026-10-28, 0.23.0 on 2026-10-29. + +The kit goes from **0.21.0 to 0.23.0**; everything below covers both releases. + +### Before you regenerate + +**Spec authors** + +- **Kiosk sessions are admitted per operation (0.22.0, security fix).** Flagging `GET /messages/{messageId}` with `x-kiosk-session: true` used to admit `PATCH` and `DELETE` on the same path. Now only flagged operations are reachable: flag every operation the kiosk app calls. See [`Vendor_Extensions.md`](../handbooks/Vendor_Extensions.md) §3.3. +- **`AMBIGUOUS_LAYER_OWNER` (load failure, 0.23.0).** Two C# groups that emit the same layer (`domainProject`, `infrastructureProject` or `apiProject`) and share no `pillar` now stop the load. Give them distinct `pillar`s, or register the layer's project artifact on one group. See [`Project_File.md`](../handbooks/Project_File.md) §9. +- **Nested `emit.expect` leaves are checked (0.22.0).** A nested leaf naming no payload member is an `ARAZZO_CROSS_SPEC_ERROR`, and an unbindable runtime expression fails generation with `ARAZZO_MATCH_EXPRESSION_UNBOUND`. See [`Arazzo_Handbook.md`](../handbooks/Arazzo_Handbook.md). + +**C# component repos** + +- **Cross-group namespaces follow each group's `basePackage` (0.23.0).** A project whose `name` differs from its groups' root used to generate `using .Domain…;` and fail to build; it now names the owning group's namespace. If you wrote `using .…;` by hand, change it. Nothing moves when `name` already equals the groups' root. See [`Project_File.md`](../handbooks/Project_File.md) §8.5. +- **Call `TestSeed.SeedSpareParents(context)` from `EnsureFakeData()` (0.22.0).** Without it, generated create tests for a reference-only `uniqueBy` answer 404. See [`csharp-component-guide.md`](csharp-component-guide.md) §4.4. +- **Generated service tests assert events (0.22.0).** They check what each event carries and the exact set an update emits. A red test after regen means the service emits the wrong thing: fix the service. +- **`[ScopesRequired]` needs `OperationId` (0.22.0).** In `scopes` mode the filter decides through `IOperationAuthorizer`; a hand-written `[ScopesRequired]` without a catalogued `OperationId` answers 403. +- **`IKioskSessionPolicy` gains two members (0.22.0).** Only a hand-written implementation has to add them. +- **Overrides with optional value-type parameters (0.23.0).** A `{Op}Core` or `manualMethod` delete override with an optional `int`/`Guid` parameter changes it to `int?`/`Guid?`. + +### New in the spec + +- **Named worker pools (0.22.0).** `workerPlacement.messages.genericHost` can be an object of pools, each its own Deployment. See [`Project_File.md`](../handbooks/Project_File.md) §17.1, and §17.2 for projects with several pillars. +- **`IOperationAuthorizer` (0.22.0).** `authorizationRuntime` emits a transport-neutral check, so a worker or agent tool gets the decision REST makes for an `operationId`. +- **Denial scenarios under `scopes` (0.22.0).** `ARAZZO_ACTOR_LACKS_SCOPE` skips a step asserting `$statusCode == 403`. +- **Nested `emit.expect` maps compile (0.22.0)** under `emitAssertions: strict`, and `$setup.outputs.*` leaves bind. + +### Component repos + +- Events now name their user: generated controllers and worker handler bases enter `EventActorScope`, so `EventEnvelope.UserId`, the outbox `UserId` and the Service Bus `userId` property are filled. Code emitting on a user's behalf elsewhere wraps it in `EventActorScope.Enter(userId)`. +- Worth knowing from the fixes: optional headers are nullable on controller actions (a GET without `If-None-Match` no longer answers 400); the outbox drainer tags `outbox.claimed` so empty runs can be dropped before export; a `null` in an Arazzo request body compiles; `WithForbiddenRole` no longer fails with "No data found" when there is no role registry. + +### Tracked issues + +None of the kit's tracked generator issues closed in this pair. Still open for the kit: FEAT-2026-0243 (one database per pillar, `workerPlacement.schedules` / `runtime`), which [`Project_File.md`](../handbooks/Project_File.md) §17.2 marks "next generator release". + +### Kit changes + +- `specfuse authoring generate` honours a project's own `.specfuse/generator.lock` (version + SHA-256), and `SPECFUSE_GENERATOR_JAR` runs a local jar as unpinned ([#169](https://github.com/specfuse/authoring/issues/169)). +- `generate-scenario-docs.sh` runs the Markdown groups your project file declares, instead of two fixed names ([#191](https://github.com/specfuse/authoring/issues/191)). +- Handbooks document the changes above; the C# component guide adds the new consumer steps. No Spectral change. + ## 0.21.0 (with 0.20.0) **Status: published.** Pinned by kit `v0.29.0` (released 2026-10-28) (jar sha256 `a78b5ea7…27f08a94`; full record in [`compatibility.md`](https://github.com/specfuse/authoring/blob/main/compatibility.md) §58). Generator release date: 2026-10-28. diff --git a/generator.lock b/generator.lock index 20e8df5..26815bb 100644 --- a/generator.lock +++ b/generator.lock @@ -1,12 +1,12 @@ { - "kit_version": "0.30.0", + "kit_version": "0.31.0", "min_java": 21, "generator": { - "version": "0.21.0", - "asset": "specfuse-generator-0.21.0.jar", - "sha256": "a78b5ea74497f6c33e52191e8b84e50c1492b175e28aa6b153a52b7d27f08a94", + "version": "0.23.0", + "asset": "specfuse-generator-0.23.0.jar", + "sha256": "b906ed3f6bd8e6d657ff5e14d82cacb545ce46fc9674fb8d0d67551535ffacc6", "release_repo": "Specfuse/generator-dist", - "release_tag": "v0.21.0" + "release_tag": "v0.23.0" }, "_note": "Pin the kit<->generator contract here. On each generator release: set version/asset/sha256/release_tag, then publish a matching kit patch. sha256=PENDING means no generator is bundled yet; `specfuse authoring generate` will refuse with a clear message until a real jar is pinned." } diff --git a/handbooks/Arazzo_Handbook.md b/handbooks/Arazzo_Handbook.md index 03e8ef6..b5a8096 100644 --- a/handbooks/Arazzo_Handbook.md +++ b/handbooks/Arazzo_Handbook.md @@ -346,7 +346,8 @@ The role values are project-specific. The project declares its closed role set i - it runs only under `authorization.mode: scopes` (`Project_File.md` §16); under the default `roles` it never runs; - it compares grants: a `superuser: true` role and a step whose operation declares no `x-scopes` are skipped, and a role from a sequence-form registry grants nothing, so under `scopes` every step it takes on a scoped operation fails; -- it checks scopes, not membership. Membership is `ARAZZO_ACTOR_ROLE_NOT_PERMITTED` from generator `0.19.0`, in roles mode (above). +- it checks scopes, not membership. Membership is `ARAZZO_ACTOR_ROLE_NOT_PERMITTED` from generator `0.19.0`, in roles mode (above); +- from generator `0.22.0` it skips a step that asserts the refusal, `$statusCode == 403` (`clabonte/generator#3026`). Such a step runs as an under-granted actor on purpose, and the generated scope filter answers it with exactly that 403. Only 403 is exempt: a scope-lacking step asserting 401, 404 or 200 is still an ERROR. Through `0.21.0` deliberate denial scenarios under `scopes` reported one ERROR per denial step. **It fires from generator `0.15.0`, and never at `0.14.0`** (`clabonte/generator#2418`). Through `0.14.0` it looked each step's `operationId` up by exact key, while the generator keys operations PascalCased, so every step found no operation and was skipped. Measured on a mapping-form copy of `hello-orders` under `mode: scopes`, with a `Customer` whose grants miss the scenario's `order.*` scopes: `0.14.0` reports only `OPERATION_ROLE_LACKS_SCOPE` on the operations; a build of generator main adds one `ARAZZO_ACTOR_LACKS_SCOPE` per step (three). On `0.14.0`, read `OPERATION_ROLE_LACKS_SCOPE` as the check that catches an under-granted actor. @@ -644,6 +645,7 @@ steps: **Whether the generated C# scenario test checks `emit` is a project setting.** By default (`functionalTests.emitAssertions: off`) each entry is a comment for the reviewer and nothing is asserted. Under `strict` (generator `0.21.0`, `Project_File.md` §18) each entry becomes an awaited wait for the event and the test fails when it is never published: - `expect` is a subset match: only the declared keys are compared. Enum, `uuid`, decimal, `date` and `date-time` literals are typed, and `$steps` outputs bind to the step's own locals. An `emit` without `expect` matches on the event type alone. +- A nested map and the dotted spelling are the same from generator `0.22.0` (`clabonte/generator#3027`): `expect: { after: { punchType: clockIn } }` compares `after.punchType`, and a `$setup.outputs.*` leaf inside it binds to the setup state. Through `0.21.0` a nested map rendered one comparison against an anonymous type, which did not compile, and a `$setup` leaf stayed a string literal. `validate` resolves each nested leaf like a dotted key, so a nested leaf naming no member is an `ARAZZO_CROSS_SPEC_ERROR`. A runtime expression the predicate cannot bind (`$response.*`, `$statusCode`, `$message.*`, or one inside a list) fails generation with `ARAZZO_MATCH_EXPRESSION_UNBOUND`. The same applies to `x-async.await.match`. - The wait scans the outbox, so an event an **earlier** step wrote also satisfies a later `emit` of the same type. Key `expect` on something only this step produces, typically one of its own outputs (`$steps..outputs.`), when an earlier step can publish the same event. - `timeout` is the wait's limit, `PT10S` by default. diff --git a/handbooks/Project_File.md b/handbooks/Project_File.md index 4ba01a3..368d14a 100644 --- a/handbooks/Project_File.md +++ b/handbooks/Project_File.md @@ -736,6 +736,8 @@ The `side` field is present only for hybrid entities. **Type**: string. Format is language-specific — `HelloOrders.Domain` for C#, `hello_orders_contracts` for Python, `hello_orders_core` for Dart. +**C#: other groups reference a layer by its owner's `basePackage` (generator `0.23.0`, breaking).** When the Api group uses a domain type, it writes the namespace of the group that emits the Domain layer, not the project `name` plus `.Domain`. The same holds for `.Infrastructure`, `.Api` and `.Test`, and for `Assembly.Load` and `InternalsVisibleTo` targets. Through `0.22.0` a project with `name: Acme` and groups rooted at `Shop.*` generated `using Acme.Domain.Events;` and failed to build. A layer no group emits, the `Application` layer and `{name}DbContext` still use the project `name`. Nothing changes when `name` already equals the groups' root. In hand-written code, replace any `using .…;` that named the project root with the owning group's `basePackage`; a project that builds today has no such line. Two groups that emit the same layer must be told apart by `pillar`, or loading fails with `AMBIGUOUS_LAYER_OWNER` (§9). + ### 8.6 `destination` **Purpose**: Output directory for everything this group emits. @@ -985,6 +987,7 @@ The project file fails to load when any of the following conditions hold. All er | `UNKNOWN_PILLAR_FILTER` | `groups[].pillar` names a pillar `info.x-pillars` does not declare — or the registry is absent or empty. Raised at filter-application time, not at parse time. | | `EMPTY_PILLAR_DOMAINS` | `groups[].pillar` names a pillar that owns zero domains. | | `UNKNOWN_LANGUAGE` | `groups[].language` not registered. | +| `AMBIGUOUS_LAYER_OWNER` | **From generator `0.23.0`, breaking.** Two C# groups emit the same layer (both register `domainProject`, `infrastructureProject` or `apiProject`), share no `pillar` and differ in `basePackage`, so a group that reads the layer cannot tell which namespace to use. Raised before any destination is cleaned. Fix: give the groups distinct `pillar` values (a reading group takes the owner in its own pillar, else the one group without a `pillar`), or register the layer's project artifact on one group only (§8.13.2). | | `UNKNOWN_AUTHORIZATION_MODE` | `authorization.mode` is neither `roles` nor `scopes` (§16). | | `AUTHORIZATION_SHADOW_REQUIRES_SCOPES_MODE` | `authorization.shadow: true` with `mode` absent or `roles` (§16). | | `UNKNOWN_ROLES_SHAPE` | `authorization.claims.rolesShape` is neither `name` nor `object` (§16). | @@ -1075,7 +1078,7 @@ Three opt-in artifact ids, none in the lists above, which predate them. Each is | Id | Languages | What it emits | |---|---|---| -| `authorizationRuntime` | C#, TypeScript, Dart, Python | **C#** (API group): the whole gate in `{apiPackage}.Authorization` — `AuthorizedRole`, `RoleRequiredAttribute` / `RoleRequirement` / `RoleAuthorizationHandler` / `RoleAuthorizationFilter`, `ScopesRequiredAttribute` / `ScopeRequirement` / `ScopeAuthorizationHandler` / `ScopeAuthorizationFilter`, `PrincipalRole`, `IPrincipalReader` + `ClaimsPrincipalReader`, `IPrincipalPolicy` (allow-all default), `ITenantResourceCheck`, `IKioskSessionPolicy` + `KioskSessionPolicy`, `IGrantResolver`, `RoleGrants`, `ScopeCatalog`, `GrantMatcher`, and `AddSpecfuseAuthorization()`. **TypeScript, Dart, Python**: `RoleGrants`, `ScopeCatalog` and the grant matcher only (`grantCovers` / `hasGrant`, `grant_covers` / `has_grant`). | +| `authorizationRuntime` | C#, TypeScript, Dart, Python | **C#** (API group): the whole gate in `{apiPackage}.Authorization` — `AuthorizedRole`, `RoleRequiredAttribute` / `RoleRequirement` / `RoleAuthorizationHandler` / `RoleAuthorizationFilter`, `ScopesRequiredAttribute` / `ScopeRequirement` / `ScopeAuthorizationHandler` / `ScopeAuthorizationFilter`, `PrincipalRole`, `IPrincipalReader` + `ClaimsPrincipalReader`, `IPrincipalPolicy` (allow-all default), `ITenantResourceCheck`, `IKioskSessionPolicy` + `KioskSessionPolicy`, `IGrantResolver`, `RoleGrants`, `ScopeCatalog`, `GrantMatcher`, and `AddSpecfuseAuthorization()`. From generator `0.22.0` it also emits `IOperationAuthorizer` + `OperationAuthorizer`, `OperationInvocation` and `OperationAuthorizationCatalog`: a transport-neutral check that gives a caller with no `HttpContext` (a worker, an agent tool) the decision the REST scope path makes for an `operationId`, refusing an `operationId` the catalog does not list. **TypeScript, Dart, Python**: `RoleGrants`, `ScopeCatalog` and the grant matcher only (`grantCovers` / `hasGrant`, `grant_covers` / `has_grant`). | | `authorizationConformanceTest` | C#, TypeScript, Dart, Python | **C#** (Test group): `AuthorizationConformanceTests`, `FakeTenantResourceCheck`, `RoleClaimsTestPrincipalFactory`, `AuthorizationTestSupport.ForbiddenRoles`. Registering it also moves the generated `WithForbiddenRole` theory onto `ForbiddenRoles`, derived as registry − listed − superuser − implicit with no role hierarchy. **TypeScript, Dart, Python**: one test per grant-matcher known-answer vector, the table every runtime is proved against so no two disagree on a wildcard. | | `authorizationMatrix` | Markdown | See §11.5. | @@ -1444,6 +1447,8 @@ All four fail `Project.Load`, like the codes under "Where it is checked" below, **Switch only on a coherent registry.** `scopes` admits whichever roles' grants cover an operation's scopes, whatever its `x-roles` lists, so every `OPERATION_ROLE_UNLISTED` WARNING under `roles` is a role that `scopes` lets in. Read the `authorizationMatrix` artifact (§11.5) first, or run `shadow` in production before switching. From generator `0.15.0` the switch also checks every Arazzo actor against its role's grants (`ARAZZO_ACTOR_LACKS_SCOPE`, `Arazzo_Handbook.md` §4.6), and a sequence-form `info.x-roles` grants nothing: unmodified `hello-orders` passes `validate` under `scopes` on `0.14.0` and fails it with three of those ERRORs on a build of generator main. Move the registry to the mapping form first. +**Every `[ScopesRequired]` names its operation (generator `0.22.0`).** The generated attribute always carries `OperationId`, and in `scopes` and `scopes + shadow` mode `ScopeAuthorizationFilter` decides through `IOperationAuthorizer`, so REST and non-HTTP callers run one code path. A `[ScopesRequired]` with no `OperationId`, or one the catalog does not list, is refused with 403. A hand-written controller that uses the attribute must set `OperationId` to an operation of the spec. Roles mode is unchanged. + **The attribute is not the runtime.** `mode: scopes` changes the attribute on the controller whether or not the group registers `authorizationRuntime` — measured: without it, the controllers still carry `[ScopesRequired]` and import `{apiPackage}.Authorization`, which then has to supply that type. Register `authorizationRuntime` (§11.1), or own a hand-written `ScopesRequiredAttribute` in that namespace. ### `shadow` diff --git a/handbooks/Vendor_Extensions.md b/handbooks/Vendor_Extensions.md index 5b7ca11..f1a6489 100644 --- a/handbooks/Vendor_Extensions.md +++ b/handbooks/Vendor_Extensions.md @@ -2968,7 +2968,9 @@ paths: x-kiosk-session: true # boolean; absent means false ``` -**What it does.** The generated `KioskSessionPolicy` is an allowlist of the route templates of every operation declaring `x-kiosk-session: true`. `RoleAuthorizationFilter` (and, in `scopes` mode, `ScopeAuthorizationFilter`) checks it **before** the role or scope check: a principal whose `ClaimsIdentity.AuthenticationType` equals `authorization.kioskSession.scheme` (`Project_File.md` §16), calling a route outside the allowlist, gets `403`, fail-closed. +**What it does.** The generated `KioskSessionPolicy` is an allowlist of every operation declaring `x-kiosk-session: true`. `RoleAuthorizationFilter` (and, in `scopes` mode, `ScopeAuthorizationFilter`) checks it **before** the role or scope check: a principal whose `ClaimsIdentity.AuthenticationType` equals `authorization.kioskSession.scheme` (`Project_File.md` §16), calling an operation outside the allowlist, gets `403`, fail-closed. + +**Flag each operation, not each path (generator `0.22.0`, security fix).** From `0.22.0` the filters ask `IsAllowed(httpMethod, routeTemplate)` and `IOperationAuthorizer` asks `IsOperationAllowed(operationId)`, so the decision is per operation. Through `0.21.0` the allowlist held route templates: flagging `GET /messages/{messageId}` also admitted `PATCH` and `DELETE` on the same path. Now a method that shares a flagged operation's path is refused unless it is flagged itself, and a `HEAD` on a flagged `GET` route is refused. Flag every operation the kiosk app calls. A host that implements `IKioskSessionPolicy` by hand must add the two new members; `IsAllowed(routeTemplate)` remains, template-level and unused by generated code. **It is inert until the scheme is declared.** With no `authorization.kioskSession.scheme`, no principal is ever recognised as a kiosk session, and the generated policy allows every route. Measured on a `hello-orders` copy with `x-kiosk-session: true` on `getCustomer`: without the scheme `KioskSessionPolicy.IsAllowed` returns `true` unconditionally; with `scheme: KioskSession` the filter tests `AuthenticationType == "KioskSession"` and the allowlist holds exactly that operation's route. diff --git a/pyproject.toml b/pyproject.toml index 1365c2c..b6492a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "specfuse-authoring" -version = "0.30.0" +version = "0.31.0" description = "Specfuse authoring kit: handbooks, samples, Claude assets, project bootstrap, and the generator launcher." readme = "README.md" requires-python = ">=3.10" diff --git a/specfuse/authoring/__init__.py b/specfuse/authoring/__init__.py index 4518b78..c2ea78d 100644 --- a/specfuse/authoring/__init__.py +++ b/specfuse/authoring/__init__.py @@ -3,7 +3,7 @@ from importlib.resources import files from pathlib import Path -__version__ = "0.30.0" +__version__ = "0.31.0" def kit_root() -> Path: