Skip to content

AIFACTORY-FEAT-058: StoreProfileService: complete delivery

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 Data & Event Platform (PF-11) · Increment I4 Trust and accountability · State elaborated · Route backend-developer · Build order 128 of 185 (Factory code)

StoreProfileService is the service of bounded context BC-42 (Data & Event Foundations). The catalogue of store classes (operational relational, worker durable, cache, artifact, vector, graph, event transport, audit, analytics), the engine profile each class runs per topology (ADR-0006 NHibernate, ADR-0012 transport, ADR-0013 vector), and the binding of every logical store to its owning service, region and backup class (BC-42, original design §54). Its own repository is ConnectSoft.AI.SoftwareFactory.StoreProfileService.

Delivers StoreProfileService (complete)
Stubs —
Realizes adrs: ADR-0006, ADR-0012, ADR-0013, ADR-0017
Requirements FR-12, FUX-11, NFR-05, NFR-06, NFR-16, XL-09
Depends on —
Sources model/services/data-event/StoreProfileService.yaml

Scenarios to trace (6, catalog): SCN-StoreProfileService-001 ✓, SCN-StoreProfileService-002 ✓, SCN-StoreProfileService-003 ✓, SCN-StoreProfileService-004 ✓, SCN-StoreProfileService-005 ✓, SCN-StoreProfileService-006 ✓

AIFACTORY-US-049: Each service is bound to a store that fits the topology and the region

behavior · persona platform-admin As a platform administrator, I want a catalogue of store classes and the binding of each service to its store per topology, so that no service keeps tenant data in a store or region its rules forbid.

This is the integration PBI of the feature. StoreProfileService is the service of bounded context BC-42 that holds the runtime truth of where data lives. It owns two aggregates in store-profile-sql: StoreProfile, one engine profile of one store class on one topology with its engine, adapter library, migration convention, backup class, encryption and whether it is authoritative or derived, and StoreBinding, the binding of one logical store of the stores catalog to its one owning service, profile, region, customer-managed key reference, schemas and state Planned, Provisioned, Active, Draining or Decommissioned. Callers reach its three REST operations through the gateway DataEventFoundations under factory.data.read and factory.data.admin, and provisioning and the hosts call Stores.ResolveBinding with a workload identity. A binding must satisfy the residency of its tenant, which RetentionResidencyService evaluates, and key and connection references come from SecretBrokerService, never the secrets themselves. The behaviour is delivered by the behaviour PBIs of this feature: reading bindings and profiles (AIFACTORY-US-1466), the profile catalogue and its activation (AIFACTORY-US-1467), setting a binding under the residency check (AIFACTORY-US-1468), resolving a binding (AIFACTORY-US-1469) and re-evaluating bindings when a residency rule changes or a binding drifts (AIFACTORY-US-1470). The two events leave through the outbox of the store-profile messaging profile under the canonical envelope, and ResidencyRuleChanged enters through its inbox. The service binds the two region options of the model, DataEvent:Stores:DefaultRegion, the region of a tenant that did not select one (D31), westeurope by default and not reloadable, and DataEvent:Stores:AllowedRegions, the regions a tenant may select, westeurope and israelcentral by default and reloadable; a DefaultRegion that is not one of the AllowedRegions fails startup with the value named, and a reload that would drop the DefaultRegion from the AllowedRegions is refused and logged and the previous value stays. These two values are the source of the tenant region that ProjectService reads when it records the region of a new project (D140): a tenant is in the region it selected among the AllowedRegions, and in the DefaultRegion when it selected none. ProjectService is delivered in I1, before this service, so the owner supplies the same two values through the I1 precondition register of AIFACTORY-US-1339 before the I1 run, and the deployment of this service in I4 takes them unchanged; the values themselves are inputs of the owner and none is fixed here beyond the modelled defaults. Persistence, messaging and telemetry come from the base template with the Factory profile and the pinned observability packages, never forked. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService, created by the repository checklist of feature repository-and-pipeline-conventions.

Acceptance criteria

