Skip to content

AIFACTORY-FEAT-180: API library template: OpenAPI generation, scope and propagation before the gateway clients

Generated from the architecture model

This page is rendered from model/**/*.yaml by tools/docs_model during mkdocs build. Edit the YAML, not this page; hand-written design lives on the linked service, platform and plane pages.

A design artefact, not a tracker

This backlog is generated from model/backlog/ and validated against the architecture model. No work item exists in any tracker, and no item carries a date, an estimate or an assignee (ADR-0029).

Epic Ecosystem component extensions · Increment I1 Generate a microservice · State elaborated · Route backend-developer · Phase before development · Build order 24 of 185 (Templates and libraries)

Before development

Template or library work: every task of this feature changes a template or a shared library the Factory builds on, and it lands before the Factory's own repositories of I1 are developed. The mark travels with every task (tag phase:before-development).

The typed clients of the three Factory gateways (FEAT-178) are scaffolded from the API library template, which ships a hand-written typed HttpClient with Polly resilience, five authentication layouts, optional metrics and service discovery, WireMock tests and scaffold tests over the authentication variants. Its maintainer checklist (Docs/Template TODO.md) leaves open exactly what the Factory needs first: client generation from an OpenAPI document, header propagation, instrumentation, and JWT and API key layouts listed as open while the authentication page describes them through the OAuth2 library; the roadmap names multi-tenant configuration as a long-term goal. The Factory adds its scope headers and workload-token acquisition, and the template gains a generated-solution gate across its layouts. Component: API library template (extend).

Delivers —
Stubs —
Realizes components: cmp-api-library-template
adrs: ADR-0022, ADR-0028
Requirements —
Depends on AIFACTORY-FEAT-090 Contracts package from the published schemas
Sources model/components.yaml, ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md, ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md, ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md

AIFACTORY-US-301: API library template: a generation switch produces the typed client, requests and responses from an OpenAPI document, and the hand-written client stays for an API without one

enabling · persona asset-maintainer As an asset maintainer, I want the API library template to generate the typed client of a library from the OpenAPI document of the API it wraps, so that a gateway client follows the published contract of its gateway and nobody copies a contract by hand.

The maintainer checklist of the template (Docs/Template TODO.md of the template) marks the interface, the client, the requests, the responses, the factory and the options of the HTTP client as shipped by hand, and marks client generation support through NSwag as open. The Factory generates the clients of its gateways from the OpenAPI documents the gateways publish, so a hand-written client per gateway would repeat every contract and drift from it. This PBI adds a boolean generation switch and a parameter for the path of the document to the template configuration. With the switch on, the build of the generated library runs the generator, pinned in central package management, over the document and produces the client interface, the client, the request types and the response types into the intermediate output. They are registered by the same dependency injection extension and bound to the same options as the hand-written client, so the resilience pipeline, the chosen AuthenticationType layout, UseMetrics and UseServiceDiscovery apply to both forms. Generated types are not committed: an ignore rule keeps them out of version control and every build regenerates them. With the switch off, the template generates the hand-written client of today unchanged. A document that is missing or does not parse fails the build with the path and the parser message named; the build never falls back to a client of an earlier build. The switch and the path parameter are named on the Features page of the template and appear in the parameter snapshot after the next inventory.

Acceptance criteria