AC1 Given the repository ConnectSoft.AI.SoftwareFactory.StoreProfileService, whose first commit is the unchanged output of dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.StoreProfileService --UseFactoryProfile true from the pinned template package, when its pipeline runs with the work of this feature, then no second scaffold was run, the solution builds, the unit and acceptance tests pass and a container image is published (ADR-0028).
AC2 Given the acceptance suites of AIFACTORY-US-1466 to AIFACTORY-US-1470, when they run in the pipeline, then each of the six scenarios of StoreProfileService has a passing test that names its id, and a filter that discovers no test counts as a failure (model/scenarios/StoreProfileService.yaml).
AC3 Given the outbox and inbox of the store-profile messaging profile after the acceptance suites, when their records are read, then StoreProfileService/StoreProfileActivated and StoreProfileService/StoreBindingChanged were written in the transaction of the state change they announce, and the inbox registers exactly the subscription to RetentionResidencyService/ResidencyRuleChanged (ADR-0012, model/services/data-event/StoreProfileService.yaml).
AC4 Given the service starts, when liveness and readiness are probed, then readiness reports store-profile-sql, the messaging transport and SecretBrokerService, and the telemetry conformance test of the pinned observability packages passes with connectsoft.factory.data_event.store_bindings tagged with store class, region and state and connectsoft.factory.data_event.binding_drift tagged with kind, and no key or connection reference appears in a metric, an activity or a log record (ADR-0018, model/services/data-event/StoreProfileService.yaml).
AC5 Given the options DataEvent:Stores:DefaultRegion and DataEvent:Stores:AllowedRegions at their modelled defaults or at the values of the owner from the I1 precondition register, when the service starts, then both are bound and the DefaultRegion is one of the AllowedRegions; given a DefaultRegion outside the AllowedRegions, then startup fails with the value named; given a reload of AllowedRegions that keeps the DefaultRegion, then it takes effect without a restart, and one that drops it is refused, logged and the previous value stays; the runbook names the two options as the tenant-region source that ProjectService reads (model/services/data-event/StoreProfileService.yaml, model/services/control-plane/ProjectService.yaml).
Traces: services StoreProfileService, RetentionResidencyService, SecretBrokerService, DataEventFoundations
Traces: aggregates StoreProfileService/StoreProfile, StoreProfileService/StoreBinding
Traces: apis StoreProfileService/ListStoreBindings, StoreProfileService/ListStoreProfiles, StoreProfileService/SetStoreBinding, StoreProfileService/Stores.ResolveBinding
Traces: events StoreProfileService/StoreProfileActivated, StoreProfileService/StoreBindingChanged, RetentionResidencyService/ResidencyRuleChanged
Traces: adrs ADR-0006, ADR-0012, ADR-0013, ADR-0017, ADR-0018, ADR-0028
Traces: requirements FR-12, NFR-05, NFR-06, NFR-16
Relates: screens stores
Depends on AIFACTORY-US-1466, AIFACTORY-US-1467, AIFACTORY-US-1468, AIFACTORY-US-1469, AIFACTORY-US-1470, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:contracts-package, feature:component-observability-factory-conventions, feature:retention-residency-service
Sources model/services/data-event/StoreProfileService.yaml, model/scenarios/StoreProfileService.yaml, docs/planes/data-event/services/store-profile-service/index.md#purpose-and-responsibilities, docs/architecture/catalogs/stores.md

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-388 Create the repository ConnectSoft.AI.SoftwareFactory.StoreProfileService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile implementation The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.StoreProfileService --UseFactoryProfile true from the pinned template package is committed unchanged with the messaging service name store-profile, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image. ConnectSoft.AI.SoftwareFactory.StoreProfileService
AIFACTORY-TASK-389 Domain model: StoreProfile, StoreBinding implementation The aggregates hold the fields and invariants of the model (a derived profile is never authoritative and must be rebuildable, an authoritative profile has at most 15 minutes of RPO and 240 minutes of RTO, one owning service per store, no schema shared by two services, a region that satisfies residency) and the four transitions of BindingState; unit tests cover every invariant and every transition and refuse every transition the model does not list. ConnectSoft.AI.SoftwareFactory.StoreProfileService
AIFACTORY-TASK-390 Persistence in store-profile-sql: StoreProfiles, StoreBindings implementation Mappings and migrations for the two modelled tables with the tenant row filter, the composite keys and the indexes on owner and on region and state; mapping tests run against an isolated test database, never a shared one. ConnectSoft.AI.SoftwareFactory.StoreProfileService
AIFACTORY-TASK-391 API hosting skeleton: the 3 REST and 1 gRPC operations with scope enforcement and problem responses implementation ListStoreBindings, ListStoreProfiles and SetStoreBinding are hosted with JWT validation of the token the gateway forwards, scope enforcement per route and problem responses for every modelled refusal code; Stores.ResolveBinding is hosted with workload identity checks; the OpenAPI and proto documents are published; the behaviour of each operation is delivered by AIFACTORY-US-1466 to AIFACTORY-US-1469, not here. ConnectSoft.AI.SoftwareFactory.StoreProfileService
AIFACTORY-TASK-392 Messaging skeleton: outbox of the store-profile profile for 2 published events, inbox for ResidencyRuleChanged implementation The outbox writer enlists in the transaction of each state change and the dispatcher publishes StoreProfileActivated and StoreBindingChanged on their modelled topics under the canonical envelope; the inbox registers the one subscription to ResidencyRuleChanged with deduplication on the event id, and a test fails when a subscription appears that the model does not list. ConnectSoft.AI.SoftwareFactory.StoreProfileService
AIFACTORY-TASK-393 Worker hosting skeleton: trigger, retry policy and idempotency key of BindingReconciler implementation BindingReconciler is hosted with its schedule every six hours, a fixed retry of two attempts, the idempotency key store plus window and the partition by region; a duplicate trigger has no second effect; what the worker does is delivered by AIFACTORY-US-1470. ConnectSoft.AI.SoftwareFactory.StoreProfileService
AIFACTORY-TASK-394 Security, tenancy and telemetry of StoreProfileService implementation The two scopes and three roles of the model are enforced, every query runs under the tenant row filter so a binding of another tenant is not found, the messaging transport secret comes from a secret reference, the host makes the one call of the registration of the pinned observability packages, creates the two metrics of the model through its instrument helper and references the conformance test package from its architecture tests. ConnectSoft.AI.SoftwareFactory.StoreProfileService
AIFACTORY-TASK-706 Verify store-bindings-follow-residency by running the declared command verification Run dotnet build -c Release and dotnet test -c Release --no-build in the pipeline of ConnectSoft.AI.SoftwareFactory.StoreProfileService, then dotnet test -c Release --filter "Category=Acceptance&Scenario~SCN-StoreProfileService"; a filter that discovers no test counts as a failure; they pass and prove AC1 to AC5 of AIFACTORY-US-049, with a test for each of SCN-StoreProfileService-001 to SCN-StoreProfileService-006 and, for AC5, the options tests of AIFACTORY-TASK-6607. ConnectSoft.AI.SoftwareFactory.StoreProfileService
AIFACTORY-TASK-6607 Region options DataEvent:Stores DefaultRegion and AllowedRegions, the tenant-region source of ProjectService implementation The service binds DataEvent:Stores:DefaultRegion (default westeurope, not reloadable) and DataEvent:Stores:AllowedRegions (default westeurope and israelcentral, reloadable) at startup, fails startup with the value named when the DefaultRegion is not one of the AllowedRegions, applies a reload of AllowedRegions that keeps the DefaultRegion without a restart and refuses and logs one that drops it; the deployment values take the two values the owner supplied through the I1 precondition register of AIFACTORY-US-1339; the Runbook page of the repository names the two options as the tenant-region source that ProjectService reads, a tenant being in the region it selected among the AllowedRegions and in the DefaultRegion when it selected none (D31); options tests cover the start, the failing start and both reloads. ConnectSoft.AI.SoftwareFactory.StoreProfileService