AC1 Given a library generated with the generation switch on and a fixture OpenAPI document, when the library builds, then the client interface, the client, the request types and the response types are produced from the document, registered by the dependency injection extension of the template and bound to its options, and no generated type is under version control (ADR-0028: a gateway is one deployable with one published contract; model/template-parameters/connectsoft-api-library.yaml lists the switch and the path parameter after the next inventory).
AC2 Given a library generated with the switch off, when its output is compared with the output of the current template for every AuthenticationType choice, then the hand-written client, its requests, responses, factory and options are unchanged, so an existing consumer of connectsoft-api-library sees no difference (ADR-0028, model/templates.yaml keeps the row of the template).
AC3 Given a document path that does not exist or a document that does not parse, when the generated library builds, then the build fails with the path and the parser message named and no client of an earlier build is packed; the scaffold tests cover both failures (ADR-0028, docs/architecture/ecosystem-composition.md names OpenAPI generation as a need of this component).
Traces: adrs ADR-0028
Sources model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-api-library.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-1321 Generation switch and document path as symbols of the template configuration contract The template configuration defines a boolean generation switch, off by default, and a string parameter for the path of the OpenAPI document, with their command-line names in dotnetcli.host.json and their descriptions; the Features page of the template names both and states that the hand-written client is the default. ConnectSoft.ApiLibraryTemplate
AIFACTORY-TASK-641 Client generation from an OpenAPI document implementation With the switch on, the build of the generated library runs the pinned generator over the document and produces the typed client, requests and responses into the intermediate output, registered by the existing dependency injection extension; the hand-written client stays for an API without a document; generated types stay out of version control by an ignore rule; a missing or unparsable document fails the build with the path named. The open generation item of the maintainer checklist is closed. ConnectSoft.ApiLibraryTemplate
AIFACTORY-TASK-1322 Fixture gateway document and scaffold cases for the generated client fixture The scaffold test project holds a fixture OpenAPI document in the shape of a gateway contract and three cases: generation on with the fixture, generation off, and generation on with a missing and with a malformed document; the WireMock tests of the generated solution call an operation of the generated client. ConnectSoft.ApiLibraryTemplate
AIFACTORY-TASK-1323 Verify generation on, generation off and the two failing documents verification Run the scaffold cases of AIFACTORY-TASK-1322; the generated client builds and its WireMock test passes, the output with the switch off is unchanged and both failing documents fail the build with the path named, which proves AC1 to AC3 of AIFACTORY-US-301. ConnectSoft.ApiLibraryTemplate

AIFACTORY-US-302: API library template: under UseFactoryProfile the generated client sends the tenant and project scope headers and a workload token with the svc. scopes of its registration

enabling · persona asset-maintainer As an asset maintainer, I want the generated client to carry the scope of the caller and a token of its own workload identity through one handler, so that no Factory repository writes its own scope or token handler for a gateway call.

The template configuration offers five authentication layouts through AuthenticationType (None, Basic, OAuth, OpenIDConnect, ApiKey); the Authentication page of the template describes a JWT method that the maintainer checklist still lists as open. A Factory service, the command-line client and the agent host call a gateway as a workload, with the tenant and project of the work they do. This PBI adds the Factory shape of the template behind the boolean parameter UseFactoryProfile, off by default, the name every template uses for its Factory shape. Under the profile one delegating handler joins the chosen layout and is the single writer of the scope headers. It reads the scope from the scope accessor of ConnectSoft.Extensions.AI.Factory.Abstractions, which the generated library pins and never redefines. It writes the tenant header under the name the SaaS tenancy library defines, which the generated library pins, and the project header under the name ConnectSoft.Extensions.AI.Factory.Abstractions defines (AIFACTORY-US-220); these are the two sources the API gateway template validates against, so the client and the gateway cannot fork a header name. The contracts package is pinned for shared contract types only and names no header. The handler obtains a workload token by client credentials from the authorization server with the svc. service scopes of its workload registration and sends no resource or audience parameter: a workload token carries service scopes, no audience of a user API and no tenant claim, and the gateway or service that receives the call reads the forwarded tenant and project only when the token holds the svc. scope that names it. The token is cached until it expires, and no token or header value is written to a log. A call without a scope is refused before a request leaves the process. The gateway answers 404 for a resource of another tenant and 403 for a scope the token lacks inside the tenant; the client surfaces the two as distinct typed errors and the resilience pipeline retries neither. A 401 leads to one token refresh and then to a failure. A JWT bearer choice joins AuthenticationType for a caller that already holds a user token. A user token has one audience, the gateway that fronts its scopes, so the JWT bearer layout attaches a forwarded user token only to requests to the base address of the gateway the library fronts, and a library generated for a second gateway is given a token of its own.

Acceptance criteria

AC1 Given a library generated with UseFactoryProfile and a scope in the scope accessor, when the client calls its gateway, then the handler requests a client-credentials token with the svc. scopes of its workload registration and with no resource or audience parameter, reuses it until it expires, and sends the request with the token, the tenant header named by the pinned SaaS tenancy library and the project header named by ConnectSoft.Extensions.AI.Factory.Abstractions; the WireMock token endpoint asserts the requested scopes and the absence of a resource or audience parameter, and the test asserts the headers and that no log line holds a token or a header value (docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md decision 2 and its amendment on workload tokens; ADR-0022 decision 2 is the reason the tool gateway client exists).
AC2 Given the same library and no scope in the accessor, when the client is called, then the call is refused with an error that names the missing scope, and the WireMock server records no request (docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md decision 2: every Factory contract carries the trusted tenant id and project id).
AC3 Given the gateway stub answers 404 for a resource of another tenant, 403 for a scope the token lacks and 401 for an expired token, when the client is called, then 404 and 403 surface as distinct typed errors without a retry, and 401 leads to exactly one token refresh followed by a failure when the second answer is 401 (ADR-0028, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md).
AC4 Given the template without UseFactoryProfile, when a library is generated for each of the five existing AuthenticationType choices, then its output is unchanged, and the JWT bearer choice and UseFactoryProfile appear in model/template-parameters/connectsoft-api-library.yaml after the next inventory (ADR-0028 amendment on the Factory profile switch).
AC5 Given a library generated with the JWT bearer choice and a caller that holds a user token, when the client is called and the gateway stub redirects to a second host, then the token is attached only to requests to the base address of the gateway the library fronts and the second host receives none (docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md amendment on the audience: a user token has one audience, the gateway that fronts the granted scopes).
Traces: adrs ADR-0022, ADR-0028
Depends on feature:contracts-package, feature:component-extensions-ai, feature:component-auth-server-template-factory-tokens
Sources model/components.yaml, model/template-parameters/connectsoft-api-library.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0022-mcp-as-tool-protocol.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-1324 UseFactoryProfile and the JWT bearer choice in the template configuration contract The template configuration defines the boolean parameter UseFactoryProfile, off by default, and a JWT bearer choice of AuthenticationType with its computed symbol. Only under the profile the central package management of a generated library pins the SaaS tenancy library that names the tenant header, ConnectSoft.Extensions.AI.Factory.Abstractions (AIFACTORY-US-220), which holds the scope accessor and names the project header, and the contracts package for shared contract types; the generated code defines no header name of its own. The Authentication page of the template describes the JWT bearer layout and the profile. ConnectSoft.ApiLibraryTemplate
AIFACTORY-TASK-639 Scope and workload-token propagation implementation Under UseFactoryProfile one delegating handler is the single writer of the scope headers: it reads the pinned scope accessor and writes the tenant header under the name of the SaaS tenancy library and the project header under the name of ConnectSoft.Extensions.AI.Factory.Abstractions. It requests a client-credentials token with the svc. scopes of the workload registration and no resource or audience parameter, caches it until it expires, refuses a call without a scope before a request leaves, maps 404 and 403 to distinct typed errors that are not retried and refreshes the token once on 401. A JWT bearer layout joins the AuthenticationType choices and attaches a forwarded user token only to requests to the gateway of the library. No token or header value is logged. ConnectSoft.ApiLibraryTemplate
AIFACTORY-TASK-1325 WireMock token endpoint and gateway stub for the Factory profile fixture The test project of a library generated with the profile holds a WireMock token endpoint that asserts the requested svc. scopes and fails a token request that carries a resource or audience parameter, a gateway stub with the cases call with scope, call without scope, 404, 403, 401 once and 401 twice, a redirect case for the JWT bearer layout with a second host that records the tokens it receives, and a log capture that fails the test when a token or a scope header value is written. ConnectSoft.ApiLibraryTemplate
AIFACTORY-TASK-1326 Verify the scope headers, the workload token and the refusals verification Generate a library with UseFactoryProfile, one with the JWT bearer choice and one without the profile, build and test them; the cases of AIFACTORY-TASK-1325 pass on the first two and the third is unchanged, which proves AC1 to AC5 of AIFACTORY-US-302 (ADR-0022, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md). ConnectSoft.ApiLibraryTemplate