AIFACTORY-US-1466: List the store bindings and the engine profiles that run them

behavior · persona observer As an observer, an operator or the Studio stores view, I want to see every logical store with its owner, profile, region, backup class and state, and the engine profiles per class and topology, so that I can tell where the data of the Factory lives and how it is protected.

A caller with factory.data.read lists the bindings through StoreProfileService/ListStoreBindings on GET /factory/data/stores and receives the storage catalog at runtime: every logical store with its owning service, its profile, its region, the backup class of its profile (RPO and RTO), its schemas and its state, filtered optionally by owning service, store class, region or state. Shared stores are bound under the platform tenant and are visible to every caller with the scope; a per-tenant store, as the on-prem profile has, is visible only to its own tenant and is not listed for another one. The same caller lists the engine profiles through StoreProfileService/ListStoreProfiles on GET /factory/data/store-profiles and receives every profile with its store class, topology, engine, adapter library, migration convention, backup class, encryption and whether it is authoritative or derived. No key or connection reference value is returned, only that a key reference is set. Neither read writes anything, and a caller without the scope is refused with 403. StudioBff serves both through the view stores.

Acceptance criteria

AC1 Given bindings of shared stores and one per-tenant store of another tenant, and a caller with factory.data.read, when StoreProfileService/ListStoreBindings is called with and without a filter by owner, then the response is 200 with the shared stores and their owner, profile, region, backup class, schemas and state, without the store of the other tenant and without any key value; nothing is written (SCN-StoreProfileService-001, ADR-0015).
AC2 Given the profile catalogue, when StoreProfileService/ListStoreProfiles is called, then the response is 200 with every profile, its class, topology, engine, adapter library, migration convention, backup class, encryption and authoritative flag (SCN-StoreProfileService-002, ADR-0006, ADR-0013).
AC3 Given a caller without factory.data.read, when either list is called, then the response is 403 with a problem response and no state changes (SCN-StoreProfileService-001, SCN-StoreProfileService-002).
Traces: services StoreProfileService
Traces: aggregates StoreProfileService/StoreBinding, StoreProfileService/StoreProfile
Traces: apis StoreProfileService/ListStoreBindings, StoreProfileService/ListStoreProfiles
Traces: adrs ADR-0006, ADR-0013, ADR-0015
Traces: requirements FR-12, FUX-11
Traces: scenarios SCN-StoreProfileService-001, SCN-StoreProfileService-002
Relates: screens stores
Sources model/services/data-event/StoreProfileService.yaml, docs/planes/data-event/services/store-profile-service/index.md#apis

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-5916 ListStoreBindings and ListStoreProfiles read models implementation ListStoreBindings returns the bindings visible to the tenant of the caller (shared stores of the platform tenant and its own per-tenant stores) with owner, profile, region, backup class, schemas and state, filtered and paged, without any key value; ListStoreProfiles returns every profile with its class, topology, engine, adapter, migration convention, backup class, encryption and authoritative flag; a missing scope is 403; neither writes. ConnectSoft.AI.SoftwareFactory.StoreProfileService
AIFACTORY-TASK-5917 Verify the store reads through the acceptance suite verification Run dotnet test -c Release --filter "Category=Acceptance&(Scenario=SCN-StoreProfileService-001\|Scenario=SCN-StoreProfileService-002)"; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1466 with a per-tenant store of another tenant and a caller without the scope. ConnectSoft.AI.SoftwareFactory.StoreProfileService

AIFACTORY-US-1467: Hold the engine profile per store class and topology and announce an activated profile with StoreProfileActivated

behavior · persona platform-admin As a platform admin, I want the engine profile of each store class on each topology held from the architecture model and activated for the topology the installation runs, so that every service binds its store to an engine, adapter and backup class the platform supports.

The profile catalogue follows the separation of data classes of the model: OperationalRelational, WorkerDurable, Cache, Artifact, Vector, Graph, EventTransport, Audit, Analytics and Secrets, each with one profile per topology (saas-default, hybrid, on-prem, hybrid-compute) that names its engine, its adapter library from the libraries catalog, its migration convention, its backup class, its encryption and whether it is authoritative; examples are the NHibernate profile on SQL Server of ADR-0006, the vector profiles of ADR-0013 and the immutable blob profile of audit. The model gives no operation that writes a profile, so the service loads the profiles from the stores catalog of the architecture model at start-up, applies the invariants (a derived class such as Cache or Vector is never authoritative, an authoritative profile has at most 15 minutes of RPO and 240 minutes of RTO) and refuses to load a profile that breaks one, naming it in the start-up report; the profiles are platform rows held under the platform tenant. A profile that is new for the topology of the installation, or whose engine, adapter or backup class changed, is activated and StoreProfileService/StoreProfileActivated with profileId, storeClass and topology is written in the same transaction; a start with nothing changed writes nothing. How a profile is added or changed between releases is reported to the owner.

Acceptance criteria