AIFACTORY-US-303: API library template: trace context propagates by registration in a web host and from the current activity elsewhere, and the client emits the HTTP client telemetry of the Factory conventions

enabling · persona asset-maintainer As an asset maintainer, I want the generated client to propagate trace context and scope by registration and to emit telemetry on the shared conventions, so that a call through a gateway is one trace with one scope and no library hand-sets a header.

The Service Discovery page of the template prescribes header propagation configured on the HTTP client defaults of the host and tells library authors not to hand-set W3C trace headers in a handler unless the host cannot use those packages. The maintainer checklist still lists headers propagation support and instrumentation support as open, and lists service discovery as open although UseServiceDiscovery ships. This PBI closes the two open items and keeps the exception of the page, because header propagation needs an inbound request and two consumers of the gateway clients, the command-line client and the agent host, have none. The dependency injection extension of a generated library takes a declared host mode. In the web host mode it registers header propagation for tracestate, baggage and the inbound correlation header on its client builder, for the fixed base address client and for the discovered client alike, and options validation fails with the registration named when the host has not enabled header propagation, instead of a silent loss of the headers. In the mode for a host without inbound requests, a command-line client, a worker or an agent host, the registration is skipped and nothing is validated. In both modes traceparent continues the current activity through the HTTP client instrumentation, and the generated code holds no handler that sets a trace header by hand. The scope headers are never taken from an inbound request: the delegating handler of AIFACTORY-US-302 is their single writer and works in every host mode, so a header a caller sent cannot become the scope of an outgoing call. For telemetry the library adds no enricher of its own: it uses the HTTP client instrumentation through the single registration of the observability libraries, which the generated library pins, so the activities and the metrics carry the names and the scope tags the Factory conventions define. No request body, response body or header value is written to a tag, a metric dimension or a log message. The existing UseMetrics switch keeps its meaning for custom metrics of the library. The Configuration and Service Discovery pages of the template describe the two host modes and the registration, and the checklist marks the three items by their real state.

Acceptance criteria

AC1 Given a web host that enables header propagation and a library generated from the template and registered in the web host mode, when a call is made while an inbound request with tracestate, baggage and a correlation header is served, then the three reach the WireMock server through header propagation, traceparent continues the current activity, and the generated code holds no handler that sets a trace header by hand (ADR-0028: what a host did once is done per repository by the scaffold; docs/architecture/ecosystem-composition.md names header propagation as a need of this component).
AC2 Given a library generated with UseFactoryProfile, when a call is made in either host mode, then the scope headers are written once, by the delegating handler of AIFACTORY-US-302 and not by header propagation, a scope header on the inbound request is not forwarded, and the HTTP client activity and metrics carry the names and the scope tags of the single registration of the observability libraries; a test asserts that no body or header value appears in a tag, a dimension or a log message (ADR-0028, model/components.yaml row of the observability libraries).
AC3 Given a web host that has not enabled header propagation, when it registers the generated client in the web host mode, then options validation fails with the missing registration named; given a console host that registers the client in the mode without inbound requests, then start-up succeeds, no header propagation is registered and a call made inside an activity carries the traceparent of that activity; the maintainer checklist of the template marks headers propagation, instrumentation and service discovery by their real state (ADR-0028, model/template-parameters/connectsoft-api-library.yaml keeps UseMetrics and UseServiceDiscovery).
Traces: adrs ADR-0028
Depends on AIFACTORY-US-302, feature:component-observability-factory-conventions
Sources model/components.yaml, model/template-parameters/connectsoft-api-library.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-642 Header propagation and instrumentation implementation The dependency injection extension takes a declared host mode. In the web host mode it registers header propagation for tracestate, baggage and the inbound correlation header on the fixed and on the discovered client and validates that the host enabled header propagation, naming the missing registration. In the mode without inbound requests it registers none and validates nothing, and trace context flows from the current activity. The scope headers are written only by the handler of AIFACTORY-TASK-639. The HTTP client instrumentation comes through the pinned single registration of the observability libraries, and no body or header value reaches a tag, a dimension or a log message. The open propagation and instrumentation items of the checklist are closed. ConnectSoft.ApiLibraryTemplate
AIFACTORY-TASK-1327 Configuration and Service Discovery pages describe propagation and telemetry documentation The Configuration and Service Discovery pages of the template describe the two host modes, the header propagation registration and its validation in a web host, the flow of trace context from the current activity in a host without inbound requests, the single writer of the scope headers and the telemetry registration; the maintainer checklist marks headers propagation, instrumentation and service discovery as shipped. ConnectSoft.ApiLibraryTemplate
AIFACTORY-TASK-1328 Verify propagation, telemetry names and the missing-registration failure verification Run the propagation and telemetry tests on a library generated with UseFactoryProfile and with UseServiceDiscovery, once in a web host fixture and once in a console host fixture of the scaffold tests. In the web host the headers arrive through header propagation and a missing registration fails validation; in the console host start-up succeeds and traceparent follows the current activity; in both the scope headers have one writer and the activity carries the scope tags and no payload, which proves AC1 to AC3 of AIFACTORY-US-303. ConnectSoft.ApiLibraryTemplate

AIFACTORY-US-304: API library template: the packed template is installed, instantiated for every layout and for the Factory profile, built and tested before the package publishes

evidence · persona asset-maintainer As an asset maintainer, I want every change of the API library template to be gated by the libraries it generates from the packed candidate, so that a package that would scaffold a client that does not build or pass never reaches the feed.

This PBI is the gate of the feature. The authoring pipeline of the template runs the unit tests and a scaffold test project that generates the AuthenticationType variants from the working tree, while the installer pipeline (azure-pipelines-template.yml of the template) packs the nuspec and pushes the installer package without instantiating the packed candidate. The gate closes that gap through the shared template installer steps of ConnectSoft.AzurePipelines: the installer pipeline calls the shared installer job in place of its own pack and push steps and switches on the gate hook and the version guard that AIFACTORY-TASK-1426 of the feature component-base-template-findings delivers. The candidate is packed once and installed; the hook runs the scaffold tests against it after the pack and before the push, and they instantiate it for every AuthenticationType choice including the JWT bearer choice, with UseServiceDiscovery, with UseMetrics off, with OpenAPI generation from the fixture document, and for a console host that registers the client in the mode without inbound requests. The Factory profile is the one additional gating case the amendment of ADR-0028 admits per declared profile: UseFactoryProfile with generation on. Each output is restored, built in Release, tested against its WireMock server and scanned for template placeholders that were not replaced. An output that fails any stage fails the run with the case and the stage named, no later stage of that case is reported as passed, and the push is not reached. Publication pushes the package to the ConnectSoft feed with a version that is not yet on the feed, and the version guard, which the template switches on, refuses a repeated version. The maintainer checklist and the Roadmap page of the template are reconciled with what ships, so that JWT, API key, caching, serialization, propagation and instrumentation are each marked by their real state and the Roadmap states the Factory profile where it listed multi-tenant configuration as a distant goal. This is an evidence PBI: a template feature has no scenario, so the gate names what it proves through traces.adrs and its sources.