AC1 Given the stores catalog of the model and an empty StoreProfiles, when the service starts on the topology saas-default, then every profile of that catalog is held with its class, engine, adapter, migration convention, backup class, encryption and authoritative flag, each newly active StoreProfileService/StoreProfile writes StoreProfileService/StoreProfileActivated in the same transaction, and a second start writes nothing (SCN-StoreProfileService-005, docs/architecture/catalogs/stores.md).
AC2 Given a profile of class Vector marked authoritative, or an authoritative profile with an RPO above 15 minutes, when the catalogue is loaded, then that profile is refused and named in the start-up report and the others load (ADR-0013, model/services/data-event/StoreProfileService.yaml).
AC3 Given a profile activated, when the outbox dispatcher publishes StoreProfileService/StoreProfileActivated on data-foundations.stores.v1.store-profile-activated, then the event is sent under the canonical envelope with profileId, storeClass and topology, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-StoreProfileService-005, ADR-0012).
Traces: services StoreProfileService
Traces: aggregates StoreProfileService/StoreProfile
Traces: events StoreProfileService/StoreProfileActivated
Traces: adrs ADR-0006, ADR-0012, ADR-0013, ADR-0017
Traces: requirements NFR-06
Traces: scenarios SCN-StoreProfileService-005
Relates: screens stores
Sources model/services/data-event/StoreProfileService.yaml, docs/architecture/catalogs/stores.md

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-562 Store profiles per class and topology implementation The catalogue of store classes with the engine profile of each per topology is loaded from the stores catalog of the architecture model at start-up under the platform tenant, the profile invariants refuse a derived authoritative profile and an authoritative profile above the pilot backup class, and a new or changed profile of the topology of the installation is activated with StoreProfileActivated in the same transaction. ConnectSoft.AI.SoftwareFactory.StoreProfileService
AIFACTORY-TASK-5918 Verify the profile catalogue through the acceptance suite verification Run dotnet test -c Release --filter "Category=Acceptance&Scenario=SCN-StoreProfileService-005"; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1467 with a fixture catalog holding one invalid profile, two starts and the publication and payload of StoreProfileActivated. ConnectSoft.AI.SoftwareFactory.StoreProfileService

AIFACTORY-US-1468: Bind a logical store to its owner, profile, region and key under the residency check, announced by StoreBindingChanged

behavior · persona platform-admin As a platform admin or provisioning, I want to bind a logical store to its owning service, profile, region and key and move it through its lifecycle, so that every store has one owner, sits where the residency of its tenant allows and is encrypted with a known key.

A Platform admin, or the provisioning workload that the model names as the caller that applies bindings, calls StoreProfileService/SetStoreBinding with factory.data.admin on PUT /factory/data/stores/{storeId}, a production-class operation that is idempotent by nature. A user caller needs factory.data.admin and the Platform admin role; provisioning calls with a workload token, which carries service scopes and no user role (ADR-0015), and is admitted when its token holds factory.data.admin as a service scope. The path names the logical store of the stores catalog and the body names its owning service, its profile, its region, its customer-managed key reference, its schemas and, for a per-tenant store, its tenant; shared stores are bound under the platform tenant. A store the service does not hold is created in state Planned and the answer is 201; a binding it holds is changed and the answer is 200; the same body again answers 200 and writes nothing. A state change follows the four transitions of the model (Planned to Provisioned, Provisioned to Active once migrations are applied, Active to Draining when decommission is requested, Draining to Decommissioned once the data is moved or deleted). Before it saves, the service checks the region and the engine of the profile with Retention.EvaluateResidency of RetentionResidencyService for the tenant of the binding; a refusal is answered 422 with the id of the rule that refused, as the failure mode of the model states, and counts nothing here because RetentionResidencyService counts it. It also asks SecretBrokerService, a required dependency that fails fast, whether the key reference exists, and stores only the reference. The binding is never saved without a residency answer: when RetentionResidencyService or SecretBrokerService does not answer, the binding is not saved, no event is written, the caller receives 503 with a problem response that names the dependency (D137), and a repeat of the same body after recovery is applied once. Each refusal has one code: a second owning service for the store, a schema that another service already owns on the same server and a transition the model does not list conflict with the state held and are refused with 409; a profile that does not exist, a profile that is not of the class of the store and a key reference that SecretBrokerService does not know are invalid input and are refused with 422; each names the rule. A user caller without the scope or the Platform admin role, and a workload token without the service scope, are refused with 403. Every applied change writes StoreProfileService/StoreBindingChanged with storeId, tenantId, ownerService, region and state in the same transaction and moves connectsoft.factory.data_event.store_bindings.

Acceptance criteria