Acceptance criteria

AC1 Given a change of the template, when its pipeline runs, then the candidate is packed once and installed, and the gate hook of the shared installer steps (AIFACTORY-TASK-1426) runs the scaffold tests, which instantiate it for every AuthenticationType choice, with UseServiceDiscovery, with OpenAPI generation, for the console host case and for the Factory profile case, and restore, build in Release, test and scan each output (ADR-0028 amendment on the Factory profile switch: one additional gating case per declared profile; model/template-parameters/connectsoft-api-library.yaml lists the parameters of the matrix).
AC2 Given a case fails any stage, when the pipeline evaluates the run, then the gate hook fails the run with the case and the stage named, no later stage of that case is reported as passed and the push is not reached; a fixture with a planted failing case proves the refusal (ADR-0028, model/backlog/epics.yaml states the gate as the completion of the epic).
AC3 Given every case is green, when the push step runs, then the package is pushed to the ConnectSoft feed with a version that is not on the feed, the version guard of the shared installer steps, which the template switches on, refuses a repeated version with the reason, and the maintainer checklist and the Roadmap page of the template mark JWT, API key, caching, serialization, propagation and instrumentation by their real state (ADR-0028, docs/architecture/catalogs/templates.md keeps the row of the template).
Traces: adrs ADR-0028
Depends on AIFACTORY-US-301, AIFACTORY-US-302, AIFACTORY-US-303, feature:component-base-template-findings
Sources model/components.yaml, model/backlog/epics.yaml, model/template-parameters/connectsoft-api-library.yaml, docs/architecture/catalogs/templates.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-1329 Installer pipeline instantiates the packed candidate across the layout matrix operations The installer pipeline file of the template calls the shared installer job of ConnectSoft.AzurePipelines in place of its own pack and push steps, so the candidate is packed once and installed, switches on the gate hook and the version guard of AIFACTORY-TASK-1426 and passes the hook the scaffold tests against the installed package for every AuthenticationType choice, UseServiceDiscovery, UseMetrics off, OpenAPI generation, the console host case and the Factory profile case; each case is named in the output of the hook and restores, builds, tests and scans its output, the push follows only when every case passed, and the guard refuses a version that is already on the feed. ConnectSoft.ApiLibraryTemplate
AIFACTORY-TASK-1330 Planted failing case fixture for the gate fixture A pipeline fixture generates one case with a planted compile defect and asserts that the run fails at the build stage with the case named and that the push is not reached. ConnectSoft.ApiLibraryTemplate
AIFACTORY-TASK-1331 Maintainer checklist and Roadmap page reconciled with what ships documentation The maintainer checklist marks generation, JWT, API key, caching, serialization, propagation, instrumentation and service discovery by their real state, and the Roadmap page states the Factory profile where it listed multi-tenant configuration as a long-term goal and carries no quarter or year. ConnectSoft.ApiLibraryTemplate
AIFACTORY-TASK-643 Generated-solution gate across layouts and the checklist reconciled verification One green run and one planted run of the gate: the scaffold tests instantiate the packed template for every AuthenticationType, with service discovery, with OpenAPI generation, for the console host case and for the Factory profile case, build and test each output, the planted case stops the run before publication and the green run publishes the package with a verified version, which proves AC1 to AC3 of AIFACTORY-US-304 (ADR-0028). ConnectSoft.ApiLibraryTemplate

AIFACTORY-US-118: API library template: OpenAPI generation, scope and propagation before the gateway clients is delivered and proven on a generated solution

enabling · persona asset-maintainer As an asset maintainer, I want API library template to carry OpenAPI generation, scope and propagation before the gateway clients, so that it serves typed client libraries for the control-plane, model and tool gateways; consumed by the CLI and the agent host without later rework.