AC1 Given a Platform admin with factory.data.admin, or the provisioning workload whose token holds factory.data.admin as a service scope and carries no user role, and a region that the residency of the tenant allows, when StoreProfileService/SetStoreBinding binds a new store, then the response is 201, the StoreProfileService/StoreBinding is Planned with its owner, profile, region, key reference and schemas, and StoreProfileService/StoreBindingChanged is written in the same transaction; a state change Planned to Provisioned answers 200 and writes one more event; the same body again writes nothing (SCN-StoreProfileService-003, ADR-0012).
AC2 Given a region or engine that the residency of the tenant refuses, when the binding is set, then the response is 422 with the id of the refusing rule and nothing is written (SCN-StoreProfileService-003, ADR-0019).
AC3 Given a second owner, a schema owned by another service or a transition the model does not list, when the binding is set, then the response is 409 naming the rule; given an unknown profile, a profile of another class or an unknown key reference, then the response is 422 naming the rule; given a user caller without the scope or the Platform admin role, or a workload token without the service scope, then 403; no refusal writes a row or an event (SCN-StoreProfileService-003, model/services/data-event/StoreProfileService.yaml).
AC4 Given a binding changed, when the outbox dispatcher publishes StoreProfileService/StoreBindingChanged on data-foundations.stores.v1.store-binding-changed, then the event is sent under the canonical envelope with storeId, tenantId, ownerService, region and state, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-StoreProfileService-006, ADR-0012).
AC5 Given RetentionResidencyService or SecretBrokerService does not answer, when StoreProfileService/SetStoreBinding is called, then the binding is not saved, no event is written, the response is 503 with a problem response that names the dependency, and a repeat of the same body after the dependency answers again is applied once; no binding is ever saved without an answer of RetentionResidencyService/Retention.EvaluateResidency (SCN-StoreProfileService-003, ADR-0019, D137).
Traces: services StoreProfileService, RetentionResidencyService, SecretBrokerService
Traces: aggregates StoreProfileService/StoreBinding
Traces: apis StoreProfileService/SetStoreBinding, RetentionResidencyService/Retention.EvaluateResidency
Traces: events StoreProfileService/StoreBindingChanged
Traces: adrs ADR-0012, ADR-0019
Traces: requirements FR-12, NFR-16
Traces: scenarios SCN-StoreProfileService-003, SCN-StoreProfileService-006
Relates: screens stores
Depends on AIFACTORY-US-1467, feature:retention-residency-service, feature:secret-broker-service
Sources model/services/data-event/StoreProfileService.yaml, docs/planes/data-event/services/store-profile-service/index.md#failure-and-recovery

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-563 Bindings with the residency check implementation SetStoreBinding checks the region and engine of the binding with Retention.EvaluateResidency for the tenant of the binding and refuses a violation with 422 and the rule id; it creates a Planned binding with 201 or changes one with 200, applies only the modelled transitions, writes StoreBindingChanged in the same transaction and changes nothing on an unchanged repeat. ConnectSoft.AI.SoftwareFactory.StoreProfileService
AIFACTORY-TASK-5919 Ownership, schema, profile and key reference rules of SetStoreBinding implementation SetStoreBinding refuses with 409 a second owner, a schema of another service on the same server and a transition the model does not list, and with 422 an unknown profile, a profile of another class and a key reference that SecretBrokerService does not know, each naming the rule; it stores only the reference, refuses with 403 a user caller without factory.data.admin or the Platform admin role and a workload token without the service scope, and admits the provisioning workload with the scope; with fakes of RetentionResidencyService and of SecretBrokerService that do not answer, nothing is saved, no event is written, the answer is 503 with a problem response naming the dependency (D137) and a repeat of the same body after the fake answers is applied once. ConnectSoft.AI.SoftwareFactory.StoreProfileService
AIFACTORY-TASK-5920 Verify store binding through the acceptance suite verification Run dotnet test -c Release --filter "Category=Acceptance&(Scenario=SCN-StoreProfileService-003\|Scenario=SCN-StoreProfileService-006)"; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1468, including the residency refusal with its rule id, the one code of each refusal, the unanswered dependencies and the publication and payload of StoreBindingChanged; consumer handling is proven by the suites of RetentionResidencyService, StudioBff and AuditService. ConnectSoft.AI.SoftwareFactory.StoreProfileService

AIFACTORY-US-1469: Resolve a logical store to its connection and key references, region and state for a tenant

behavior · persona platform-admin As a platform admin who relies on provisioning and on the hosts at start-up, I want each of them to resolve a logical store of a tenant to its key reference, region and state, so that a service connects to the store it is bound to and nothing else.

Provisioning, at tenant creation, and the hosts, at start-up, call the internal gRPC method StoreProfileService/Stores.ResolveBinding with a workload identity and the request store-binding-resolution-request-v1, which names the logical store and the tenant; the tenant must be the one the workload forwards under its service scope. The reply store-binding-resolution-v1 carries the store, the tenant, the owning service, the profile, the region, the state, the connection reference and the key reference of the binding, never a secret, because references are resolved by the caller through SecretBrokerService (D137); these dedicated descriptors replace the borrowed execution-scope-v1 and ack-v1. StoreBinding holds keyReference but no connection reference field; as an assumption of this PBI the connection reference is the one SecretBrokerService, the dependency the model names for key and connection references, holds for the store, and the missing field of the aggregate is reported as an open question. A shared store resolves to its binding under the platform tenant; a per-tenant store resolves only for its own tenant, and the binding of another tenant is answered NOT_FOUND as ADR-0015 states for gRPC, as is a store that has no binding. A binding in state Draining or Decommissioned is answered with that state so the caller does not start writing to it. The workload of the owning service resolves its own stores, and the provisioning workload, admitted by the service scope factory.data.admin that the model gives provisioning, resolves any store it provisions; a workload of another service, neither the owner nor provisioning, that asks for a store it does not own is refused with PERMISSION_DENIED, because only the owning service reaches the store. A caller without a workload identity is refused with UNAUTHENTICATED and an invalid request with INVALID_ARGUMENT. The method is of class read and writes nothing.

Acceptance criteria

AC1 Given an Active binding of a shared store owned by RunControlService, when StoreProfileService/Stores.ResolveBinding is called by the workload of RunControlService or by the provisioning workload with the service scope factory.data.admin, then the reply store-binding-resolution-v1 carries the owning service, profile, region, state Active, connection reference and key reference of the StoreProfileService/StoreBinding and no secret value, and nothing is written (SCN-StoreProfileService-004, D137).
AC2 Given a per-tenant store of another tenant, a store without a binding, or a Draining binding, when it is resolved, then the answer is NOT_FOUND, NOT_FOUND or the state Draining respectively (SCN-StoreProfileService-004, ADR-0015).
AC3 Given the workload of a service that neither owns the store nor is provisioning, a caller without workload identity or an invalid request, when the method is called, then it is refused with PERMISSION_DENIED, UNAUTHENTICATED or INVALID_ARGUMENT and no state changes (SCN-StoreProfileService-004, ADR-0028).
Traces: services StoreProfileService
Traces: aggregates StoreProfileService/StoreBinding
Traces: apis StoreProfileService/Stores.ResolveBinding
Traces: descriptors store-binding-resolution-request-v1, store-binding-resolution-v1
Traces: adrs ADR-0015, ADR-0028
Traces: requirements NFR-05
Traces: scenarios SCN-StoreProfileService-004
Depends on AIFACTORY-US-1468
Sources model/services/data-event/StoreProfileService.yaml, docs/reference/schemas/store-binding-resolution.schema.json, docs/planes/data-event/services/store-profile-service/index.md#apis

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-5921 Stores.ResolveBinding for the owning workload and provisioning with tenant and ownership checks implementation ResolveBinding takes store-binding-resolution-request-v1, checks its tenant against the tenant the workload forwards under its service scope, and answers store-binding-resolution-v1 with the owning service, profile, region, state, connection reference and key reference of the binding of a shared store or of the own per-tenant store to the owning workload and to the provisioning workload with the service scope factory.data.admin (D137); it answers NOT_FOUND for another tenant and for a missing binding, PERMISSION_DENIED for any other workload, and UNAUTHENTICATED and INVALID_ARGUMENT for the other refusals, takes the connection reference from SecretBrokerService while StoreBinding holds no field for it, never returns a secret and writes nothing. ConnectSoft.AI.SoftwareFactory.StoreProfileService
AIFACTORY-TASK-5922 Verify binding resolution through the acceptance suite verification Run dotnet test -c Release --filter "Category=Acceptance&Scenario=SCN-StoreProfileService-004"; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1469 with an Active, a Draining and a foreign per-tenant binding and workloads of the owner, of provisioning and of another service. ConnectSoft.AI.SoftwareFactory.StoreProfileService

AIFACTORY-US-1470: Re-evaluate the bindings of a tenant when its residency changes and reconcile bindings against their stores