This is the integration PBI of the feature. An asset maintainer packs the API library template with the generation switch, the Factory profile, the two host modes of propagation and the telemetry registration, installs the package and instantiates it across its layouts in the template pipeline. Every generated library builds and passes its tests before the package is allowed to publish; a case that fails any stage fails the run and blocks publication. The implementation lives in the earlier PBIs of this file; this PBI proves them together on the library the Factory generates next. From the published package a client is generated with UseFactoryProfile and with generation on from a fixture document in the shape of a gateway contract. It builds unchanged, and its WireMock tests show a call that carries the tenant and project headers and a workload token requested with svc. scopes and no audience, a call without scope that is refused before it leaves the process, and trace context that arrives in a web host and in a console host. The feature is done when that client builds from a fresh install of the published package, which is what the typed gateway clients feature consumes by a version pin. Repository of the feature: ConnectSoft.ApiLibraryTemplate.

Acceptance criteria

AC1 Given the template repository ConnectSoft.ApiLibraryTemplate with the work of this feature, when the template is packed, installed and instantiated in its pipeline, then the generated solution of every case builds and its tests pass before the package publishes with a verified version (ADR-0028, model/components.yaml).
AC2 Given the work of AIFACTORY-TASK-639 (scope and workload-token propagation) is done, then a client generated with UseFactoryProfile carries the tenant and project scope headers and a workload token with the svc. scopes of its registration, with no audience of a user API and no tenant claim, through one handler, a JWT bearer layout joins the AuthenticationType choices and sends a forwarded user token only to the gateway it was issued for, and a WireMock test proves that a call without scope is refused and a call with scope carries the token (docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md decision 2 and its amendment on workload tokens; ADR-0022 decision 2 for the tool gateway client).
AC3 Given the work of AIFACTORY-TASK-641 (client generation from an OpenAPI document) is done, then a generation switch takes an OpenAPI document and produces the typed client, requests and responses, the hand-written client stays for an API without a document, and the generated types stay out of version control (ADR-0028, model/template-parameters/connectsoft-api-library.yaml).
AC4 Given the work of AIFACTORY-TASK-642 (header propagation and instrumentation) is done, then tracestate, baggage and the inbound correlation header propagate through header propagation in a web host as the Service Discovery page of the template prescribes, a host without inbound requests takes trace context from the current activity, the scope headers have the handler of AIFACTORY-TASK-639 as their single writer, and the client emits the HTTP client activities and metrics of the single registration of the observability libraries (ADR-0028, docs/architecture/ecosystem-composition.md).
AC5 Given the work of AIFACTORY-TASK-643 (generated-solution gate across layouts and the checklist reconciled) is done, then the scaffold tests instantiate the packed template for every AuthenticationType, with service discovery, with OpenAPI generation, for the console host case and for the Factory profile case, the package publishes to the ConnectSoft feed only after every case is green, and the maintainer checklist and the Roadmap page state what ships (ADR-0028, docs/architecture/catalogs/templates.md).
Traces: adrs ADR-0022, ADR-0028
Depends on AIFACTORY-US-301, AIFACTORY-US-302, AIFACTORY-US-303, AIFACTORY-US-304
Sources model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-api-library.yaml, docs/architecture/catalogs/templates.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-1332 Generate a gateway client shape from the published package and run its tests verification A probe installs the published template package, generates a client with UseFactoryProfile and with generation on from the fixture gateway document, builds it in Release unchanged and runs its WireMock tests; the run proves AC2 to AC4 of AIFACTORY-US-118 on the published package (ADR-0022, ADR-0028). ConnectSoft.ApiLibraryTemplate
AIFACTORY-TASK-669 Verify api-library-template-factory-clients-delivered by running the declared command verification Run dotnet build -c Release and dotnet test -c Release --no-build on the authoring solution and on every case of the layout matrix after the published package is installed; they pass and prove AC1 to AC5 of AIFACTORY-US-118. ConnectSoft.ApiLibraryTemplate