behavior · persona operator As an operator, I want bindings evaluated again when a residency rule changes and compared with the stores they describe, so that a violation or a drift is found and reported before it becomes an incident.

StoreProfileService consumes RetentionResidencyService/ResidencyRuleChanged through its handler ApplyResidencyRule, idempotent on the event id through the inbox: it evaluates every binding of the tenant of the event, and every shared binding that holds data of that tenant, against the new rule with Retention.EvaluateResidency, and a binding that no longer satisfies it is a residency finding. The model has no table or field for a finding (StoreBindings holds none), so a finding is kept only as the count of connectsoft.factory.data_event.binding_drift with its kind, a log record with the store id, the tenant and the rule id, and the event below; the missing finding store is reported to the owner. The model gives ApplyResidencyRule no result event; the working assumption of this PBI, reported to the owner, is that the handler announces each finding with StoreProfileService/StoreBindingChanged, whose summary speaks of a changed binding or state, even though the binding itself does not change, so RetentionResidencyService, StudioBff and AuditService see it. No data is moved by the handler, because moving data is a migration order, a later capability. The worker BindingReconciler runs every six hours as the model schedules it, partitioned by region, two at a time, retrying twice with a fixed backoff and idempotent on store plus window: it compares each Active binding with the observed state that provisioning reports for its store, as the model states (the schemas present, the region of the server, the age of the key reference against the rotation of SecretBrokerService), and finds a missing schema, a wrong region or an overdue key rotation, kept and announced the same way; a second run in the same window changes nothing. Which operation or event of provisioning supplies the observed state is not named by the model and is reported to the owner. Findings are reported, never repaired automatically.

Acceptance criteria

AC1 Given a binding of a tenant in westeurope and a delivery of RetentionResidencyService/ResidencyRuleChanged that allows only israelcentral, when ApplyResidencyRule handles it, then connectsoft.factory.data_event.binding_drift counts a finding with kind residency, a log record names the store, the tenant and the rule, StoreProfileService/StoreBindingChanged is written with the binding unchanged, no data moves, and a redelivery changes nothing (ADR-0019, ADR-0012).
AC2 Given observed state from a provisioning fake in which an Active binding misses a schema on its server and another has a key reference past its rotation, when BindingReconciler runs, then a finding of each kind is counted, logged and announced with StoreProfileService/StoreBindingChanged, a binding without drift writes nothing, and a second run in the same window changes nothing (model/services/data-event/StoreProfileService.yaml).
Traces: services StoreProfileService, RetentionResidencyService
Traces: aggregates StoreProfileService/StoreBinding
Traces: events StoreProfileService/StoreBindingChanged, RetentionResidencyService/ResidencyRuleChanged
Traces: adrs ADR-0012, ADR-0019
Traces: requirements NFR-16
Depends on AIFACTORY-US-1468, feature:retention-residency-service
Sources model/services/data-event/StoreProfileService.yaml, docs/planes/data-event/services/store-profile-service/index.md#workers-and-jobs

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-5923 ApplyResidencyRule handler of ResidencyRuleChanged implementation The inbox handler evaluates the bindings that hold data of the tenant of the event with Retention.EvaluateResidency once per event id, counts a residency finding for each refused binding in connectsoft.factory.data_event.binding_drift, logs it with store, tenant and rule id, writes StoreBindingChanged with the binding unchanged, under the assumption reported to the owner, in the transaction of the inbox record, keeps no finding row because the model has none, and moves no data. ConnectSoft.AI.SoftwareFactory.StoreProfileService
AIFACTORY-TASK-5924 BindingReconciler drift detection implementation BindingReconciler compares each Active binding of its region with the observed state that provisioning reports (schemas present, server region and key rotation age), read through a port whose provisioning source the owner names, counts and logs a finding per drift kind and writes StoreBindingChanged once per store and window, keeps no finding row, and changes nothing for a binding without drift. ConnectSoft.AI.SoftwareFactory.StoreProfileService
AIFACTORY-TASK-5925 Verify re-evaluation and reconciliation against AC1 and AC2 verification Run dotnet test -c Release --filter "Category=Acceptance&(FullyQualifiedName~ApplyResidencyRule\|FullyQualifiedName~BindingReconciler)"; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1470 with a fixture ResidencyRuleChanged of the published contract, a fake of RetentionResidencyService, a fake of the observed state of provisioning, a controlled clock and two runs in the same window. ConnectSoft.AI.SoftwareFactory.StoreProfileService